Upload files to 'project_manager'

This commit is contained in:
Jeison Yehuda Amihud (Blender Dumbass) 2020-11-28 09:55:43 +00:00
parent 928576702f
commit eec743193c
3 changed files with 57 additions and 1 deletions

View file

@ -76,6 +76,7 @@ def run():
win.FPS = 0 win.FPS = 0
win.url = "project_manager" win.url = "project_manager"
win.update = {"versions":{}} win.update = {"versions":{}}
win.projects = {}

View file

@ -98,6 +98,12 @@ def layer(win):
http = urllib3.PoolManager() http = urllib3.PoolManager()
r = http.request('GET', url, preload_content=False) r = http.request('GET', url, preload_content=False)
try:
os.mkdir(filename[:filename.rfind("/")])
except:
pass
with open(filename, 'wb') as out: with open(filename, 'wb') as out:
while True: while True:
data = r.read(1024) data = r.read(1024)

View file

@ -16,6 +16,8 @@ from settings import settings
from settings import talk from settings import talk
from project_manager import pm_project from project_manager import pm_project
from studio import analytics
#UI modules #UI modules
from UI import UI_elements from UI import UI_elements
from UI import UI_color from UI import UI_color
@ -229,14 +231,32 @@ def project_node(layer, win, x, y, project):
node.select_font_face("Monospace", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL) node.select_font_face("Monospace", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL)
# Before we gonna do clip. Let's put here the logic of the node. # Before we gonna do clip. Let's put here the logic of the node.
def do(): def do():
print(project) print(project)
win.current["project"] = project win.current["project"] = project
Legacytip = "" Legacytip = ""
nameonly = project[project.rfind("/")+1:]
timefraction = 0.0
projectfraction = 0.0
if pm_project.is_legacy(project): if pm_project.is_legacy(project):
Legacytip = "\nLegacy (Blender-Organizer)" Legacytip = "\nLegacy (Blender-Organizer)"
# Getting info about the project. For now only Legacy. Since nothing is
# written for the new stuff.
if project not in win.projects:
win.projects[project] = analytics.get_legacy(project)
nameonly = win.projects[project]["name"]
timefraction = win.projects[project]["timepassed"]
projectfraction = win.projects[project]["fraction"]
node.set_line_width(10) node.set_line_width(10)
UI_elements.roundrect(node, win, UI_elements.roundrect(node, win,
x-5, x-5,
@ -327,7 +347,7 @@ def project_node(layer, win, x, y, project):
node.fill() node.fill()
# Name of the project # Name of the project
nameonly = project[project.rfind("/")+1:]
UI_color.set(node, win, "text_normal") UI_color.set(node, win, "text_normal")
node.set_font_size(20) node.set_font_size(20)
node.move_to(x+175-len(nameonly)*12/2,y+25) node.move_to(x+175-len(nameonly)*12/2,y+25)
@ -338,6 +358,35 @@ def project_node(layer, win, x, y, project):
node.rectangle(x,y+250,350,100) node.rectangle(x,y+250,350,100)
node.fill() node.fill()
# Finally the progress bar HELL YEAH. (I had to write 3 hard parsing
# algorythms only to read percentage from the project)
#Background
UI_color.set(node, win, "progress_background")
UI_elements.roundrect(node, win,
x+20,
y+280,
310,
10,
10)
#Time-passed
UI_color.set(node, win, "progress_time")
UI_elements.roundrect(node, win,
x+20,
y+280,
310*timefraction,
10,
10)
#Done
UI_color.set(node, win, "progress_active")
UI_elements.roundrect(node, win,
x+20,
y+280,
310*projectfraction,
10,
10)
# Drawing the Node on the main layer. # Drawing the Node on the main layer.
layer.set_source_surface(node_surface, 0,0) layer.set_source_surface(node_surface, 0,0)