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":{},
"changed":{}}
def sort_file(filename, files, f):
filedata = files.get(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["finished"] = False
try:
hashis = hashlib.md5(open(win.project+filename,'rb').read()).hexdigest()
except:
@ -202,11 +207,14 @@ def get_folder_info(win, folders, cur):
try:
dp = go(win, website, "/blend"+nc)
for f in dp.get("files", {}):
try:
sort_file(f,
dp.get("files", {}),
f[f.rfind("/")+1:])
f[f.rfind("/")+1:],
filedata=dp.get("files", {})[f])
except Exception as e:
print(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]:
print(" "+i)
win.current["remote-folder-data"][cur]["loaded"] = True
def get_folders(win):
# This function will get specified subfolders
@ -568,24 +578,33 @@ def prompt_layer(win, call):
tip=talk.text("cancel"))
# Download button
def do():
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()
if win.current["remote-folder-data"][cur]["loaded"]:
def do():
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,
win.current["w"]/2+270,
win.current["h"]-140,
40,
40,
10,
button=do,
icon="download",
tip=talk.text("DownloadRemoteServer"))
UI_elements.roundrect(layer, win,
win.current["w"]/2+270,
win.current["h"]-140,
40,
40,
10,
button=do,
icon="download",
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:

View file

@ -291,3 +291,4 @@ RemoteAssetUpdates = [Remote Asset Updates]
RemoteShotUpdates = [Remote Shot Updates]
DownloadRemoteServer = [Download Files]
blender-bash = [Command To Start Blender]
StillLoadingRemoteData = [Still Loading ...]

View file

@ -200,7 +200,7 @@ def layer(win):
40,
10,
do,
"multiuser",
"download",
tip=talk.text("RemoteAssetUpdates"))
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,
10,
button=do,
icon="multiuser",
icon="download",
tip=talk.text("RemoteShotUpdates"))

View file

@ -537,6 +537,17 @@ def layer(win):
if var:
print(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)

View file

@ -73,6 +73,51 @@ def layer(win, call):
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
def do():