diff --git a/network/http_client.py b/network/http_client.py index d0e182e..b1539b0 100644 --- a/network/http_client.py +++ b/network/http_client.py @@ -23,6 +23,7 @@ import cairo # Own modules from settings import settings +from settings import fileformats from settings import talk from project_manager import pm_project @@ -117,7 +118,7 @@ def down(win, website, filename, fsize=100000): savef.write(unz) savef.close() -def download_missing_changed(win, cur): +def download_missing_changed(win, cur, call): # This function downloads files from remote server using the # remote-folder-data data. @@ -140,6 +141,7 @@ def download_missing_changed(win, cur): pass win.current["remote-folder-data"][cur]["downloading"] = False + win.current["calls"][call]["var"] = False def get_folder_info(win, folders, cur): @@ -599,7 +601,7 @@ def prompt_layer(win, call): win.current["remote-folder-data"][cur]["downloading"] = True start_downaloding = threading.Thread(target=download_missing_changed, - args=(win, cur, )) + args=(win, cur, call, )) start_downaloding.setDaemon(True) start_downaloding.start() @@ -646,22 +648,138 @@ def prompt_layer(win, call): layer.move_to(win.current["w"]/2-180, win.current["h"]-145) 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 UI_elements.roundrect(layer, win, win.current["w"]/2-350, - 100, + 200, 700, - win.current["h"]-260, + win.current["h"]-360, 10, fill=False) layer.clip() clip = [ win.current["w"]/2-350, - 100, + 200, 700, - win.current["h"]-260] + win.current["h"]-360] # Setting up the scroll if "http-prompt" not in win.scroll: @@ -669,134 +787,90 @@ 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 + try: + for f in DisplayList: - - - 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 + fdata = DisplayList[f] - if win.current["remote-folder-data"][cur]["missing_active"]: - try: - for f in win.current["remote-folder-data"][cur]["missing"]: + if fdata.get("finished"): + continue - fdata = win.current["remote-folder-data"][cur]["missing"][f] + found = True + if win.text["http_client_search"]["text"]: + for word in win.text["http_client_search"]["text"].split(" "): + if word.lower() not in f.lower(): + found = False + continue - if fdata.get("finished"): - continue - - UI_color.set(layer, win, "text_normal") - layer.set_font_size(20) - layer.move_to(win.current["w"]/2-270, - current_Y + win.scroll["http-prompt"] + 135) - layer.show_text(f) - - 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 not found: + continue - if win.current["remote-folder-data"][cur]["changed_active"]: - try: - for f in win.current["remote-folder-data"][cur]["changed"]: + ticon = "unchecked" + if fdata.get("to_download", True): + ticon = "checked" - fdata = win.current["remote-folder-data"][cur]["changed"][f] + if toggle["do"] != None: + fdata["to_download"] = toggle["do"] + + def do(): + fdata["to_download"] = not fdata.get("to_download", True) - if fdata.get("finished"): - continue + # 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" - icon = "unchecked" - if fdata["to_download"]: - icon = "checked" + + + UI_elements.roundrect(layer, win, + win.current["w"]/2-315, + 110 + current_Y + win.scroll["http-prompt"], + 660, + 40, + 10, + button=do, + icon=ticon, + tip=f) - def do(): - fdata["to_download"] = not fdata["to_download"] - - UI_elements.roundrect(layer, win, - win.current["w"]/2-315, + 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"], - 660, 40, - 10, - button=do, - icon=icon) + 40) + UI_color.set(layer, win, "text_normal") + layer.set_font_size(20) + layer.move_to(win.current["w"]/2-220, + current_Y + win.scroll["http-prompt"] + 135) + layer.show_text(f[f.rfind("/")+1:]) - UI_color.set(layer, win, "text_normal") - layer.set_font_size(20) - layer.move_to(win.current["w"]/2-270, - current_Y + win.scroll["http-prompt"] + 135) - layer.show_text(f) - - current_Y += 50 - except: - pass + current_Y += 50 + except Exception as e: + print(e) + pass UI_elements.scroll_area(layer, win, "http-prompt", int(win.current["w"]/2-350), - 100, + 200, 700, - win.current["h"]-260, + win.current["h"]-360, current_Y, bar=True, mmb=True, diff --git a/network/http_server.py b/network/http_server.py index 1e44301..e2793e7 100644 --- a/network/http_server.py +++ b/network/http_server.py @@ -181,7 +181,7 @@ class handler(BaseHTTPRequestHandler): # This is a little weird, sometimes the files have the full URL # to the data. - if i.startswith(PROJECT): # This is good when the server is on the same machine as the orignal project + if i.startswith(PROJECT): # This is good when the server is on the same machine as the orignal project parsed.append(i[len(PROJECT):]) elif i.startswith(ORIGINAL_PROJECT): # This is when the server is a mirror diff --git a/project_manager/pm_gtk.py b/project_manager/pm_gtk.py index 9695ecb..bc35cfb 100644 --- a/project_manager/pm_gtk.py +++ b/project_manager/pm_gtk.py @@ -61,7 +61,7 @@ def run(): # 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_title("Blender-Pipeline : "+talk.text("project-manager")) win.set_default_icon_from_file("tinyicon.png") # Setting up the events ( mouse and keyboard handling ) diff --git a/settings/languages/English.data b/settings/languages/English.data index 5b23837..4189a5f 100644 --- a/settings/languages/English.data +++ b/settings/languages/English.data @@ -291,4 +291,5 @@ RemoteAssetUpdates = [Remote Asset Updates] RemoteShotUpdates = [Remote Shot Updates] DownloadRemoteServer = [Download Files] blender-bash = [Command To Start Blender] -StillLoadingRemoteData = [Still Loading ...] \ No newline at end of file +StillLoadingRemoteData = [Still Loading ...] +ToggleVisible = [Toggle Visible] \ No newline at end of file diff --git a/studio/studio_gtk.py b/studio/studio_gtk.py index 6aa6043..702a2b6 100644 --- a/studio/studio_gtk.py +++ b/studio/studio_gtk.py @@ -98,7 +98,7 @@ def run(project, win): win.set_position(Gtk.WindowPosition.CENTER) win.maximize() win.connect("destroy", Gtk.main_quit) - win.set_title("VCStudio") + win.set_title("Blender-Pipeline") win.set_default_icon_from_file("tinyicon.png") # Setting up the events ( mouse and keyboard handling ) @@ -167,7 +167,7 @@ def run(project, win): win.analytics = analytics.load(project) # 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 win.color = UI_color.get_table()