Skip to content

Commit b37c854

Browse files
authored
Merge pull request #79 from fenix-hub/dev
closes #68 #66
2 parents a887af7 + 2be0e3c commit b37c854

File tree

8 files changed

+169
-68
lines changed

8 files changed

+169
-68
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This plugin is now supported in [Godot Extended Library Discord](https://discord
1212
A complete GitHub integration for your Godot Editor! Manage your project without even opening your browser.
1313

1414
Author: *"Nicolo (fenix) Santilio"*
15-
Version: *1.3.4*
15+
Version: *1.3.5*
1616
Wiki: *[supported](https://github.com/fenix-hub/godot-engine.github-integration/wiki)*
1717
Godot Version: *3.2.3stable*
1818

addons/github-integration/scenes/Notifications.tscn

Lines changed: 67 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[gd_scene load_steps=7 format=2]
1+
[gd_scene load_steps=6 format=2]
22

33
[ext_resource path="res://addons/github-integration/scripts/Notifications.gd" type="Script" id=1]
44
[ext_resource path="res://addons/github-integration/resources/themes/GitHubTheme.tres" type="Theme" id=2]
@@ -11,9 +11,7 @@ content_margin_bottom = 4.0
1111
draw_center = false
1212
border_width_bottom = 1
1313

14-
[sub_resource type="StyleBoxFlat" id=3]
15-
16-
[sub_resource type="StyleBoxEmpty" id=4]
14+
[sub_resource type="StyleBoxEmpty" id=3]
1715
content_margin_left = 7.0
1816

1917
[node name="Notifications" type="Control"]
@@ -70,9 +68,10 @@ custom_styles/separator = SubResource( 1 )
7068
custom_constants/separation = 10
7169

7270
[node name="Invitations" type="VBoxContainer" parent="NotificationsContainer/NotificationsTabs/Tabs"]
71+
visible = false
7372
margin_top = 14.0
7473
margin_right = 820.0
75-
margin_bottom = 522.0
74+
margin_bottom = 256.0
7675
size_flags_horizontal = 3
7776
size_flags_vertical = 3
7877

@@ -82,17 +81,16 @@ margin_bottom = 22.0
8281
text = "There are 0 invitations received"
8382

8483
[node name="Settings" type="VBoxContainer" parent="NotificationsContainer/NotificationsTabs/Tabs"]
85-
visible = false
8684
margin_top = 14.0
8785
margin_right = 820.0
88-
margin_bottom = 266.0
86+
margin_bottom = 536.0
8987
size_flags_horizontal = 3
9088
size_flags_vertical = 3
9189
custom_constants/separation = 20
9290

9391
[node name="Notifications" type="VBoxContainer" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings"]
9492
margin_right = 820.0
95-
margin_bottom = 88.0
93+
margin_bottom = 84.0
9694
custom_constants/separation = 0
9795

9896
[node name="Label" type="Label" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Notifications"]
@@ -102,31 +100,25 @@ custom_styles/normal = SubResource( 2 )
102100
custom_colors/font_color_shadow = Color( 0, 0, 0, 0.392157 )
103101
text = "Notifications Settings"
104102

105-
[node name="HSeparator" type="HSeparator" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Notifications"]
106-
margin_top = 18.0
107-
margin_right = 820.0
108-
margin_bottom = 22.0
109-
custom_styles/separator = SubResource( 3 )
110-
111103
[node name="AutoUpdateNotificationsChk" type="CheckButton" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Notifications"]
112-
margin_top = 22.0
104+
margin_top = 18.0
113105
margin_right = 820.0
114-
margin_bottom = 56.0
106+
margin_bottom = 52.0
115107
rect_min_size = Vector2( 300, 0 )
116108
pressed = true
117109
text = "Auto update notifications"
118110

119111
[node name="AutoUpdateTimer" type="HBoxContainer" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Notifications"]
120-
margin_top = 56.0
112+
margin_top = 52.0
121113
margin_right = 820.0
122-
margin_bottom = 88.0
114+
margin_bottom = 84.0
123115

124116
[node name="Label" type="Label" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Notifications/AutoUpdateTimer"]
125117
margin_top = 9.0
126118
margin_right = 687.0
127119
margin_bottom = 23.0
128120
size_flags_horizontal = 3
129-
custom_styles/normal = SubResource( 4 )
121+
custom_styles/normal = SubResource( 3 )
130122
text = "Auto update notifications timer"
131123

132124
[node name="Amount" type="LineEdit" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Notifications/AutoUpdateTimer"]
@@ -144,9 +136,9 @@ margin_bottom = 27.0
144136
text = "minutes"
145137

146138
[node name="Plugin" type="VBoxContainer" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings"]
147-
margin_top = 108.0
139+
margin_top = 104.0
148140
margin_right = 820.0
149-
margin_bottom = 232.0
141+
margin_bottom = 230.0
150142
size_flags_vertical = 3
151143
custom_constants/separation = 0
152144

@@ -157,56 +149,87 @@ custom_styles/normal = SubResource( 2 )
157149
custom_colors/font_color_shadow = Color( 0, 0, 0, 0.392157 )
158150
text = "Plugin Settings"
159151

160-
[node name="HSeparator" type="HSeparator" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Plugin"]
161-
margin_top = 18.0
162-
margin_right = 820.0
163-
margin_bottom = 22.0
164-
custom_styles/separator = SubResource( 3 )
165-
166152
[node name="DebugMessagesChk" type="CheckButton" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Plugin"]
167-
margin_top = 22.0
153+
margin_top = 18.0
168154
margin_right = 820.0
169-
margin_bottom = 56.0
155+
margin_bottom = 52.0
170156
rect_min_size = Vector2( 300, 0 )
171157
pressed = true
172158
text = "Debug messages in output console"
173159

174160
[node name="AutoLoginChk" type="CheckButton" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Plugin"]
175-
margin_top = 56.0
161+
margin_top = 52.0
176162
margin_right = 820.0
177-
margin_bottom = 90.0
163+
margin_bottom = 86.0
178164
rect_min_size = Vector2( 300, 0 )
179165
text = "Auto login at plugin startup"
180166

181167
[node name="DarkmodeChk" type="CheckButton" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Plugin"]
182-
margin_top = 90.0
168+
margin_top = 86.0
183169
margin_right = 820.0
184-
margin_bottom = 124.0
170+
margin_bottom = 120.0
185171
rect_min_size = Vector2( 300, 0 )
172+
pressed = true
186173
text = "Darkmode"
187174

188-
[node name="ResetPluginBtn" type="Button" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Plugin"]
189-
margin_top = 370.0
175+
[node name="Repositories" type="VBoxContainer" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings"]
176+
margin_top = 250.0
177+
margin_right = 820.0
178+
margin_bottom = 376.0
179+
size_flags_vertical = 3
180+
custom_constants/separation = 0
181+
182+
[node name="Label" type="Label" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Repositories"]
183+
margin_right = 820.0
184+
margin_bottom = 18.0
185+
custom_styles/normal = SubResource( 2 )
186+
custom_colors/font_color_shadow = Color( 0, 0, 0, 0.392157 )
187+
text = "Repositories"
188+
189+
[node name="OwnerAffiliations" type="HBoxContainer" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Repositories"]
190+
margin_top = 18.0
191+
margin_right = 820.0
192+
margin_bottom = 40.0
193+
custom_constants/separation = 10
194+
195+
[node name="Label" type="Label" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Repositories/OwnerAffiliations"]
196+
margin_right = 158.0
197+
margin_bottom = 22.0
198+
text = "Filter owner affiliations:"
199+
200+
[node name="Owner" type="CheckBox" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Repositories/OwnerAffiliations"]
201+
margin_left = 470.0
202+
margin_right = 535.0
203+
margin_bottom = 22.0
204+
size_flags_horizontal = 10
205+
text = "owner"
206+
207+
[node name="Collaborator" type="CheckBox" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Repositories/OwnerAffiliations"]
208+
margin_left = 545.0
209+
margin_right = 647.0
210+
margin_bottom = 22.0
211+
text = "collaborator"
212+
213+
[node name="OrganizationMember" type="CheckBox" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Repositories/OwnerAffiliations"]
214+
margin_left = 657.0
215+
margin_right = 820.0
216+
margin_bottom = 22.0
217+
text = "organization member"
218+
219+
[node name="ResetPluginBtn" type="Button" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings"]
220+
margin_top = 492.0
190221
margin_right = 127.0
191-
margin_bottom = 400.0
222+
margin_bottom = 522.0
192223
size_flags_horizontal = 0
193224
size_flags_vertical = 10
194225
custom_colors/font_color = Color( 1, 0, 0, 1 )
195226
custom_colors/font_color_hover = Color( 0, 0, 0, 1 )
196227
text = "Reset this plugin"
197228

198-
[node name="HSeparator2" type="HSeparator" parent="NotificationsContainer/NotificationsTabs/Tabs"]
199-
margin_top = 526.0
200-
margin_right = 820.0
201-
margin_bottom = 536.0
202-
custom_styles/separator = SubResource( 1 )
203-
custom_constants/separation = 10
204-
205229
[node name="Timer" type="Timer" parent="."]
206230
wait_time = 300.0
207231

208232
[node name="ResetPluginDialog" type="ConfirmationDialog" parent="."]
209-
visible = true
210233
anchor_left = 0.5
211234
anchor_top = 0.5
212235
anchor_right = 0.5

addons/github-integration/scenes/UserPanel.tscn

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[gd_scene load_steps=26 format=2]
1+
[gd_scene load_steps=27 format=2]
22

33
[ext_resource path="res://addons/github-integration/scripts/NewGist.gd" type="Script" id=1]
44
[ext_resource path="res://addons/github-integration/resources/user/placeholder.png" type="Texture" id=2]
@@ -8,6 +8,7 @@
88
[ext_resource path="res://addons/github-integration/scenes/NormalBtn.tscn" type="PackedScene" id=6]
99
[ext_resource path="res://addons/github-integration/scenes/NewRepo.tscn" type="PackedScene" id=7]
1010
[ext_resource path="res://addons/github-integration/resources/styles/List-black.tres" type="StyleBox" id=8]
11+
[ext_resource path="res://addons/github-integration/icons/reload.png" type="Texture" id=9]
1112

1213
[sub_resource type="StyleBoxEmpty" id=1]
1314

@@ -305,8 +306,7 @@ custom_constants/separation = 10
305306
alignment = 1
306307

307308
[node name="repo" type="Button" parent="Panel/List/repos_buttons"]
308-
margin_left = 426.0
309-
margin_right = 564.0
309+
margin_right = 138.0
310310
margin_bottom = 32.0
311311
rect_min_size = Vector2( 120, 0 )
312312
size_flags_horizontal = 5
@@ -325,6 +325,13 @@ __meta__ = {
325325
"_edit_use_anchors_": false
326326
}
327327

328+
[node name="reload" type="Button" parent="Panel/List/repos_buttons"]
329+
margin_left = 954.0
330+
margin_right = 990.0
331+
margin_bottom = 32.0
332+
size_flags_horizontal = 10
333+
icon = ExtResource( 9 )
334+
328335
[node name="SEPARATOR" type="HSeparator" parent="Panel/List"]
329336
margin_top = 281.0
330337
margin_right = 990.0
@@ -416,8 +423,7 @@ custom_constants/separation = 10
416423
alignment = 1
417424

418425
[node name="gist" type="Button" parent="Panel/List/gist_buttons"]
419-
margin_left = 435.0
420-
margin_right = 555.0
426+
margin_right = 120.0
421427
margin_bottom = 32.0
422428
rect_min_size = Vector2( 120, 0 )
423429
size_flags_horizontal = 5
@@ -436,6 +442,13 @@ __meta__ = {
436442
"_edit_use_anchors_": false
437443
}
438444

445+
[node name="reload" type="Button" parent="Panel/List/gist_buttons"]
446+
margin_left = 954.0
447+
margin_right = 990.0
448+
margin_bottom = 32.0
449+
size_flags_horizontal = 10
450+
icon = ExtResource( 9 )
451+
439452
[node name="HSeparator7" type="HSeparator" parent="Panel"]
440453
margin_top = 592.0
441454
margin_right = 990.0
@@ -457,7 +470,6 @@ text = "Reload"
457470
icon = SubResource( 16 )
458471

459472
[node name="NewGist" type="WindowDialog" parent="."]
460-
visible = true
461473
anchor_left = 0.5
462474
anchor_top = 0.5
463475
anchor_right = 0.5

addons/github-integration/scripts/Notifications.gd

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ onready var auto_update_notifications_amount : LineEdit = $NotificationsContaine
1313
onready var debug_messages_chk : CheckButton = $NotificationsContainer/NotificationsTabs/Tabs/Settings/Plugin/DebugMessagesChk
1414
onready var auto_login_chk : CheckButton = $NotificationsContainer/NotificationsTabs/Tabs/Settings/Plugin/AutoLoginChk
1515
onready var darkmode_chck : CheckButton = $NotificationsContainer/NotificationsTabs/Tabs/Settings/Plugin/DarkmodeChk
16+
onready var owner_check : CheckBox = $NotificationsContainer/NotificationsTabs/Tabs/Settings/Repositories/OwnerAffiliations/Owner
17+
onready var collaborator_check : CheckBox = $NotificationsContainer/NotificationsTabs/Tabs/Settings/Repositories/OwnerAffiliations/Collaborator
18+
onready var organization_member_check : CheckBox = $NotificationsContainer/NotificationsTabs/Tabs/Settings/Repositories/OwnerAffiliations/OrganizationMember
19+
1620

1721
signal add_notifications(amount)
1822

@@ -36,8 +40,11 @@ func _connect_signals() -> void:
3640
debug_messages_chk.connect("toggled", self, "_on_debug_toggled")
3741
auto_login_chk.connect("toggled", self, "_on_autologin_toggled")
3842
darkmode_chck.connect("toggled", self, "_on_darkmode_toggled")
39-
$NotificationsContainer/NotificationsTabs/Tabs/Settings/Plugin/ResetPluginBtn.connect("pressed", self, "_on_reset_plugin_pressed")
43+
$NotificationsContainer/NotificationsTabs/Tabs/Settings/ResetPluginBtn.connect("pressed", self, "_on_reset_plugin_pressed")
4044
$ResetPluginDialog.connect("confirmed", self, "_on_reset_confirmed")
45+
owner_check.connect("toggled", self, "_on_owner_check_pressed")
46+
collaborator_check.connect("toggled", self, "_on_collaborator_check_pressed")
47+
organization_member_check.connect("toggled", self, "_on_organization_member_check_pressed")
4148

4249
func load_settings():
4350
var auto_update_notifications : bool = PluginSettings.auto_update_notifications
@@ -50,6 +57,13 @@ func load_settings():
5057
debug_messages_chk.set_pressed(PluginSettings.debug)
5158
auto_login_chk.set_pressed(PluginSettings.auto_log)
5259
darkmode_chck.set_pressed(darkmode)
60+
var owner_affiliations : Array = PluginSettings.owner_affiliations
61+
load_owner_affiliations(owner_affiliations)
62+
63+
func load_owner_affiliations(affiliations : Array):
64+
owner_check.set_pressed("OWNER" in affiliations)
65+
collaborator_check.set_pressed("COLLABORATOR" in affiliations)
66+
organization_member_check.set_pressed("ORGANIZATION_MEMBER" in affiliations)
5367

5468
func _on_notification_request_failed(requesting : int, error_body : Dictionary):
5569
match requesting:
@@ -181,3 +195,33 @@ func _on_reset_confirmed():
181195
get_parent().logout()
182196
get_parent().SignIn.delete_user()
183197
PluginSettings.reset_plugin()
198+
199+
func _on_owner_check_pressed(toggled : bool):
200+
if toggled:
201+
if not "OWNER" in PluginSettings.owner_affiliations:
202+
PluginSettings.owner_affiliations.append("OWNER")
203+
else:
204+
if "OWNER" in PluginSettings.owner_affiliations:
205+
PluginSettings.owner_affiliations.erase("OWNER")
206+
PluginSettings.set_owner_affiliations(PluginSettings.owner_affiliations)
207+
get_parent().print_debug_message("repositories setting '%s': %s"%["OWNER",toggled])
208+
209+
func _on_collaborator_check_pressed(toggled : bool):
210+
if toggled:
211+
if not ("COLLABORATOR" in PluginSettings.owner_affiliations):
212+
PluginSettings.owner_affiliations.append("COLLABORATOR")
213+
else:
214+
if "COLLABORATOR" in PluginSettings.owner_affiliations:
215+
PluginSettings.owner_affiliations.erase("COLLABORATOR")
216+
PluginSettings.set_owner_affiliations(PluginSettings.owner_affiliations)
217+
get_parent().print_debug_message("repositories setting '%s': %s"%["COLLABORATOR",toggled])
218+
219+
func _on_organization_member_check_pressed(toggled : bool):
220+
if toggled:
221+
if not "ORGANIZATION_MEMBER" in PluginSettings.owner_affiliations:
222+
PluginSettings.owner_affiliations.append("ORGANIZATION_MEMBER")
223+
else:
224+
if "ORGANIZATION_MEMBER" in PluginSettings.owner_affiliations:
225+
PluginSettings.owner_affiliations.erase("ORGANIZATION_MEMBER")
226+
PluginSettings.set_owner_affiliations(PluginSettings.owner_affiliations)
227+
get_parent().print_debug_message("repositories setting '%s': %s"%["ORGANIZATION_MEMBER",toggled])

addons/github-integration/scripts/PluginSettings.gd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ var auto_log : bool = false
1111
var darkmode : bool = false
1212
var auto_update_notifications : bool = true
1313
var auto_update_timer : float = 300
14+
var owner_affiliations : Array = ["OWNER","COLLABORATOR","ORGANIZATION_MEMBER"]
1415

1516
func _check_plugin_path():
1617
var dir = Directory.new()
@@ -29,13 +30,15 @@ func _ready():
2930
darkmode = config_file.get_value("settings","darkmode", darkmode)
3031
auto_update_notifications = config_file.get_value("settings","auto_update_notifications", auto_update_notifications)
3132
auto_update_timer = config_file.get_value("settings","auto_update_timer",auto_update_timer)
33+
owner_affiliations = config_file.get_value("settings", "owner_affiliations", owner_affiliations)
3234
else:
3335
config_file.save(plugin_path+setting_file)
3436
config_file.set_value("settings","debug",debug)
3537
config_file.set_value("settings","auto_log",auto_log)
3638
config_file.set_value("settings","darkmode",darkmode)
3739
config_file.set_value("settings","auto_update_notifications", auto_update_notifications)
3840
config_file.set_value("settings","auto_update_timer",auto_update_timer)
41+
config_file.set_value("settings","owner_affiliations",owner_affiliations)
3942
config_file.save(plugin_path+setting_file)
4043

4144
func set_debug(d : bool):
@@ -58,6 +61,10 @@ func set_auto_update_timer(timer : float):
5861
auto_update_timer = timer
5962
save_setting("auto_update_timer", timer)
6063

64+
func set_owner_affiliations(affiliations : Array):
65+
owner_affiliations = affiliations
66+
save_setting("owner_affiliations", owner_affiliations)
67+
6168
func save_setting(key : String, value):
6269
_check_plugin_path()
6370
var file : ConfigFile = ConfigFile.new()

0 commit comments

Comments
 (0)