It works!!! ( Early Alpha )

This commit is contained in:
Victorious Children Studios 2023-12-19 19:32:02 +02:00
parent db26ed0f98
commit 31b6d2fb37
6 changed files with 101 additions and 25 deletions

View file

@ -145,9 +145,14 @@ def get_folder_info(win, folders, cur):
win.current["remote-folder-data"][cur] = {"missing":{}, win.current["remote-folder-data"][cur] = {"missing":{},
"changed":{}} "changed":{}}
def sort_file(filename, files, f): win.current["remote-folder-data"][cur]["loaded"] = False
def sort_file(filename, files, f, filedata=None):
if not filedata:
filedata = files.get(f, {}) filedata = files.get(f, {})
filedata["finished"] = False filedata["finished"] = False
try: try:
hashis = hashlib.md5(open(win.project+filename,'rb').read()).hexdigest() hashis = hashlib.md5(open(win.project+filename,'rb').read()).hexdigest()
except: except:
@ -202,11 +207,14 @@ def get_folder_info(win, folders, cur):
try: try:
dp = go(win, website, "/blend"+nc) dp = go(win, website, "/blend"+nc)
for f in dp.get("files", {}): for f in dp.get("files", {}):
try: try:
sort_file(f, sort_file(f,
dp.get("files", {}), dp.get("files", {}),
f[f.rfind("/")+1:]) f[f.rfind("/")+1:],
filedata=dp.get("files", {})[f])
except Exception as e: except Exception as e:
print(e) print(e)
except Exception as e: except Exception as e:
@ -221,6 +229,8 @@ def get_folder_info(win, folders, cur):
for i in win.current["remote-folder-data"][cur][t]: for i in win.current["remote-folder-data"][cur][t]:
print(" "+i) print(" "+i)
win.current["remote-folder-data"][cur]["loaded"] = True
def get_folders(win): def get_folders(win):
# This function will get specified subfolders # This function will get specified subfolders
@ -568,6 +578,9 @@ def prompt_layer(win, call):
tip=talk.text("cancel")) tip=talk.text("cancel"))
# Download button # Download button
if win.current["remote-folder-data"][cur]["loaded"]:
def do(): def do():
win.current["remote-folder-data"][cur]["downloading"] = True win.current["remote-folder-data"][cur]["downloading"] = True
@ -586,6 +599,12 @@ def prompt_layer(win, call):
button=do, button=do,
icon="download", icon="download",
tip=talk.text("DownloadRemoteServer")) tip=talk.text("DownloadRemoteServer"))
else:
UI_color.set(layer, win, "text_normal")
layer.set_font_size(15)
layer.move_to(win.current["w"]/2,
win.current["h"]-120,)
layer.show_text(talk.text("StillLoadingRemoteData"))
else: else:

View file

@ -291,3 +291,4 @@ RemoteAssetUpdates = [Remote Asset Updates]
RemoteShotUpdates = [Remote Shot Updates] 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 ...]

View file

@ -200,7 +200,7 @@ def layer(win):
40, 40,
10, 10,
do, do,
"multiuser", "download",
tip=talk.text("RemoteAssetUpdates")) tip=talk.text("RemoteAssetUpdates"))
if win.current["remote-folder-data"][win.cur]["missing"] or win.current["remote-folder-data"][win.cur]["changed"]: if win.current["remote-folder-data"][win.cur]["missing"] or win.current["remote-folder-data"][win.cur]["changed"]:

View file

@ -2541,7 +2541,7 @@ def layer(win):
40, 40,
10, 10,
button=do, button=do,
icon="multiuser", icon="download",
tip=talk.text("RemoteShotUpdates")) tip=talk.text("RemoteShotUpdates"))

View file

@ -537,6 +537,17 @@ def layer(win):
if var: if var:
print(var) print(var)
oscalls.file_open(win, var) oscalls.file_open(win, var)
# Remote Server Stuff
if win.analytics["from-remote-server"]:
# Checking date [ FOLDER NAME ] [ FILES TO CHECK FOR ]
check_folders = {"/rnd/" : "*"
}
check_updates = threading.Thread(target=http_client.get_folder_info,
args=(win, check_folders, "vse", ))
check_updates.setDaemon(True)
check_updates.start()
studio_dialogs.vse(win, "VSEs", after) studio_dialogs.vse(win, "VSEs", after)

View file

@ -73,6 +73,51 @@ def layer(win, call):
10) 10)
# Remote server download button
if win.analytics["from-remote-server"]:
if "remote-folder-data" not in win.current:
win.current["remote-folder-data"] = {}
if win.cur not in win.current["remote-folder-data"]:
win.current["remote-folder-data"][win.cur] = {"missing":{},
"changed":{}}
def do():
def after(win, var):
UI_elements.reload_images(win)
win.current["remote-folder-data"]["prompt"] = "vse"
studio_dialogs.http_client_update_prompt(win, "http-client-prompt", after)
UI_elements.roundrect(layer, win,
win.current["w"]/2+210-50,
win.current["h"]-140,
40,
40,
10,
do,
"download",
tip=talk.text("RemoteAssetUpdates"))
if win.current["remote-folder-data"]["vse"]["missing"] or win.current["remote-folder-data"]["vse"]["changed"]:
count = str(len(win.current["remote-folder-data"]["vse"]["missing"])+len(win.current["remote-folder-data"]["vse"]["changed"]))
UI_color.set(layer, win, "progress_active")
UI_elements.roundrect(layer, win,
win.current["w"]/2+210-50+25,
win.current["h"]-140,
len(count)*12+6,
25,
5)
layer.fill()
UI_color.set(layer, win, "text_normal")
layer.set_font_size(20)
layer.move_to(win.current["w"]/2+210-50+28,
win.current["h"]-140+20,)
layer.show_text(count)
# Exit button # Exit button
def do(): def do():