123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530 |
- import os
- from subprocess import *
- 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
- from settings import settings
- from settings import talk
- from settings import fileformats
- from project_manager import pm_project
- from UI import UI_elements
- from UI import UI_color
- from studio import story
- from studio import analytics
- from studio import history
- from studio import studio_dialogs
- from network import multiuser_terminal
- def layer(win):
-
-
- surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, win.current['w'],
- win.current['h'])
- layer = cairo.Context(surface)
-
-
-
- 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()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- win.multiuser["unread"] = 0
-
-
- UI_color.set(layer, win, "node_background")
- UI_elements.roundrect(layer, win,
- 80,
- 80,
- win.current["w"]/3*2-160,
- win.current["h"]/2-100,
- 10)
-
-
- UI_color.set(layer, win, "node_background")
- UI_elements.roundrect(layer, win,
- 80,
- win.current["h"]/2,
- win.current["w"]/3*2-160,
- win.current["h"]/2-80,
- 10)
-
-
- UI_color.set(layer, win, "node_background")
- UI_elements.roundrect(layer, win,
- win.current["w"]/3*2-60,
- 80,
- win.current["w"]/3-20,
- win.current["h"]-160,
- 10)
-
-
-
-
-
-
-
-
-
-
- if win.multiuser["server"]:
-
- def do():
-
-
- multiuser_terminal.message("VCStudio ABORT MULTIUSER")
-
- UI_elements.roundrect(layer, win,
- 90,
- 90,
- 40,
- 40,
- 10,
- button=do,
- icon="server_close",
- tip=talk.text("multiuser_server_stop"))
- else:
- def do():
-
-
- Popen(["python3", "network/multiuser_server.py", win.analytics["name"]])
-
- UI_elements.roundrect(layer, win,
- 90,
- 90,
- 40,
- 40,
- 10,
- button=do,
- icon="server_new",
- tip=talk.text("multiuser_server_start"))
-
-
-
-
- x = 90
- y = 140
- width = win.current["w"]/3*2-160-20
- height = win.current["h"]/2-170
-
-
-
- surface2 = cairo.ImageSurface(cairo.FORMAT_ARGB32, int(width), int(height))
- node = cairo.Context(surface2)
- node.select_font_face("Monospace", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL)
-
-
- UI_elements.roundrect(node, win,
- 0,
- 0,
- width,
- height,
- 10,
- fill=False)
- node.clip()
-
-
-
-
-
-
-
- if "multiuser_terminal" not in win.scroll:
- win.scroll["multiuser_terminal"] = 0
-
- current_Y = 10
-
- for message in win.multiuser["terminal"]:
-
-
- UI_elements.image(node, win,
- "settings/themes/"+win.settings["Theme"]+"/icons/server.png",
- 10,
- current_Y+win.scroll["multiuser_terminal"],
- 40,
- 40)
-
-
-
- UI_color.set(node, win, "text_normal")
- node.set_font_size(15)
- node.move_to( 60, current_Y+win.scroll["multiuser_terminal"]+27)
- node.show_text(message)
-
- current_Y = current_Y + 50
-
-
- layer.set_source_surface(surface2, x, y)
- layer.paint()
-
- UI_elements.scroll_area(layer, win, "multiuser_terminal",
- x,
- y,
- width,
- height,
- current_Y,
- bar=True,
- mmb=True)
-
-
-
-
-
-
-
-
-
-
-
-
- x = 90
- y = win.current["h"]/2+10
- width = win.current["w"]/3*2-160-20
- height = win.current["h"]/2-80-60
-
-
-
- surface2 = cairo.ImageSurface(cairo.FORMAT_ARGB32, int(width), int(height))
- node = cairo.Context(surface2)
- node.select_font_face("Monospace", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL)
-
-
- UI_elements.roundrect(node, win,
- 0,
- 0,
- width,
- height,
- 10,
- fill=False)
- node.clip()
-
-
-
-
-
-
-
-
- if "multiuser_users" not in win.scroll:
- win.scroll["multiuser_users"] = 0
-
- current_Y = 10
-
- for ip in list(win.multiuser["users"].keys()):
- try:
- user = win.multiuser["users"][ip]
- except:
- continue
-
- username = user["username"]
-
-
-
-
-
-
- if ip == win.multiuser["userid"]:
- UI_color.set(node, win, "node_blendfile")
- UI_elements.roundrect(node, win,
- 0,
- current_Y+win.scroll["multiuser_users"]-5,
- width,
- 45,
- 10)
-
-
-
- UI_elements.image(node, win,
- "settings/themes/"+win.settings["Theme"]+"/icons/user.png",
- 10,
- current_Y+win.scroll["multiuser_users"],
- 40,
- 40)
-
-
-
- UI_color.set(node, win, "text_normal")
- node.set_font_size(20)
- node.move_to( 60, current_Y+win.scroll["multiuser_users"]+25)
- node.show_text(username+" | "+ip)
-
- current_Y = current_Y + 50
-
-
-
- layer.set_source_surface(surface2, x, y)
- layer.paint()
-
- UI_elements.scroll_area(layer, win, "multiuser_users",
- x,
- y,
- width,
- height,
- current_Y,
- bar=True,
- mmb=True)
-
-
-
-
-
-
- UI_elements.image(layer, win,
- "settings/themes/"+win.settings["Theme"]+"/icons/multiuser.png",
- x,
- y+height+5,
- 40,
- 40)
-
-
- if win.multiuser["users"]:
- count = str(len(win.multiuser["users"]))
-
- UI_color.set(layer, win, "node_background")
- UI_elements.roundrect(layer, win,
- x+25,
- y+height,
- len(count)*12+6,
- 25,
- 5)
- layer.fill()
- UI_color.set(layer, win, "text_normal")
- layer.set_font_size(20)
- layer.move_to(x+28,y+height+20)
- layer.show_text(count)
-
-
-
- def do():
- def after(win, var):
- pass
-
- studio_dialogs.help(win, "help", after, SEARCH=talk.text("documentation_multiuser"))
-
- UI_elements.roundrect(layer, win,
- win.current["w"]/3*2-160,
- win.current["h"]-120,
- 40,
- 40,
- 10,
- do,
- icon="question")
-
-
-
- def do():
- win.url = "story_editor"
-
- UI_elements.roundrect(layer, win,
- win.current["w"]/3*2-120,
- win.current["h"]-120,
- 40,
- 40,
- 10,
- button=do,
- icon="cancel",
- tip=talk.text("cancel"))
-
-
- if 65307 in win.current["keys"] and not win.textactive:
- do()
-
-
-
-
-
-
-
- x = win.current["w"]/3*2-50
- y = 90
- width = win.current["w"]/3-40
- height = win.current["h"]-220
-
-
-
- surface2 = cairo.ImageSurface(cairo.FORMAT_ARGB32, int(width), int(height))
- node = cairo.Context(surface2)
- node.select_font_face("Monospace", cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL)
-
-
- UI_elements.roundrect(node, win,
- 0,
- 0,
- width,
- height,
- 10,
- fill=False)
- node.clip()
-
-
-
-
-
-
-
-
- if "multiuser_messages" not in win.scroll:
- win.scroll["multiuser_messages"] = 0
-
- current_Y = 10
-
- for message in win.multiuser["messages"]:
-
-
- username = message[0]
-
- if username == "Multiuser Server":
- continue
-
-
- UI_elements.image(node, win,
- "settings/themes/"+win.settings["Theme"]+"/icons/user.png",
- 10,
- current_Y+win.scroll["multiuser_messages"],
- 40,
- 40)
-
- UI_color.set(node, win, "text_normal")
- node.set_font_size(20)
- node.move_to(60,
- current_Y+win.scroll["multiuser_messages"]+25)
- node.show_text(username)
-
- current_Y = current_Y + 50
-
-
-
-
-
- tileX = 10
-
- for word in message[1].split(" "):
-
-
- if tileX + len(word)*12+12 > width-10:
- tileX = 10
- current_Y = current_Y + 30
-
- UI_color.set(node, win, "text_normal")
- node.set_font_size(20)
- node.move_to(tileX,
- current_Y+win.scroll["multiuser_messages"]+25)
- node.show_text(word)
-
- tileX = tileX + len(word)*12+12
-
- current_Y = current_Y + 50
-
-
- layer.set_source_surface(surface2, x, y)
- layer.paint()
-
- UI_elements.scroll_area(layer, win, "multiuser_messages",
- x,
- y,
- width,
- height,
- current_Y,
- bar=True,
- mmb=True)
-
-
-
-
- UI_elements.text(layer, win, "multiuser_message",
- x,
- y+height+5,
- width-50,
- 40)
-
-
-
- def do():
-
- if win.text["multiuser_message"]["text"]:
- win.multiuser["request"] = ["message", win.text["multiuser_message"]["text"]]
- win.text["multiuser_message"]["text"] = ""
-
- UI_elements.roundrect(layer, win,
- x+width-40,
- y+height+5,
- 40,
- 40,
- 10,
- button=do,
- icon="send")
-
-
- if 65293 in win.current["keys"]:
- do()
- win.current["keys"] = []
-
- return surface
|