Upload files to 'project_manager'

This commit is contained in:
Jeison Yehuda Amihud (Blender Dumbass) 2021-06-14 16:12:52 +00:00
parent 3af6403bcb
commit 1d6d3b96db
4 changed files with 63 additions and 12 deletions

View file

@ -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

View file

@ -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),

View file

@ -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'],

View file

@ -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 "):