From 431e985825f053d54aef54c714aa5393e4241ff3 Mon Sep 17 00:00:00 2001 From: "Jeison Yehuda Amihud (Blender Dumbass)" Date: Wed, 3 Mar 2021 14:53:06 +0000 Subject: [PATCH] Implementing Markdown There is a few changes in the UI of the PM and the new setting in the PM Settings. I will implement it in the Studio settings too as soon as the documentation will be ready. --- project_manager/pm_gtk.py | 27 +++++++++++++++++ project_manager/pm_mainLayer.py | 23 +++++++++++++-- project_manager/pm_settingsLayer.py | 46 +++++++++++++++++++++++++++-- project_manager/pm_updateLayer.py | 24 +++++++-------- 4 files changed, 102 insertions(+), 18 deletions(-) diff --git a/project_manager/pm_gtk.py b/project_manager/pm_gtk.py index 54eb10a..90b6806 100644 --- a/project_manager/pm_gtk.py +++ b/project_manager/pm_gtk.py @@ -104,6 +104,8 @@ def run(): win.current["scroll"] = [0,0] win.current["project"] = "" + win.current["calls"] = {} # Calls. See sutdio/studio_dialogs.py + previous(win) # Version of the software @@ -214,6 +216,31 @@ def pmdrawing(pmdrawing, main_layer, win): Layers = [] Layers.append([pm_mainLayer.layer(win),"project_manager"]) + + # Call layers. See studio/studio_dialogs.py for explanation. It's wild. + + win.calllayer = False + remlater = [] + + for call in list(win.current["calls"].keys()): + + if win.current["calls"][call]["var"] == None: + Layers.append([win.current["calls"][call]["draw"](win, call)]) + win.url = win.current["calls"][call]["url"] + win.calllayer = True + + else: + win.url = win.current["calls"][call]["back"] + win.current["calls"][call]["call"](win, win.current["calls"][call]["var"]) + win.textactive = "" + remlater.append(call) + + for call in remlater: + + del win.current["calls"][call] + + + if win.url == "new_project": Layers.append([pm_newprojectLayer.layer(win), "new_project"]) elif win.url == "scan_projects": diff --git a/project_manager/pm_mainLayer.py b/project_manager/pm_mainLayer.py index 19f08b0..7622493 100644 --- a/project_manager/pm_mainLayer.py +++ b/project_manager/pm_mainLayer.py @@ -19,6 +19,7 @@ from project_manager import pm_project from studio import analytics from studio import story from studio import studio_gtk +from studio import studio_dialogs #UI modules from UI import UI_elements @@ -128,7 +129,21 @@ def layer(win): # Internet things def do(): - win.url = "help_layer" + + # I used to have a specific UI instance for the help layer here. But + # it proved to be too hard to maintain. So I'm changing it to a different + # dialog. I'm not going to delete the help layer it self. For curious + # poeple. + + # win.url = "help_layer" + + # The following commands are the replacement. So if you want to see how + # it used to look. Comment those. So not to launch both in the same time. + + def after(win, var): + pass + + studio_dialogs.help(win, "help", after, SEARCH=talk.text("readme")) UI_elements.roundrect(layer, win, 5, @@ -364,8 +379,10 @@ def project_node(layer, win, x, y, project): fill=False) node.clip() - - if os.path.exists(project+"/py_data/banner.png"): + if os.path.exists(project+"/set/banner.png"): + UI_elements.image(node, win, project+"/set/banner.png", + x,y,350,320) + elif os.path.exists(project+"/py_data/banner.png"): UI_elements.image(node, win, project+"/py_data/banner.png", x,y,350,320) else: diff --git a/project_manager/pm_settingsLayer.py b/project_manager/pm_settingsLayer.py index e825de2..f8192db 100644 --- a/project_manager/pm_settingsLayer.py +++ b/project_manager/pm_settingsLayer.py @@ -1,5 +1,20 @@ -# THIS FILE IS A PART OF VCStudio -# PYTHON 3 +#################################### +# # +# COPYRIGHT NOTICE # +# # +# This file is a part of Victori- # +# ous Children Studio Organizer. # +# Or simply VCStudio. Copyright # +# of J.Y.Amihud. But don't be sad # +# because I released the entire # +# project under a GNU GPL license. # +# You may use Version 3 or later. # +# See www.gnu.org/licenses if your # +# copy has no License file. Please # +# note. Ones I used the GPL v2 for # +# it. It's no longer the case. # +# # +#################################### import os @@ -363,6 +378,33 @@ def layer(win): current_Y += 50 + + # AUTO DOWNLOAD IMAGES + + blur_ok = "unchecked" + if win.settings["auto_download_images"]: + blur_ok = "checked" + + def do(): + win.settings["auto_download_images"] = not win.settings["auto_download_images"] + settings.write("auto_download_images", win.settings["auto_download_images"]) + + UI_elements.roundrect(layer, win, + win.current["w"]/2-240, + 110 + current_Y + win.scroll["pm_settings"], + 450, + 40, + 10, + button=do, + icon=blur_ok, + tip=talk.text("auto_download_images")) + + 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("auto_download_images")) + 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 e162f88..c0cad6c 100644 --- a/project_manager/pm_updateLayer.py +++ b/project_manager/pm_updateLayer.py @@ -29,9 +29,6 @@ def layer(win): win.current['h']) layer = cairo.Context(surface) - print("NEW FILES:", win.update["get_files"]) - print("ALL FILES:", win.update["get_all_files"]) - #text setting layer.select_font_face("Monospace", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL) @@ -236,15 +233,9 @@ def layer(win): layer.line_to(win.current["w"]/2-227, 152 + current_Y + win.scroll["pm_update"]) layer.stroke() - UI_color.set(layer, win, "text_normal") - layer.set_font_size(15) - layer.move_to(win.current["w"]/2-210, - current_Y + win.scroll["pm_update"] + 140) - layer.show_text(str(filename)) - + gitlink = "https://notabug.org/jyamihud/VCStudio/commits/master/" def do(): - gitlink = "https://notabug.org/jyamihud/VCStudio/commits/master/" oscalls.Open(gitlink+filename) UI_elements.roundrect(layer, win, @@ -254,11 +245,18 @@ def layer(win): 40, 10, button=do, - tip=talk.text("update_see_history"), - fill=False, + tip=talk.text("update_see_history")+"\n"+gitlink+filename, + icon="notabug", clip=clip) layer.stroke() - + + UI_color.set(layer, win, "text_normal") + layer.set_font_size(15) + layer.move_to(win.current["w"]/2-170, + current_Y + win.scroll["pm_update"] + 140) + layer.show_text(str(filename)) + + current_Y = current_Y + 50 UI_elements.scroll_area(layer, win, "pm_update",