Skip to content

Commit

Permalink
Merge pull request #79 from fenix-hub/dev
Browse files Browse the repository at this point in the history
closes #68 #66
  • Loading branch information
fenix-hub authored Nov 23, 2020
2 parents a887af7 + 2be0e3c commit b37c854
Show file tree
Hide file tree
Showing 8 changed files with 169 additions and 68 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This plugin is now supported in [Godot Extended Library Discord](https://discord
A complete GitHub integration for your Godot Editor! Manage your project without even opening your browser.

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

Expand Down
111 changes: 67 additions & 44 deletions addons/github-integration/scenes/Notifications.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=7 format=2]
[gd_scene load_steps=6 format=2]

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

[sub_resource type="StyleBoxFlat" id=3]

[sub_resource type="StyleBoxEmpty" id=4]
[sub_resource type="StyleBoxEmpty" id=3]
content_margin_left = 7.0

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

[node name="Invitations" type="VBoxContainer" parent="NotificationsContainer/NotificationsTabs/Tabs"]
visible = false
margin_top = 14.0
margin_right = 820.0
margin_bottom = 522.0
margin_bottom = 256.0
size_flags_horizontal = 3
size_flags_vertical = 3

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

[node name="Settings" type="VBoxContainer" parent="NotificationsContainer/NotificationsTabs/Tabs"]
visible = false
margin_top = 14.0
margin_right = 820.0
margin_bottom = 266.0
margin_bottom = 536.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/separation = 20

[node name="Notifications" type="VBoxContainer" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings"]
margin_right = 820.0
margin_bottom = 88.0
margin_bottom = 84.0
custom_constants/separation = 0

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

[node name="HSeparator" type="HSeparator" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Notifications"]
margin_top = 18.0
margin_right = 820.0
margin_bottom = 22.0
custom_styles/separator = SubResource( 3 )

[node name="AutoUpdateNotificationsChk" type="CheckButton" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Notifications"]
margin_top = 22.0
margin_top = 18.0
margin_right = 820.0
margin_bottom = 56.0
margin_bottom = 52.0
rect_min_size = Vector2( 300, 0 )
pressed = true
text = "Auto update notifications"

[node name="AutoUpdateTimer" type="HBoxContainer" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Notifications"]
margin_top = 56.0
margin_top = 52.0
margin_right = 820.0
margin_bottom = 88.0
margin_bottom = 84.0

[node name="Label" type="Label" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Notifications/AutoUpdateTimer"]
margin_top = 9.0
margin_right = 687.0
margin_bottom = 23.0
size_flags_horizontal = 3
custom_styles/normal = SubResource( 4 )
custom_styles/normal = SubResource( 3 )
text = "Auto update notifications timer"

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

[node name="Plugin" type="VBoxContainer" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings"]
margin_top = 108.0
margin_top = 104.0
margin_right = 820.0
margin_bottom = 232.0
margin_bottom = 230.0
size_flags_vertical = 3
custom_constants/separation = 0

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

[node name="HSeparator" type="HSeparator" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Plugin"]
margin_top = 18.0
margin_right = 820.0
margin_bottom = 22.0
custom_styles/separator = SubResource( 3 )

[node name="DebugMessagesChk" type="CheckButton" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Plugin"]
margin_top = 22.0
margin_top = 18.0
margin_right = 820.0
margin_bottom = 56.0
margin_bottom = 52.0
rect_min_size = Vector2( 300, 0 )
pressed = true
text = "Debug messages in output console"

[node name="AutoLoginChk" type="CheckButton" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Plugin"]
margin_top = 56.0
margin_top = 52.0
margin_right = 820.0
margin_bottom = 90.0
margin_bottom = 86.0
rect_min_size = Vector2( 300, 0 )
text = "Auto login at plugin startup"

[node name="DarkmodeChk" type="CheckButton" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Plugin"]
margin_top = 90.0
margin_top = 86.0
margin_right = 820.0
margin_bottom = 124.0
margin_bottom = 120.0
rect_min_size = Vector2( 300, 0 )
pressed = true
text = "Darkmode"

[node name="ResetPluginBtn" type="Button" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Plugin"]
margin_top = 370.0
[node name="Repositories" type="VBoxContainer" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings"]
margin_top = 250.0
margin_right = 820.0
margin_bottom = 376.0
size_flags_vertical = 3
custom_constants/separation = 0

[node name="Label" type="Label" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Repositories"]
margin_right = 820.0
margin_bottom = 18.0
custom_styles/normal = SubResource( 2 )
custom_colors/font_color_shadow = Color( 0, 0, 0, 0.392157 )
text = "Repositories"

[node name="OwnerAffiliations" type="HBoxContainer" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Repositories"]
margin_top = 18.0
margin_right = 820.0
margin_bottom = 40.0
custom_constants/separation = 10

[node name="Label" type="Label" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Repositories/OwnerAffiliations"]
margin_right = 158.0
margin_bottom = 22.0
text = "Filter owner affiliations:"

[node name="Owner" type="CheckBox" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Repositories/OwnerAffiliations"]
margin_left = 470.0
margin_right = 535.0
margin_bottom = 22.0
size_flags_horizontal = 10
text = "owner"

[node name="Collaborator" type="CheckBox" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Repositories/OwnerAffiliations"]
margin_left = 545.0
margin_right = 647.0
margin_bottom = 22.0
text = "collaborator"

[node name="OrganizationMember" type="CheckBox" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings/Repositories/OwnerAffiliations"]
margin_left = 657.0
margin_right = 820.0
margin_bottom = 22.0
text = "organization member"

[node name="ResetPluginBtn" type="Button" parent="NotificationsContainer/NotificationsTabs/Tabs/Settings"]
margin_top = 492.0
margin_right = 127.0
margin_bottom = 400.0
margin_bottom = 522.0
size_flags_horizontal = 0
size_flags_vertical = 10
custom_colors/font_color = Color( 1, 0, 0, 1 )
custom_colors/font_color_hover = Color( 0, 0, 0, 1 )
text = "Reset this plugin"

[node name="HSeparator2" type="HSeparator" parent="NotificationsContainer/NotificationsTabs/Tabs"]
margin_top = 526.0
margin_right = 820.0
margin_bottom = 536.0
custom_styles/separator = SubResource( 1 )
custom_constants/separation = 10

[node name="Timer" type="Timer" parent="."]
wait_time = 300.0

[node name="ResetPluginDialog" type="ConfirmationDialog" parent="."]
visible = true
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
Expand Down
24 changes: 18 additions & 6 deletions addons/github-integration/scenes/UserPanel.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=26 format=2]
[gd_scene load_steps=27 format=2]

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

[sub_resource type="StyleBoxEmpty" id=1]

Expand Down Expand Up @@ -305,8 +306,7 @@ custom_constants/separation = 10
alignment = 1

[node name="repo" type="Button" parent="Panel/List/repos_buttons"]
margin_left = 426.0
margin_right = 564.0
margin_right = 138.0
margin_bottom = 32.0
rect_min_size = Vector2( 120, 0 )
size_flags_horizontal = 5
Expand All @@ -325,6 +325,13 @@ __meta__ = {
"_edit_use_anchors_": false
}

[node name="reload" type="Button" parent="Panel/List/repos_buttons"]
margin_left = 954.0
margin_right = 990.0
margin_bottom = 32.0
size_flags_horizontal = 10
icon = ExtResource( 9 )

[node name="SEPARATOR" type="HSeparator" parent="Panel/List"]
margin_top = 281.0
margin_right = 990.0
Expand Down Expand Up @@ -416,8 +423,7 @@ custom_constants/separation = 10
alignment = 1

[node name="gist" type="Button" parent="Panel/List/gist_buttons"]
margin_left = 435.0
margin_right = 555.0
margin_right = 120.0
margin_bottom = 32.0
rect_min_size = Vector2( 120, 0 )
size_flags_horizontal = 5
Expand All @@ -436,6 +442,13 @@ __meta__ = {
"_edit_use_anchors_": false
}

[node name="reload" type="Button" parent="Panel/List/gist_buttons"]
margin_left = 954.0
margin_right = 990.0
margin_bottom = 32.0
size_flags_horizontal = 10
icon = ExtResource( 9 )

[node name="HSeparator7" type="HSeparator" parent="Panel"]
margin_top = 592.0
margin_right = 990.0
Expand All @@ -457,7 +470,6 @@ text = "Reload"
icon = SubResource( 16 )

[node name="NewGist" type="WindowDialog" parent="."]
visible = true
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
Expand Down
46 changes: 45 additions & 1 deletion addons/github-integration/scripts/Notifications.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ onready var auto_update_notifications_amount : LineEdit = $NotificationsContaine
onready var debug_messages_chk : CheckButton = $NotificationsContainer/NotificationsTabs/Tabs/Settings/Plugin/DebugMessagesChk
onready var auto_login_chk : CheckButton = $NotificationsContainer/NotificationsTabs/Tabs/Settings/Plugin/AutoLoginChk
onready var darkmode_chck : CheckButton = $NotificationsContainer/NotificationsTabs/Tabs/Settings/Plugin/DarkmodeChk
onready var owner_check : CheckBox = $NotificationsContainer/NotificationsTabs/Tabs/Settings/Repositories/OwnerAffiliations/Owner
onready var collaborator_check : CheckBox = $NotificationsContainer/NotificationsTabs/Tabs/Settings/Repositories/OwnerAffiliations/Collaborator
onready var organization_member_check : CheckBox = $NotificationsContainer/NotificationsTabs/Tabs/Settings/Repositories/OwnerAffiliations/OrganizationMember


signal add_notifications(amount)

Expand All @@ -36,8 +40,11 @@ func _connect_signals() -> void:
debug_messages_chk.connect("toggled", self, "_on_debug_toggled")
auto_login_chk.connect("toggled", self, "_on_autologin_toggled")
darkmode_chck.connect("toggled", self, "_on_darkmode_toggled")
$NotificationsContainer/NotificationsTabs/Tabs/Settings/Plugin/ResetPluginBtn.connect("pressed", self, "_on_reset_plugin_pressed")
$NotificationsContainer/NotificationsTabs/Tabs/Settings/ResetPluginBtn.connect("pressed", self, "_on_reset_plugin_pressed")
$ResetPluginDialog.connect("confirmed", self, "_on_reset_confirmed")
owner_check.connect("toggled", self, "_on_owner_check_pressed")
collaborator_check.connect("toggled", self, "_on_collaborator_check_pressed")
organization_member_check.connect("toggled", self, "_on_organization_member_check_pressed")

func load_settings():
var auto_update_notifications : bool = PluginSettings.auto_update_notifications
Expand All @@ -50,6 +57,13 @@ func load_settings():
debug_messages_chk.set_pressed(PluginSettings.debug)
auto_login_chk.set_pressed(PluginSettings.auto_log)
darkmode_chck.set_pressed(darkmode)
var owner_affiliations : Array = PluginSettings.owner_affiliations
load_owner_affiliations(owner_affiliations)

func load_owner_affiliations(affiliations : Array):
owner_check.set_pressed("OWNER" in affiliations)
collaborator_check.set_pressed("COLLABORATOR" in affiliations)
organization_member_check.set_pressed("ORGANIZATION_MEMBER" in affiliations)

func _on_notification_request_failed(requesting : int, error_body : Dictionary):
match requesting:
Expand Down Expand Up @@ -181,3 +195,33 @@ func _on_reset_confirmed():
get_parent().logout()
get_parent().SignIn.delete_user()
PluginSettings.reset_plugin()

func _on_owner_check_pressed(toggled : bool):
if toggled:
if not "OWNER" in PluginSettings.owner_affiliations:
PluginSettings.owner_affiliations.append("OWNER")
else:
if "OWNER" in PluginSettings.owner_affiliations:
PluginSettings.owner_affiliations.erase("OWNER")
PluginSettings.set_owner_affiliations(PluginSettings.owner_affiliations)
get_parent().print_debug_message("repositories setting '%s': %s"%["OWNER",toggled])

func _on_collaborator_check_pressed(toggled : bool):
if toggled:
if not ("COLLABORATOR" in PluginSettings.owner_affiliations):
PluginSettings.owner_affiliations.append("COLLABORATOR")
else:
if "COLLABORATOR" in PluginSettings.owner_affiliations:
PluginSettings.owner_affiliations.erase("COLLABORATOR")
PluginSettings.set_owner_affiliations(PluginSettings.owner_affiliations)
get_parent().print_debug_message("repositories setting '%s': %s"%["COLLABORATOR",toggled])

func _on_organization_member_check_pressed(toggled : bool):
if toggled:
if not "ORGANIZATION_MEMBER" in PluginSettings.owner_affiliations:
PluginSettings.owner_affiliations.append("ORGANIZATION_MEMBER")
else:
if "ORGANIZATION_MEMBER" in PluginSettings.owner_affiliations:
PluginSettings.owner_affiliations.erase("ORGANIZATION_MEMBER")
PluginSettings.set_owner_affiliations(PluginSettings.owner_affiliations)
get_parent().print_debug_message("repositories setting '%s': %s"%["ORGANIZATION_MEMBER",toggled])
7 changes: 7 additions & 0 deletions addons/github-integration/scripts/PluginSettings.gd
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ var auto_log : bool = false
var darkmode : bool = false
var auto_update_notifications : bool = true
var auto_update_timer : float = 300
var owner_affiliations : Array = ["OWNER","COLLABORATOR","ORGANIZATION_MEMBER"]

func _check_plugin_path():
var dir = Directory.new()
Expand All @@ -29,13 +30,15 @@ func _ready():
darkmode = config_file.get_value("settings","darkmode", darkmode)
auto_update_notifications = config_file.get_value("settings","auto_update_notifications", auto_update_notifications)
auto_update_timer = config_file.get_value("settings","auto_update_timer",auto_update_timer)
owner_affiliations = config_file.get_value("settings", "owner_affiliations", owner_affiliations)
else:
config_file.save(plugin_path+setting_file)
config_file.set_value("settings","debug",debug)
config_file.set_value("settings","auto_log",auto_log)
config_file.set_value("settings","darkmode",darkmode)
config_file.set_value("settings","auto_update_notifications", auto_update_notifications)
config_file.set_value("settings","auto_update_timer",auto_update_timer)
config_file.set_value("settings","owner_affiliations",owner_affiliations)
config_file.save(plugin_path+setting_file)

func set_debug(d : bool):
Expand All @@ -58,6 +61,10 @@ func set_auto_update_timer(timer : float):
auto_update_timer = timer
save_setting("auto_update_timer", timer)

func set_owner_affiliations(affiliations : Array):
owner_affiliations = affiliations
save_setting("owner_affiliations", owner_affiliations)

func save_setting(key : String, value):
_check_plugin_path()
var file : ConfigFile = ConfigFile.new()
Expand Down
Loading

0 comments on commit b37c854

Please sign in to comment.