Skip to content

Commit

Permalink
Merge pull request #45 from fenix-hub/v0.8.7
Browse files Browse the repository at this point in the history
V0.8.7
  • Loading branch information
fenix-hub authored Jun 1, 2020
2 parents 463c81f + 62df832 commit 693014e
Show file tree
Hide file tree
Showing 16 changed files with 235 additions and 143 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![version](https://img.shields.io/badge/plugin%20version-0.8.4-blue)](https://github.com/fenix-hub/godot-engine.github-integration)
[![version](https://img.shields.io/badge/plugin%20version-0.8.7-blue)](https://github.com/fenix-hub/godot-engine.github-integration)
[![updates](https://img.shields.io/badge/plugin%20updates-on%20discord-purple)](https://discord.gg/JNrcucg)
[![paypal](https://img.shields.io/badge/donations-PayPal-cyan)](https://paypal.me/NSantilio?locale.x=it_IT)

Expand All @@ -11,7 +11,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: *0.8.4*
Version: *0.8.7*
Wiki: *[supported](https://github.com/fenix-hub/godot-engine.github-integration/wiki)*
Godot Version: *3.2stable*

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
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="0.8.4"
version="0.8.7"
script="scripts/github-integration.gd"
38 changes: 19 additions & 19 deletions addons/github-integration/resources/extraction/unzip.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import glob,zipfile,shutil,os,sys,tarfile

archive = sys.argv[1]
destination = sys.argv[2]

if archive.endswith('.zip'):
with zipfile.ZipFile(archive) as zip:
for zip_info in zip.infolist():
if zip_info.filename == zip.infolist()[0].filename :
continue
zip_info.filename = zip_info.filename.replace(zip.infolist()[0].filename,'')
zip_info.filename.replace(zip.infolist()[0].filename,'')
elif archive.endswith('.tar.gz'):
tar = tarfile.open(archive)
for member in tar.getmembers():
if member.name == tar.getmembers()[0].name:
continue
member.name = member.name.replace(tar.getmembers()[0].name+'/','')
tar.extract(member, destination)
import glob,zipfile,shutil,os,sys,tarfile

archive = sys.argv[1]
destination = sys.argv[2]

if archive.endswith('.zip'):
with zipfile.ZipFile(archive) as zip:
for zip_info in zip.infolist():
if zip_info.filename == zip.infolist()[0].filename :
continue
zip_info.filename = zip_info.filename.replace(zip.infolist()[0].filename,'')
zip_info.filename.replace(zip.infolist()[0].filename,'')
elif archive.endswith('.tar.gz'):
tar = tarfile.open(archive)
for member in tar.getmembers():
if member.name == tar.getmembers()[0].name:
continue
member.name = member.name.replace(tar.getmembers()[0].name+'/','')
tar.extract(member, destination)
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/invert_color=true
stream=false
size_limit=0
detect_3d=true
Expand Down
267 changes: 153 additions & 114 deletions addons/github-integration/scenes/GitHub.tscn

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions addons/github-integration/scripts/Commit.gd
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,8 @@ func request_blobs():
## for readable files
var f : File = File.new()
f.open(file,File.READ)
content = f.get_as_text()
encoding = "utf-8"
content = Marshalls.raw_to_base64(f.get_buffer(f.get_len()))
encoding = "base64"
f.close()


Expand Down
2 changes: 2 additions & 0 deletions addons/github-integration/scripts/Gist.gd
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ func on_commit():
requesting = REQUESTS.UP_GISTS
request.request("https://api.github.com/gists/"+gistid,UserData.header,false,HTTPClient.METHOD_PATCH,JSON.print(body))
get_parent().print_debug_message("updating this gist...")
get_parent().loading(true)
yield(self,"gist_updated")
get_parent().loading(false)
close_editor()

func _on_Readonly_toggled(button_pressed):
Expand Down
19 changes: 19 additions & 0 deletions addons/github-integration/scripts/GitHub.gd
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,22 @@ onready var Commit = $Commit
onready var LoadNode = $loading
onready var Version = $datas/version
onready var Debug = $datas/debug
onready var ConnectionIcon : TextureRect = $datas/connection

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

var plugin_version
var plugin_name
var debug : bool


func _ready():
ConnectionIcon.set_texture(connection_status[0])

debug = true
LoadNode.hide()
Debug.set_pressed(debug)
Expand All @@ -48,6 +57,16 @@ func _ready():
SignIn.connect("signed",self,"signed")
UserPanel.hide()
Commit.hide()

match RestHandler.check_connection():
true:
SignIn.btnSignIn.set_disabled(false)
ConnectionIcon.set_texture(connection_status[2])
ConnectionIcon.set_tooltip("Connected to GitHub API")
false:
SignIn.btnSignIn.set_disabled(true)
ConnectionIcon.set_texture(connection_status[1])
ConnectionIcon.set_tooltip("Can't connect to GitHub API, check your internet connection or API status")

func loading(value : bool) -> void:
LoadNode.visible = value
Expand Down
3 changes: 1 addition & 2 deletions addons/github-integration/scripts/Repo.gd
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,11 @@ func open_repo(repo : TreeItem):
description_.text = ""
default_branch_.text = str(r.default_branch)

watch_value.set_text(str(r.watchers_count))
# watch_value.set_text(str(r.subscribers_count))
star_value.set_text(str(r.stargazers_count))
fork_value.set_text(str(r.forks_count))

load_icons(r)

request_branches(r.name)


Expand Down
27 changes: 27 additions & 0 deletions addons/github-integration/scripts/RestHandler.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
tool
extends Node


var Client : HTTPClient = HTTPClient.new()

# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.

func check_connection() -> bool:
var connection : int = Client.connect_to_host("www.githubstatus.com")
assert(connection == OK) # Make sure connection was OK.

# Wait until resolved and connected.
print("[GitHub Integration] Connecting to API, please wait...")
while Client.get_status() == HTTPClient.STATUS_CONNECTING or Client.get_status() == HTTPClient.STATUS_RESOLVING:
Client.poll()
OS.delay_msec(500)

if Client.get_status() == HTTPClient.STATUS_CONNECTED:
print("[GitHub Integration] Connection to API successful")
return true
else:
printerr("[GitHub Integration] Connection to API unsuccessful, exited with error %s, staus: %s" %
[Client.get_response_code(), Client.get_status()])
return false
3 changes: 3 additions & 0 deletions addons/github-integration/scripts/SignIn.gd
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ var user_data

var logfile = false

onready var Client : HTTPClient = HTTPClient.new()

func _ready():
btnSignIn.set_disabled(true)

logfile_icon.hide()
Error.hide()
btnSignIn.connect("pressed",self,"sign_in")
Expand Down
4 changes: 2 additions & 2 deletions addons/github-integration/scripts/UserPanel.gd
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ func load_repositories(rep : Array) -> void:
repo.set_text(0,str(r.name))

repo.set_icon(1,IconLoaderGithub.load_icon_from_name("stars"))
repo.set_text(2,"Forked "+str(r.stargazers_count))
repo.set_text(2,"Forked "+str(r.forks_count))
repo.set_icon(2,IconLoaderGithub.load_icon_from_name("forks"))
repo.set_text(1,"Stars "+str(r.forks_count))
repo.set_text(1,"Stars "+str(r.stargazers_count))

repo.set_metadata(0,r)

Expand Down
3 changes: 3 additions & 0 deletions addons/github-integration/scripts/github-integration.gd
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ extends EditorPlugin
var doc
var IconLoaderGithub = preload("res://addons/github-integration/scripts/IconLoaderGithub.gd").new()
var UserData = preload("res://addons/github-integration/scripts/user_data.gd").new()
var RestHandler = preload("res://addons/github-integration/scripts/RestHandler.gd").new()
var GitHubDoc

func _enter_tree():
self.add_autoload_singleton("UserData","res://addons/github-integration/scripts/user_data.gd")
self.add_autoload_singleton("IconLoaderGithub","res://addons/github-integration/scripts/IconLoaderGithub.gd")
self.add_autoload_singleton("RestHandler","res://addons/github-integration/scripts/RestHandler.gd")
doc = load("res://addons/github-integration/scenes/GitHub.tscn")
GitHubDoc = doc.instance()
get_editor_interface().get_editor_viewport().add_child(GitHubDoc)
Expand All @@ -30,6 +32,7 @@ func _enter_tree():
func _exit_tree():
self.remove_autoload_singleton("UserData")
self.remove_autoload_singleton("IconLoaderGithub")
self.remove_autoload_singleton("RestHandler")
get_editor_interface().get_editor_viewport().remove_child(GitHubDoc)
GitHubDoc.queue_free()

Expand Down

0 comments on commit 693014e

Please sign in to comment.