Refactored the UI for remote downloader window.
This commit is contained in:
parent
89e5d35768
commit
81a8068c41
5 changed files with 195 additions and 120 deletions
|
@ -23,6 +23,7 @@ import cairo
|
||||||
|
|
||||||
# Own modules
|
# Own modules
|
||||||
from settings import settings
|
from settings import settings
|
||||||
|
from settings import fileformats
|
||||||
from settings import talk
|
from settings import talk
|
||||||
from project_manager import pm_project
|
from project_manager import pm_project
|
||||||
|
|
||||||
|
@ -117,7 +118,7 @@ def down(win, website, filename, fsize=100000):
|
||||||
savef.write(unz)
|
savef.write(unz)
|
||||||
savef.close()
|
savef.close()
|
||||||
|
|
||||||
def download_missing_changed(win, cur):
|
def download_missing_changed(win, cur, call):
|
||||||
|
|
||||||
# This function downloads files from remote server using the
|
# This function downloads files from remote server using the
|
||||||
# remote-folder-data data.
|
# remote-folder-data data.
|
||||||
|
@ -140,6 +141,7 @@ def download_missing_changed(win, cur):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
win.current["remote-folder-data"][cur]["downloading"] = False
|
win.current["remote-folder-data"][cur]["downloading"] = False
|
||||||
|
win.current["calls"][call]["var"] = False
|
||||||
|
|
||||||
def get_folder_info(win, folders, cur):
|
def get_folder_info(win, folders, cur):
|
||||||
|
|
||||||
|
@ -599,7 +601,7 @@ def prompt_layer(win, call):
|
||||||
win.current["remote-folder-data"][cur]["downloading"] = True
|
win.current["remote-folder-data"][cur]["downloading"] = True
|
||||||
|
|
||||||
start_downaloding = threading.Thread(target=download_missing_changed,
|
start_downaloding = threading.Thread(target=download_missing_changed,
|
||||||
args=(win, cur, ))
|
args=(win, cur, call, ))
|
||||||
start_downaloding.setDaemon(True)
|
start_downaloding.setDaemon(True)
|
||||||
start_downaloding.start()
|
start_downaloding.start()
|
||||||
|
|
||||||
|
@ -647,21 +649,137 @@ def prompt_layer(win, call):
|
||||||
win.current["h"]-145)
|
win.current["h"]-145)
|
||||||
layer.show_text(win.current["http-server"]["message"])
|
layer.show_text(win.current["http-server"]["message"])
|
||||||
|
|
||||||
|
|
||||||
|
# Top Tabs
|
||||||
|
|
||||||
|
if "active_tab" not in win.current["remote-folder-data"][cur]:
|
||||||
|
win.current["remote-folder-data"][cur]["active_tab"] = "changed"
|
||||||
|
|
||||||
|
# Missing
|
||||||
|
def do():
|
||||||
|
win.current["remote-folder-data"][cur]["active_tab"] = "missing"
|
||||||
|
|
||||||
|
if win.current["remote-folder-data"][cur]["active_tab"] == "missing":
|
||||||
|
UI_color.set(layer, win, "progress_time")
|
||||||
|
UI_elements.roundrect(layer, win,
|
||||||
|
win.current["w"]/2-340,
|
||||||
|
110,
|
||||||
|
330,
|
||||||
|
40,
|
||||||
|
10)
|
||||||
|
|
||||||
|
UI_elements.roundrect(layer, win,
|
||||||
|
win.current["w"]/2-340,
|
||||||
|
110,
|
||||||
|
330,
|
||||||
|
40,
|
||||||
|
10,
|
||||||
|
button=do,
|
||||||
|
icon="new_file",
|
||||||
|
tip=talk.text("MissingFiles"))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
UI_color.set(layer, win, "text_normal")
|
||||||
|
layer.set_font_size(20)
|
||||||
|
layer.move_to(win.current["w"]/2-290,
|
||||||
|
135)
|
||||||
|
layer.show_text(str(len(win.current["remote-folder-data"][cur]["missing"]))+" "+talk.text("MissingFiles"))
|
||||||
|
|
||||||
|
# Changed
|
||||||
|
def do():
|
||||||
|
win.current["remote-folder-data"][cur]["active_tab"] = "changed"
|
||||||
|
|
||||||
|
if win.current["remote-folder-data"][cur]["active_tab"] == "changed":
|
||||||
|
UI_color.set(layer, win, "progress_time")
|
||||||
|
UI_elements.roundrect(layer, win,
|
||||||
|
win.current["w"]/2+10,
|
||||||
|
110,
|
||||||
|
330,
|
||||||
|
40,
|
||||||
|
10)
|
||||||
|
|
||||||
|
UI_elements.roundrect(layer, win,
|
||||||
|
win.current["w"]/2+10,
|
||||||
|
110,
|
||||||
|
330,
|
||||||
|
40,
|
||||||
|
10,
|
||||||
|
button=do,
|
||||||
|
icon="configure_file",
|
||||||
|
tip=talk.text("ChangedFiles"))
|
||||||
|
|
||||||
|
UI_color.set(layer, win, "text_normal")
|
||||||
|
layer.set_font_size(20)
|
||||||
|
layer.move_to(win.current["w"]/2+60,
|
||||||
|
135)
|
||||||
|
layer.show_text(str(len(win.current["remote-folder-data"][cur]["changed"]))+" "+talk.text("ChangedFiles"))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Search
|
||||||
|
|
||||||
|
UI_elements.image(layer, win, "settings/themes/"\
|
||||||
|
+win.settings["Theme"]+"/icons/search.png",
|
||||||
|
win.current["w"]/2,
|
||||||
|
160,
|
||||||
|
40,
|
||||||
|
40)
|
||||||
|
|
||||||
|
UI_elements.text(layer, win, "http_client_search",
|
||||||
|
win.current["w"]/2+50,
|
||||||
|
160,
|
||||||
|
250,
|
||||||
|
40)
|
||||||
|
|
||||||
|
|
||||||
|
# Toggle Visible
|
||||||
|
|
||||||
|
if "toggle_visible" not in win.current["remote-folder-data"][cur]:
|
||||||
|
win.current["remote-folder-data"][cur]["toggle_visible"] = True
|
||||||
|
|
||||||
|
toggle = {"do":None}
|
||||||
|
|
||||||
|
def do():
|
||||||
|
win.current["remote-folder-data"][cur]["toggle_visible"] = not win.current["remote-folder-data"][cur]["toggle_visible"]
|
||||||
|
toggle["do"] = win.current["remote-folder-data"][cur]["toggle_visible"]
|
||||||
|
|
||||||
|
icon = "unchecked"
|
||||||
|
if win.current["remote-folder-data"][cur]["toggle_visible"]:
|
||||||
|
icon = "checked"
|
||||||
|
|
||||||
|
UI_elements.roundrect(layer, win,
|
||||||
|
win.current["w"]/2-340,
|
||||||
|
160,
|
||||||
|
330,
|
||||||
|
40,
|
||||||
|
10,
|
||||||
|
button=do,
|
||||||
|
icon=icon,
|
||||||
|
tip=talk.text("ToggleVisible"))
|
||||||
|
|
||||||
|
UI_color.set(layer, win, "text_normal")
|
||||||
|
layer.set_font_size(20)
|
||||||
|
layer.move_to(win.current["w"]/2-290,
|
||||||
|
185)
|
||||||
|
layer.show_text(talk.text("ToggleVisible"))
|
||||||
|
|
||||||
# Clipping everything
|
# Clipping everything
|
||||||
UI_elements.roundrect(layer, win,
|
UI_elements.roundrect(layer, win,
|
||||||
win.current["w"]/2-350,
|
win.current["w"]/2-350,
|
||||||
100,
|
200,
|
||||||
700,
|
700,
|
||||||
win.current["h"]-260,
|
win.current["h"]-360,
|
||||||
10,
|
10,
|
||||||
fill=False)
|
fill=False)
|
||||||
layer.clip()
|
layer.clip()
|
||||||
|
|
||||||
clip = [
|
clip = [
|
||||||
win.current["w"]/2-350,
|
win.current["w"]/2-350,
|
||||||
100,
|
200,
|
||||||
700,
|
700,
|
||||||
win.current["h"]-260]
|
win.current["h"]-360]
|
||||||
|
|
||||||
# Setting up the scroll
|
# Setting up the scroll
|
||||||
if "http-prompt" not in win.scroll:
|
if "http-prompt" not in win.scroll:
|
||||||
|
@ -669,108 +787,57 @@ def prompt_layer(win, call):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
current_Y = 0
|
current_Y = 100
|
||||||
|
|
||||||
# Missing files
|
# Display list
|
||||||
|
DisplayList = {}
|
||||||
|
ActiveTab = win.current["remote-folder-data"][cur]["active_tab"]
|
||||||
|
DisplayList = win.current["remote-folder-data"][cur][ActiveTab]
|
||||||
|
|
||||||
if "missing_active" not in win.current["remote-folder-data"][cur]:
|
|
||||||
win.current["remote-folder-data"][cur]["missing_active"] = False
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
icon = "closed"
|
|
||||||
if win.current["remote-folder-data"][cur]["missing_active"]:
|
|
||||||
icon = "open"
|
|
||||||
|
|
||||||
def do():
|
|
||||||
win.current["remote-folder-data"][cur]["missing_active"] = not win.current["remote-folder-data"][cur]["missing_active"]
|
|
||||||
|
|
||||||
|
|
||||||
UI_elements.roundrect(layer, win,
|
|
||||||
win.current["w"]/2-340,
|
|
||||||
110 + current_Y + win.scroll["http-prompt"],
|
|
||||||
680,
|
|
||||||
40,
|
|
||||||
10,
|
|
||||||
button=do,
|
|
||||||
icon=icon,
|
|
||||||
tip=talk.text("MissingFiles"))
|
|
||||||
|
|
||||||
UI_color.set(layer, win, "text_normal")
|
|
||||||
layer.set_font_size(20)
|
|
||||||
layer.move_to(win.current["w"]/2-290,
|
|
||||||
current_Y + win.scroll["http-prompt"] + 135)
|
|
||||||
layer.show_text(talk.text("MissingFiles")+" ( "+str(len(win.current["remote-folder-data"][cur]["missing"]))+" ) ")
|
|
||||||
|
|
||||||
current_Y += 50
|
|
||||||
|
|
||||||
if win.current["remote-folder-data"][cur]["missing_active"]:
|
|
||||||
try:
|
try:
|
||||||
for f in win.current["remote-folder-data"][cur]["missing"]:
|
for f in DisplayList:
|
||||||
|
|
||||||
fdata = win.current["remote-folder-data"][cur]["missing"][f]
|
fdata = DisplayList[f]
|
||||||
|
|
||||||
if fdata.get("finished"):
|
if fdata.get("finished"):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
UI_color.set(layer, win, "text_normal")
|
found = True
|
||||||
layer.set_font_size(20)
|
if win.text["http_client_search"]["text"]:
|
||||||
layer.move_to(win.current["w"]/2-270,
|
for word in win.text["http_client_search"]["text"].split(" "):
|
||||||
current_Y + win.scroll["http-prompt"] + 135)
|
if word.lower() not in f.lower():
|
||||||
layer.show_text(f)
|
found = False
|
||||||
|
|
||||||
current_Y += 50
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# Updated files
|
|
||||||
|
|
||||||
if "changed_active" not in win.current["remote-folder-data"][cur]:
|
|
||||||
win.current["remote-folder-data"][cur]["changed_active"] = True
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
icon = "closed"
|
|
||||||
if win.current["remote-folder-data"][cur]["changed_active"]:
|
|
||||||
icon = "open"
|
|
||||||
|
|
||||||
def do():
|
|
||||||
win.current["remote-folder-data"][cur]["changed_active"] = not win.current["remote-folder-data"][cur]["changed_active"]
|
|
||||||
|
|
||||||
|
|
||||||
UI_elements.roundrect(layer, win,
|
|
||||||
win.current["w"]/2-340,
|
|
||||||
110 + current_Y + win.scroll["http-prompt"],
|
|
||||||
680,
|
|
||||||
40,
|
|
||||||
10,
|
|
||||||
button=do,
|
|
||||||
icon=icon,
|
|
||||||
tip=talk.text("ChangedFiles"))
|
|
||||||
|
|
||||||
UI_color.set(layer, win, "text_normal")
|
|
||||||
layer.set_font_size(20)
|
|
||||||
layer.move_to(win.current["w"]/2-290,
|
|
||||||
current_Y + win.scroll["http-prompt"] + 135)
|
|
||||||
layer.show_text(talk.text("ChangedFiles")+" ( "+str(len(win.current["remote-folder-data"][cur]["changed"]))+" ) ")
|
|
||||||
|
|
||||||
current_Y += 50
|
|
||||||
|
|
||||||
if win.current["remote-folder-data"][cur]["changed_active"]:
|
|
||||||
try:
|
|
||||||
for f in win.current["remote-folder-data"][cur]["changed"]:
|
|
||||||
|
|
||||||
fdata = win.current["remote-folder-data"][cur]["changed"][f]
|
|
||||||
|
|
||||||
if fdata.get("finished"):
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
icon = "unchecked"
|
if not found:
|
||||||
if fdata["to_download"]:
|
continue
|
||||||
icon = "checked"
|
|
||||||
|
ticon = "unchecked"
|
||||||
|
if fdata.get("to_download", True):
|
||||||
|
ticon = "checked"
|
||||||
|
|
||||||
|
if toggle["do"] != None:
|
||||||
|
fdata["to_download"] = toggle["do"]
|
||||||
|
|
||||||
def do():
|
def do():
|
||||||
fdata["to_download"] = not fdata["to_download"]
|
fdata["to_download"] = not fdata.get("to_download", True)
|
||||||
|
|
||||||
|
# Filetype icon
|
||||||
|
ext = f[f.rfind(".")+1:]
|
||||||
|
if ext in fileformats.images:
|
||||||
|
icon = "image"
|
||||||
|
elif ext in fileformats.videos:
|
||||||
|
icon = "video"
|
||||||
|
elif ext in fileformats.sounds:
|
||||||
|
icon = "mus"
|
||||||
|
elif ext == "blend":
|
||||||
|
icon = "blender"
|
||||||
|
elif ext == "progress":
|
||||||
|
icon = "checklist"
|
||||||
|
else:
|
||||||
|
icon = "file"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
UI_elements.roundrect(layer, win,
|
UI_elements.roundrect(layer, win,
|
||||||
win.current["w"]/2-315,
|
win.current["w"]/2-315,
|
||||||
|
@ -779,24 +846,31 @@ def prompt_layer(win, call):
|
||||||
40,
|
40,
|
||||||
10,
|
10,
|
||||||
button=do,
|
button=do,
|
||||||
icon=icon)
|
icon=ticon,
|
||||||
|
tip=f)
|
||||||
|
|
||||||
|
UI_elements.image(layer, win, "settings/themes/"+win.settings["Theme"]+"/icons/"+icon+".png",
|
||||||
|
win.current["w"]/2-275,
|
||||||
|
110 + current_Y + win.scroll["http-prompt"],
|
||||||
|
40,
|
||||||
|
40)
|
||||||
|
|
||||||
UI_color.set(layer, win, "text_normal")
|
UI_color.set(layer, win, "text_normal")
|
||||||
layer.set_font_size(20)
|
layer.set_font_size(20)
|
||||||
layer.move_to(win.current["w"]/2-270,
|
layer.move_to(win.current["w"]/2-220,
|
||||||
current_Y + win.scroll["http-prompt"] + 135)
|
current_Y + win.scroll["http-prompt"] + 135)
|
||||||
layer.show_text(f)
|
layer.show_text(f[f.rfind("/")+1:])
|
||||||
|
|
||||||
current_Y += 50
|
current_Y += 50
|
||||||
except:
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
UI_elements.scroll_area(layer, win, "http-prompt",
|
UI_elements.scroll_area(layer, win, "http-prompt",
|
||||||
int(win.current["w"]/2-350),
|
int(win.current["w"]/2-350),
|
||||||
100,
|
200,
|
||||||
700,
|
700,
|
||||||
win.current["h"]-260,
|
win.current["h"]-360,
|
||||||
current_Y,
|
current_Y,
|
||||||
bar=True,
|
bar=True,
|
||||||
mmb=True,
|
mmb=True,
|
||||||
|
|
|
@ -61,7 +61,7 @@ def run():
|
||||||
# I might figure out how to make it faster with various resulutions. Not now.
|
# I might figure out how to make it faster with various resulutions. Not now.
|
||||||
|
|
||||||
win.connect("destroy", Gtk.main_quit)
|
win.connect("destroy", Gtk.main_quit)
|
||||||
win.set_title("VCStudio : "+talk.text("project-manager"))
|
win.set_title("Blender-Pipeline : "+talk.text("project-manager"))
|
||||||
win.set_default_icon_from_file("tinyicon.png")
|
win.set_default_icon_from_file("tinyicon.png")
|
||||||
|
|
||||||
# Setting up the events ( mouse and keyboard handling )
|
# Setting up the events ( mouse and keyboard handling )
|
||||||
|
|
|
@ -292,3 +292,4 @@ RemoteShotUpdates = [Remote Shot Updates]
|
||||||
DownloadRemoteServer = [Download Files]
|
DownloadRemoteServer = [Download Files]
|
||||||
blender-bash = [Command To Start Blender]
|
blender-bash = [Command To Start Blender]
|
||||||
StillLoadingRemoteData = [Still Loading ...]
|
StillLoadingRemoteData = [Still Loading ...]
|
||||||
|
ToggleVisible = [Toggle Visible]
|
|
@ -98,7 +98,7 @@ def run(project, win):
|
||||||
win.set_position(Gtk.WindowPosition.CENTER)
|
win.set_position(Gtk.WindowPosition.CENTER)
|
||||||
win.maximize()
|
win.maximize()
|
||||||
win.connect("destroy", Gtk.main_quit)
|
win.connect("destroy", Gtk.main_quit)
|
||||||
win.set_title("VCStudio")
|
win.set_title("Blender-Pipeline")
|
||||||
win.set_default_icon_from_file("tinyicon.png")
|
win.set_default_icon_from_file("tinyicon.png")
|
||||||
|
|
||||||
# Setting up the events ( mouse and keyboard handling )
|
# Setting up the events ( mouse and keyboard handling )
|
||||||
|
@ -167,7 +167,7 @@ def run(project, win):
|
||||||
win.analytics = analytics.load(project)
|
win.analytics = analytics.load(project)
|
||||||
|
|
||||||
# Try to put a name of the project at the title
|
# Try to put a name of the project at the title
|
||||||
win.set_title("VCStudio : "+win.analytics["name"])
|
win.set_title("Blender-Pipeline : "+win.analytics["name"])
|
||||||
|
|
||||||
# Cashed tables
|
# Cashed tables
|
||||||
win.color = UI_color.get_table()
|
win.color = UI_color.get_table()
|
||||||
|
|
Loading…
Reference in a new issue