Skip to content

Commit

Permalink
Merge pull request #86 from fenix-hub/dev
Browse files Browse the repository at this point in the history
update v1.4.1
  • Loading branch information
fenix-hub committed Jan 27, 2021
2 parents e2e4406 + e919a91 commit cc67a04
Show file tree
Hide file tree
Showing 10 changed files with 1,228 additions and 1,221 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ 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.4.0*
Wiki: *[supported](https://github.com/fenix-hub/godot-engine.github-integration/wiki)*
Version: *1.4.1*
Godot Version: *3.2.3stable*
Wiki: *[supported](https://github.com/fenix-hub/godot-engine.github-integration/wiki)*

<img align="center" src="addons/github-integration/screenshots/banner.png">

Expand Down
2 changes: 1 addition & 1 deletion addons/github-integration/plugin.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
name="GitHub integration"
description="Plugin to integrate GitHub requests directly via Godot Engine Editor"
author="Nicolo (fenix) Santilio"
version="1.4.0"
version="1.4.1"
script="scripts/github-integration.gd"
1 change: 0 additions & 1 deletion addons/github-integration/scenes/Commit.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ margin_bottom = 238.0
window_title = "Open File(s)"
resizable = true
mode = 1
show_hidden_files = true
__meta__ = {
"_edit_use_anchors_": false
}
Expand Down
1 change: 1 addition & 0 deletions addons/github-integration/scenes/Repo.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,7 @@ __meta__ = {
}
[connection signal="item_selected" from="Repository/RepositoryInfo/RepositoryContent/BranchInfo/branch/branch2" to="." method="_on_branch2_item_selected"]
[connection signal="item_activated" from="Repository/RepositoryInfo/RepositoryContent/contents" to="." method="_on_contents_item_activated"]
[connection signal="item_selected" from="Repository/RepositoryInfo/RepositoryContent/contents" to="." method="_on_contents_item_selected"]
[connection signal="multi_selected" from="Repository/RepositoryInfo/RepositoryContent/contents" to="." method="_on_contents_multi_selected"]
[connection signal="pressed" from="Repository/repos_buttons/HBoxContainer/reload" to="." method="_on_reload_pressed"]
[connection signal="pressed" from="extraction_request/VBoxContainer/buttons/python" to="." method="_on_python_pressed"]
Expand Down
796 changes: 397 additions & 399 deletions addons/github-integration/scripts/Commit.gd

Large diffs are not rendered by default.

226 changes: 113 additions & 113 deletions addons/github-integration/scripts/GitHub.gd
Original file line number Diff line number Diff line change
Expand Up @@ -30,169 +30,169 @@ var user_avatar : ImageTexture = ImageTexture.new()
var user_img = Image.new()

var connection_status : Array = [
IconLoaderGithub.load_icon_from_name("searchconnection"),
IconLoaderGithub.load_icon_from_name("noconnection"),
IconLoaderGithub.load_icon_from_name("connection")
IconLoaderGithub.load_icon_from_name("searchconnection"),
IconLoaderGithub.load_icon_from_name("noconnection"),
IconLoaderGithub.load_icon_from_name("connection")
]

var plugin_version : String
var plugin_name : String

# Load the configuration file for this plugin to fetch some info
func load_config() -> void:
var config = ConfigFile.new()
var err = config.load("res://addons/github-integration/plugin.cfg")
if err == OK:
plugin_version = config.get_value("plugin","version")
plugin_name = "[%s] >> " % config.get_value("plugin","name")
var config = ConfigFile.new()
var err = config.load("res://addons/github-integration/plugin.cfg")
if err == OK:
plugin_version = config.get_value("plugin","version")
plugin_name = "[%s] >> " % config.get_value("plugin","name")

func connect_signals() -> void:
Menu.connect("index_pressed", self, "menu_item_pressed")
RestartConnection.connect("pressed",self,"check_connection")
VersionCheck.connect("request_completed",self,"_on_version_check")
SignIn.connect("signed",self,"signed")
UserPanel.connect("completed_loading", SignIn, "_on_completed_loading")
UserPanel.connect("loaded_gists", Gist, "_on_loaded_repositories")
Header.connect("load_invitations", Notifications, "_on_load_invitations_list")
Header.notifications_btn.connect("pressed", Notifications, "_open_notifications")
Notifications.connect("add_notifications", Header, "_on_add_notifications")
Menu.connect("index_pressed", self, "menu_item_pressed")
RestartConnection.connect("pressed",self,"check_connection")
VersionCheck.connect("request_completed",self,"_on_version_check")
SignIn.connect("signed",self,"signed")
UserPanel.connect("completed_loading", SignIn, "_on_completed_loading")
UserPanel.connect("loaded_gists", Gist, "_on_loaded_repositories")
Header.connect("load_invitations", Notifications, "_on_load_invitations_list")
Header.notifications_btn.connect("pressed", Notifications, "_open_notifications")
Notifications.connect("add_notifications", Header, "_on_add_notifications")

func hide_nodes() -> void:
Repo.hide()
SignIn.show()
UserPanel.hide()
Commit.hide()
LoadNode.hide()
Repo.hide()
SignIn.show()
UserPanel.hide()
Commit.hide()
LoadNode.hide()

func _ready():
connect_signals()
hide_nodes()
# Load Config file
load_config()
Version.text = "v "+plugin_version
ConnectionIcon.set_texture(connection_status[0])
ConnectionIcon.use_parent_material = false
ConnectionIcon.material.set("shader_param/speed", 3)
# Check the connection with the API
RestHandler.check_connection()
# Yield until the "_check_connection" function returns a value
var connection = yield(RestHandler, "_check_connection")
match connection:
true:
ConnectionIcon.set_texture(connection_status[2])
ConnectionIcon.set_tooltip("Connected to GitHub API")
RestartConnection.hide()
false:
ConnectionIcon.set_texture(connection_status[1])
ConnectionIcon.set_tooltip("Can't connect to GitHub API, check your internet connection or API status")
RestartConnection.show()
ConnectionIcon.use_parent_material = true
ConnectionIcon.material.set("shader_param/speed", 0)
Menu.set_item_checked(0, PluginSettings.debug)
Menu.set_item_checked(1, PluginSettings.auto_log)
# Check the plugin verison
VersionCheck.request("https://api.github.com/repos/fenix-hub/godot-engine.github-integration/tags",[],false,HTTPClient.METHOD_GET,"")
if PluginSettings.auto_log:
SignIn.sign_in()
set_darkmode(PluginSettings.darkmode)
connect_signals()
hide_nodes()
# Load Config file
load_config()
Version.text = "v "+plugin_version
ConnectionIcon.set_texture(connection_status[0])
ConnectionIcon.use_parent_material = false
ConnectionIcon.material.set("shader_param/speed", 3)
# Check the connection with the API
RestHandler.check_connection()
# Yield until the "_check_connection" function returns a value
var connection = yield(RestHandler, "_check_connection")
match connection:
true:
ConnectionIcon.set_texture(connection_status[2])
ConnectionIcon.set_tooltip("Connected to GitHub API")
RestartConnection.hide()
false:
ConnectionIcon.set_texture(connection_status[1])
ConnectionIcon.set_tooltip("Can't connect to GitHub API, check your internet connection or API status")
RestartConnection.show()
ConnectionIcon.use_parent_material = true
ConnectionIcon.material.set("shader_param/speed", 0)
Menu.set_item_checked(0, PluginSettings.debug)
Menu.set_item_checked(1, PluginSettings.auto_log)
# Check the plugin verison
VersionCheck.request("https://api.github.com/repos/fenix-hub/godot-engine.github-integration/tags",[],false,HTTPClient.METHOD_GET,"")
if PluginSettings.auto_log:
SignIn.sign_in()
set_darkmode(PluginSettings.darkmode)

# Show or hide the loading screen
func loading(value : bool) -> void:
LoadNode.visible = value
LoadNode.visible = value

# Show the loading process, giving the current value and a maximum value
func show_loading_progress(value : float, max_value : float) -> void:
LoadNode.show_progress(value,max_value)
LoadNode.show_progress(value,max_value)

func hide_loading_progress():
LoadNode.hide_progress()
LoadNode.hide_progress()

func show_number(value : float, type : String) -> void:
LoadNode.show_number(value,type)
LoadNode.show_number(value,type)

func hide_number() -> void:
LoadNode.hide_number()
LoadNode.hide_number()

# If User Signed
func signed() -> void:
UserPanel.load_panel()
set_avatar(UserData.AVATAR)
set_username(UserData.USER.login)
yield(UserPanel, "completed_loading")
Notifications.request_notifications()
UserPanel.load_panel()
set_avatar(UserData.AVATAR)
set_username(UserData.USER.login)
yield(UserPanel, "completed_loading")
Notifications.request_notifications()

# Print a debug message if the debug setting is set to "true", with a debug type from 0 to 2
func print_debug_message(message : String = "", type : int = 0) -> void:
if PluginSettings.debug == true:
match type:
0:
print(plugin_name,message)
1:
printerr(plugin_name,message)
2:
push_warning(plugin_name+message)
if type != 1: set_loading_message(message)
if PluginSettings.debug == true:
match type:
0:
print(plugin_name,message)
1:
printerr(plugin_name,message)
2:
push_warning(plugin_name+message)
if type != 1: set_loading_message(message)

func set_loading_message(message : String):
LoadNode.message.set_text(message)
LoadNode.message.set_text(message)

# Control logic for each item in the plugin menu
func menu_item_pressed(id : int) -> void:
match id:
match id:
# 0:
# _on_debug_toggled(!Menu.is_item_checked(id))
# 1:
# _on_autologin_toggled(!Menu.is_item_checked(id))
0:
OS.shell_open("https://github.com/fenix-hub/godot-engine.github-integration/wiki")
1:
logout()
2:
set_darkmode(!Menu.is_item_checked(id))
0:
OS.shell_open("https://github.com/fenix-hub/godot-engine.github-integration/wiki")
1:
logout()
2:
set_darkmode(!Menu.is_item_checked(id))

# Logout function
func logout():
set_avatar(IconLoaderGithub.load_icon_from_name("circle"))
set_username("user")
SignIn.show()
UserPanel._clear()
UserPanel.hide()
Repo.hide()
Commit.hide()
Gist.hide()
Notifications._clear()
Notifications.hide()
SignIn.Mail.text = ""
SignIn.Token.text = ""
UserData.logout_user()
set_avatar(IconLoaderGithub.load_icon_from_name("circle"))
set_username("user")
SignIn.show()
UserPanel._clear()
UserPanel.hide()
Repo.hide()
Commit.hide()
Gist.hide()
Notifications._clear()
Notifications.hide()
SignIn.Mail.text = ""
SignIn.Token.text = ""
UserData.logout_user()

# Set to darkmode each single Control
func set_darkmode(darkmode : bool) -> void:
PluginSettings.set_darkmode(darkmode)
SignIn.set_darkmode(darkmode)
UserPanel.set_darkmode(darkmode)
Repo.set_darkmode(darkmode)
Commit.set_darkmode(darkmode)
Gist.set_darkmode(darkmode)
Header.set_darkmode(darkmode)
Notifications.set_darkmode(darkmode)
PluginSettings.set_darkmode(darkmode)
SignIn.set_darkmode(darkmode)
UserPanel.set_darkmode(darkmode)
Repo.set_darkmode(darkmode)
Commit.set_darkmode(darkmode)
Gist.set_darkmode(darkmode)
Header.set_darkmode(darkmode)
Notifications.set_darkmode(darkmode)

func set_avatar(avatar : ImageTexture) -> void:
$Header/datas/avatar.texture = avatar
$Header/datas/avatar.texture = avatar

func set_username(username : String) -> void:
$Header/datas/user.text = username
$Header/datas/user.text = username

# If the plugin version has been checked
func _on_version_check(result, response_code, headers, body ) -> void:
if result == 0:
if response_code == 200:
var tags : Array = JSON.parse(body.get_string_from_utf8()).result
var first_tag : Dictionary = tags[0] as Dictionary
if first_tag.name != ("v"+plugin_version):
print_debug_message("a new plugin version has been found, current version is %s and new version is %s" % [("v"+plugin_version), first_tag.name],1)
if result == 0:
if response_code == 200:
var tags : Array = JSON.parse(body.get_string_from_utf8()).result
var first_tag : Dictionary = tags[0] as Dictionary
if first_tag.name != ("v"+plugin_version):
print_debug_message("a new plugin version has been found, current version is %s and new version is %s" % [("v"+plugin_version), first_tag.name],1)
Loading

0 comments on commit cc67a04

Please sign in to comment.