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
filedata = files.get(f, {})
filedata["finished"] = False def sort_file(filename, files, f, filedata=None):
if not filedata:
filedata = files.get(f, {})
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:
@ -201,12 +206,15 @@ def get_folder_info(win, folders, cur):
while nc: while nc:
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,24 +578,33 @@ def prompt_layer(win, call):
tip=talk.text("cancel")) tip=talk.text("cancel"))
# Download button # Download button
def do():
win.current["remote-folder-data"][cur]["downloading"] = True
start_downaloding = threading.Thread(target=download_missing_changed, if win.current["remote-folder-data"][cur]["loaded"]:
args=(win, cur, ))
start_downaloding.setDaemon(True) def do():
start_downaloding.start() win.current["remote-folder-data"][cur]["downloading"] = True
start_downaloding = threading.Thread(target=download_missing_changed,
args=(win, cur, ))
start_downaloding.setDaemon(True)
start_downaloding.start()
UI_elements.roundrect(layer, win, UI_elements.roundrect(layer, win,
win.current["w"]/2+270, win.current["w"]/2+270,
win.current["h"]-140, win.current["h"]-140,
40, 40,
40, 40,
10, 10,
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

@ -290,4 +290,5 @@ ChangedFiles = [Changed Files]
RemoteAssetUpdates = [Remote Asset Updates] 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,7 +537,18 @@ 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)
UI_elements.roundrect(layer, win, UI_elements.roundrect(layer, win,

View file

@ -71,8 +71,53 @@ def layer(win, call):
500, 500,
win.current["h"]-200, win.current["h"]-200,
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():