Blender-Pipeline/studio/studio_storyDeletionLayer.py

174 lines
4.3 KiB
Python
Raw Normal View History

2020-12-07 22:40:45 +01:00
# THIS FILE IS A PART OF VCStudio
# PYTHON 3
# This a console project manager.
import os
# GTK module ( Graphical interface
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import GLib
from gi.repository import Gdk
import cairo
# Own modules
from settings import settings
from settings import talk
from project_manager import pm_project
#UI modules
from UI import UI_elements
from UI import UI_color
def layer(win):
# Making the layer
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, win.current['w'],
win.current['h'])
layer = cairo.Context(surface)
#text setting
layer.select_font_face("Monospace", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL)
UI_color.set(layer, win, "dark_overdrop")
layer.rectangle(
0,
0,
win.current["w"],
win.current["h"],
)
layer.fill()
# So it's going to be like a little window in the center of the VCStudio
# with a simple UI. Probably like 2 things. Folder and a projectname.
UI_color.set(layer, win, "node_background")
UI_elements.roundrect(layer, win,
win.current["w"]/2-250,
win.current["h"]/2-150,
500,
300,
10)
# Title of the operation. Incase the user forgot.
UI_elements.text(layer, win, "delete_scenes_question",
win.current["w"]/2-250,
win.current["h"]/2-140,
500,
30,
10,
fill=False,
centered=True,
editable=False)
win.text["delete_scenes_question"]["text"] = talk.text("DeleteQuestion")
# Let's count how much of what it's going to be deleting.
scenes = 0
files = 0
assets = 0
markers = 0
for thing in win.story["selected"]:
if thing[0] == "scene":
scenes += 1
elif thing[0] == "file":
files += 1
elif thing[0] == "asset":
assets += 1
elif thing[0] == "marker":
markers += 1
# Text saying Stuff
UI_color.set(layer, win, "text_normal")
layer.set_font_size(20)
layer.move_to(
win.current["w"]/2-200,
win.current["h"]/2-60)
layer.show_text(str(scenes)+" "+talk.text("Scenes"))
layer.move_to(
win.current["w"]/2-200,
win.current["h"]/2-30)
layer.show_text(str(files)+" "+talk.text("LinksToFiles"))
layer.move_to(
win.current["w"]/2-200,
win.current["h"]/2)
layer.show_text(str(assets)+" "+talk.text("LinksToAssets"))
layer.move_to(
win.current["w"]/2-200,
win.current["h"]/2+30)
layer.show_text(str(markers)+" "+talk.text("Markers"))
# Text at the bottom
UI_elements.text(layer, win, "delete_scenes_conformation",
win.current["w"]/2-250,
win.current["h"]/2+60,
500,
30,
10,
fill=False,
centered=True,
editable=False)
win.text["delete_scenes_conformation"]["text"] = talk.text("OperationIrrevesable")
def do():
win.url = "story_editor"
links = []
for thing in win.story["selected"]:
if thing[0] == "scene":
del win.story["scenes"][thing[1]]
2020-12-09 03:29:21 +01:00
elif thing[0] == "marker":
del win.story["markers"][thing[1]]
2020-12-07 22:40:45 +01:00
elif thing[0] in ["asset", "file"]:
links.append(thing[1])
new = []
for num, i in enumerate(win.story["links"]):
if num not in links:
new.append(i)
win.story["links"] = new
win.story["selected"] = []
UI_elements.roundrect(layer, win,
win.current["w"]/2+170,
win.current["h"]/2+110,
40,
40,
10,
button=do,
icon="ok",
tip=talk.text("checked"))
def do():
win.url = "story_editor"
UI_elements.roundrect(layer, win,
win.current["w"]/2+210,
win.current["h"]/2+110,
40,
40,
10,
button=do,
icon="cancel",
tip=talk.text("cancel"))
return surface