diff --git a/project_manager/pm_gtk.py b/project_manager/pm_gtk.py index ec7da11..17b068d 100644 --- a/project_manager/pm_gtk.py +++ b/project_manager/pm_gtk.py @@ -51,7 +51,15 @@ def run(): # Setting up the window win = Gtk.Window() - win.maximize() + win.set_default_size(1200,720) + win.set_position(Gtk.WindowPosition.CENTER) + + # I used to do win.maximize() here. But people complained that the software is slow. + # so Instead I gonna keep it relativelly small when you open it. And slow only if you + # go full screen. + + # I might figure out how to make it faster with various resulutions. Not now. + win.connect("destroy", Gtk.main_quit) win.set_title("VCStudio : "+talk.text("project-manager")) win.set_default_icon_from_file("tinyicon.png") @@ -180,14 +188,20 @@ def pmdrawing(pmdrawing, main_layer, win): } win.current["cursor"] = win.cursors["arrow"] + # CHECKING FOR UPDATES + + # I don't want updates to be checking automatically if the user + # doesn't want to. I think by default they will be automatic. But + # you can definitely argue with me about it. - # Getting update info. I've added a bit of delay. So the starting of the - # Popen would not be noticed by the user as much. - #if win.current["frame"] > 50: - GLib.timeout_add(1 , update_reader.get_update_info, win) - #t2 = threading.Thread(target=update_reader.get_update_info, args=(win,)) - #t2.start() + if "check-for-updates" not in win.settings: + settings.write("check-for-updates", True) + win.settings["check-for-updates"] = True + if win.settings["check-for-updates"]: + GLib.timeout_add(1 , update_reader.get_update_info, win) + + # Current frame (for animations and things like this) win.current["frame"] += 1 diff --git a/project_manager/pm_settingsLayer.py b/project_manager/pm_settingsLayer.py index f8192db..1ebfe81 100644 --- a/project_manager/pm_settingsLayer.py +++ b/project_manager/pm_settingsLayer.py @@ -381,9 +381,9 @@ def layer(win): # AUTO DOWNLOAD IMAGES - blur_ok = "unchecked" + autod_ok = "unchecked" if win.settings["auto_download_images"]: - blur_ok = "checked" + autod_ok = "checked" def do(): win.settings["auto_download_images"] = not win.settings["auto_download_images"] @@ -396,7 +396,7 @@ def layer(win): 40, 10, button=do, - icon=blur_ok, + icon=autod_ok, tip=talk.text("auto_download_images")) UI_color.set(layer, win, "text_normal") @@ -405,6 +405,34 @@ def layer(win): current_Y + win.scroll["pm_settings"] + 135) layer.show_text(talk.text("auto_download_images")) + current_Y += 50 + + # AUTO CHECK FOR UPDATES + + autod_ok = "unchecked" + if win.settings["check-for-updates"]: + autod_ok = "checked" + + def do(): + win.settings["check-for-updates"] = not win.settings["check-for-updates"] + settings.write("check-for-updates", win.settings["check-for-updates"]) + + UI_elements.roundrect(layer, win, + win.current["w"]/2-240, + 110 + current_Y + win.scroll["pm_settings"], + 450, + 40, + 10, + button=do, + icon=autod_ok, + tip=talk.text("check-for-updates")) + + UI_color.set(layer, win, "text_normal") + layer.set_font_size(20) + layer.move_to(win.current["w"]/2-180, + current_Y + win.scroll["pm_settings"] + 135) + layer.show_text(talk.text("check-for-updates")) + UI_elements.scroll_area(layer, win, "pm_settings", int(win.current["w"]/2-250), diff --git a/project_manager/pm_updateLayer.py b/project_manager/pm_updateLayer.py index c0cad6c..281ebab 100644 --- a/project_manager/pm_updateLayer.py +++ b/project_manager/pm_updateLayer.py @@ -16,6 +16,7 @@ from settings import settings from settings import talk from settings import oscalls from project_manager import pm_project +from project_manager import update_reader #UI modules from UI import UI_elements @@ -23,6 +24,12 @@ from UI import UI_color def layer(win): + + # Sometimes the user didn't want the software to check for updates automatically. + # In this case we want to check for updates when he click on the update button. + + if not win.settings["check-for-updates"]: + GLib.timeout_add(1 , update_reader.get_update_info, win) # Making the layer surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, win.current['w'], diff --git a/project_manager/update_reader.py b/project_manager/update_reader.py index 618777b..7fa7958 100644 --- a/project_manager/update_reader.py +++ b/project_manager/update_reader.py @@ -52,10 +52,12 @@ def get_update_info(win): win.update["get_files"] = [] win.update["get_all_files"] = [] - elif "END" not in win.update: + while "END" not in win.update: + + # This going to read lines returned by the process on every frame. line = win.update["request"].stdout.readline()[:-1] - + if line: if line.startswith("VERSION "):