From 98e416296d216156c36b0800a733e7726def7b1b Mon Sep 17 00:00:00 2001 From: "Jeison Yehuda Amihud (Blender Dumbass)" Date: Fri, 28 Oct 2022 19:43:49 +0000 Subject: [PATCH] Upload files to 'studio' --- studio/checklist.py | 62 ++++++++++++++++++++++++++++++++---- studio/studio_renderLayer.py | 4 +++ studio/studio_scriptLayer.py | 41 +++++++++++++++++++++++- 3 files changed, 100 insertions(+), 7 deletions(-) diff --git a/studio/checklist.py b/studio/checklist.py index ba69a42..79d9dca 100644 --- a/studio/checklist.py +++ b/studio/checklist.py @@ -4,6 +4,12 @@ import os import cairo +try: + from gi.repository import Gtk + from gi.repository import Gdk +except: + pass + #UI modules from UI import UI_elements from UI import UI_color @@ -296,14 +302,21 @@ def save(path, data): indent[0] = indent[0] - 4 writetasks(data["subtasks"]) + + if path: + # Writting to file + w = open(path, "w") + + for i in lines: + w.write(i+"\n") - # Writting to file - w = open(path, "w") - + w.close() + + ret = "" for i in lines: - w.write(i+"\n") - - w.close() + ret = ret+"\n"+i + ret = ret[1:] + return ret def draw(outlayer, win, path, back="story_editor"): @@ -1115,6 +1128,43 @@ def draw(outlayer, win, path, back="story_editor"): win.scroll["checklist"] + cXY[1]+25 ) layer.show_text(talk.text("add_new_task")) + + cXY[1] = cXY[1] + 100 + + + def do(): + + raw = save(False, win.checklists[path]) + clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) + clipboard.set_text( raw , -1) + + UI_elements.roundrect(layer, win, + cXY[0], + win.scroll["checklist"] + cXY[1], + width - cXY[0], + 40, + 10, + button=do, + icon="copy_file", + offset=[x,y]) + + UI_color.set(layer, win, "progress_background") + UI_elements.roundrect(layer, win, + cXY[0], + win.scroll["checklist"] + cXY[1], + width - cXY[0], + 40, + 10, + fill=False) + layer.stroke() + + layer.set_font_size(20) + layer.move_to( + cXY[0]+50, + win.scroll["checklist"] + cXY[1]+25 + ) + layer.show_text(talk.text("copy_checklist_to_clipboard")) + diff --git a/studio/studio_renderLayer.py b/studio/studio_renderLayer.py index 2afecc3..f50509f 100644 --- a/studio/studio_renderLayer.py +++ b/studio/studio_renderLayer.py @@ -576,6 +576,10 @@ def layer(win, call): def do(): win.current["selecting_render_file_format"] = not win.current["selecting_render_file_format"] + if win.current["selecting_render_file_format"]: + win.scroll["render"] = win.scroll["render"]-50*len(formats) + win.current["LMB"] = False + win.previous["LMB"] = False UI_elements.roundrect(layer, win, x+120, diff --git a/studio/studio_scriptLayer.py b/studio/studio_scriptLayer.py index 6750f5f..86e81d4 100644 --- a/studio/studio_scriptLayer.py +++ b/studio/studio_scriptLayer.py @@ -1935,6 +1935,42 @@ def layer(win): layer.set_font_size(20) layer.move_to( x+50, y+(50*num)+25) layer.show_text(talk.text(shot_options[option])) + + # Add checklist from clipboard + + def do(): + + clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) + cliptext = str(clipboard.wait_for_text()) + + filepath = win.project+"/rnd"+win.cur+"/shot.progress" + s = open(filepath, 'w') + s.write(cliptext) + s.close() + + UI_elements.roundrect(layer, win, + x, + y+(50*num+50), + width, + 40, + 10, + button=do, + icon="checklist_new") + + UI_color.set(layer, win, "progress_background") + UI_elements.roundrect(layer, win, + x, + y+(50*num+50), + width, + 40, + 10, + fill=False) + layer.stroke() + + UI_color.set(layer, win, "text_normal") + layer.set_font_size(20) + layer.move_to( x+50, y+(50*num+50)+25) + layer.show_text(talk.text("new_checklist_from_clipboard")) else: @@ -2532,7 +2568,10 @@ def layer(win): Pb.paint() imageurl = win.project+"/rnd"+win.cur+"/"+win.current[shotis+"_active_folder"]+"/0001.png" - + try: + os.makedirs(win.project+"/rnd"+win.cur+"/"+win.current[shotis+"_active_folder"]) + except: + pass Pc.write_to_png(imageurl)