|
@@ -367,46 +367,7 @@ try:
|
|
|
except Exception as e:
|
|
|
cprint("Exception IMPORT ERROR",e)
|
|
|
|
|
|
-class MC_FIX():
|
|
|
- def __init__(self,server="127.0.0.1",port=11211):
|
|
|
- cprint("MC.init() ----------" ,server,port,color="red")
|
|
|
- try:
|
|
|
- self.mc = memcache.Client(['{}:{}'.format(server,port)], debug=0)
|
|
|
- except Exception as e:
|
|
|
- cprint("-- Exception",e)
|
|
|
-
|
|
|
- def set(self,index="fix",data=[]):
|
|
|
- index = self.mc.get("index")
|
|
|
- self.mc.set("fix", data)
|
|
|
-
|
|
|
-class MC_PATCH():
|
|
|
- def __init__(self,server="127.0.0.1",port=11211):
|
|
|
- cprint("MC.init() ----------" ,server,port,color="red")
|
|
|
- try:
|
|
|
- self.mc = memcache.Client(['{}:{}'.format(server,port)], debug=0)
|
|
|
- except Exception as e:
|
|
|
- cprint("-- Exception",e)
|
|
|
- def loop(self):
|
|
|
- time.sleep(10)
|
|
|
- print("start loop MC_PATCH ...")
|
|
|
- while 1:
|
|
|
- try:
|
|
|
-
|
|
|
- index_patch = []
|
|
|
- for fix,val in FIXTURES.fixtures.items():
|
|
|
- #print("FIX",fix,val)
|
|
|
- val = json.dumps(val).encode()
|
|
|
- self.mc.set("PATCH-"+str(fix),val)
|
|
|
- index_patch.append(fix)
|
|
|
-
|
|
|
- val = json.dumps(index_patch).encode()
|
|
|
- self.mc.set("PATCH-INDEX",val)
|
|
|
- except Exception as e:
|
|
|
- print(e)
|
|
|
- time.sleep(5)
|
|
|
|
|
|
-mc_patch = MC_PATCH()
|
|
|
-thread.start_new_thread(mc_patch.loop,())
|
|
|
|
|
|
class MC():
|
|
|
def __init__(self,server="127.0.0.1",port=11211):
|
|
@@ -418,10 +379,6 @@ class MC():
|
|
|
except Exception as e:
|
|
|
cprint("-- Exception",e)
|
|
|
|
|
|
- # def init(self):
|
|
|
- data = {}
|
|
|
- start = time.time()
|
|
|
- delta = start
|
|
|
index = self.mc.get("index")
|
|
|
if index:
|
|
|
for i in index:
|
|
@@ -495,7 +452,6 @@ class MC():
|
|
|
print("IP:",ip)
|
|
|
#input()
|
|
|
while 1:
|
|
|
- send = 0
|
|
|
#print("+")
|
|
|
try:
|
|
|
#ip="10.10.10.13:0"
|
|
@@ -563,6 +519,7 @@ def jclient_send(data):
|
|
|
jdatas.append(jdata)
|
|
|
except Exception as e:
|
|
|
cprint("jclient_send, Exception DMX ",color="red")
|
|
|
+ cprint("",e,color="red")
|
|
|
cprint("",jdata,color="red")
|
|
|
cprint("-----",color="red")
|
|
|
|
|
@@ -608,6 +565,7 @@ def jclient_send(data):
|
|
|
cprint(e,color="red")
|
|
|
#pt Exception as e:
|
|
|
exc_type, exc_obj, exc_tb = sys.exc_info()
|
|
|
+ _ = exc_obj
|
|
|
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
|
|
print(exc_type, fname, exc_tb.tb_lineno)
|
|
|
cprint("-----",color="red")
|
|
@@ -648,7 +606,7 @@ def _highlight(fix,_attr="DIM"):
|
|
|
data["DMX"] = DMX + ATTR[attr]["NR"]-1
|
|
|
cprint(attr,ATTR[attr])
|
|
|
cprint(data)
|
|
|
- for i in range(3):
|
|
|
+ for _ in range(3):
|
|
|
cprint("highlight",fix,"0")
|
|
|
data["VALUE"] = 100
|
|
|
jclient_send([data])
|
|
@@ -802,10 +760,7 @@ def save_show_to_usb():
|
|
|
usb = usb.strip()
|
|
|
print(usb)
|
|
|
|
|
|
- cwd = os.getcwd()
|
|
|
-
|
|
|
_show_name = showlib.current_show_name()
|
|
|
- #_usbstick_path = "/media/user/"+str(usb)+"/LibreLight/show/"
|
|
|
_usbstick_path = ""+str(usb)+"/LibreLight/show/"
|
|
|
SHOW_DIR = libwin.showlib.SHOW_DIR
|
|
|
|
|
@@ -889,8 +844,6 @@ class cb():
|
|
|
def __init__(self,win):
|
|
|
self.win = win
|
|
|
def _callback(self,event):
|
|
|
- clobj=event.widget
|
|
|
- ## undermouse=find_withtag(master.CURRENT)
|
|
|
undermouse=self.win.find_closest(self.win.CURRENT)
|
|
|
cprint( repr(undermouse))
|
|
|
def callback(self,event):
|
|
@@ -1050,8 +1003,6 @@ class MASTER():
|
|
|
|
|
|
for i in range(8*8*8):
|
|
|
if i not in EXEC.val_exec:
|
|
|
- name = "Preset:"+str(i+1)+":\nXYZ"
|
|
|
- #self.exec[i] = [i]
|
|
|
EXEC.val_exec[i] = OrderedDict() # FIX
|
|
|
EXEC.val_exec[i]["CFG"] = OrderedDict() # CONFIG
|
|
|
EXEC.label_exec[i] = "-"
|
|
@@ -1096,8 +1047,7 @@ class MASTER():
|
|
|
# buffer nr
|
|
|
def _cb(data):
|
|
|
cfg = EXEC._btn_cfg(nr)
|
|
|
- button = EXEC.btn_cfg(nr)
|
|
|
- label = EXEC.label(nr)
|
|
|
+
|
|
|
if not data:
|
|
|
cprint("err443",self,"_cb",data)
|
|
|
return None
|
|
@@ -1119,7 +1069,7 @@ class MASTER():
|
|
|
txt = float(txt)
|
|
|
if "DELAY" in cfg:
|
|
|
cfg["DELAY"] = round(txt,2)
|
|
|
- except e as Exception:
|
|
|
+ except Exception as e:
|
|
|
print("DELAY Exception",e)
|
|
|
|
|
|
if "in-Fade" in data and type(data["in-Fade"]) is str:
|
|
@@ -1128,7 +1078,7 @@ class MASTER():
|
|
|
txt = float(txt)
|
|
|
if "FADE" in cfg:
|
|
|
cfg["FADE"] = round(txt,2)
|
|
|
- except e as Exception:
|
|
|
+ except Exception as e:
|
|
|
print("in-Fade Exception",e)
|
|
|
|
|
|
if "out-Fade" in data and type(data["out-Fade"]) is str:
|
|
@@ -1136,7 +1086,7 @@ class MASTER():
|
|
|
try:
|
|
|
txt = float(txt)
|
|
|
cfg["OUT-FADE"] = round(txt,2)
|
|
|
- except e as Exception:
|
|
|
+ except Exception as e:
|
|
|
print("out-Fade Exception",e)
|
|
|
|
|
|
modes.val("CFG-BTN",0)
|
|
@@ -1216,15 +1166,13 @@ class MASTER():
|
|
|
refresher_exec.reset() # = tkrefresh.Refresher()
|
|
|
|
|
|
def _refresh_exec(self,nr=-1):
|
|
|
- s = time.time()
|
|
|
cprint("EXEC.refresh_exec()")
|
|
|
refresher_exec.reset() # = tkrefresh.Refresher()
|
|
|
|
|
|
self._XX +=1
|
|
|
self._nr_ok = 0
|
|
|
- ERR=""
|
|
|
for nr in EXEC.val_exec:
|
|
|
- cfg = get_exec_btn_cfg(nr)
|
|
|
+ get_exec_btn_cfg(nr)
|
|
|
time.sleep(0.01)
|
|
|
|
|
|
def refresh_fix(self):
|
|
@@ -1232,19 +1180,12 @@ class MASTER():
|
|
|
self._refresh_fix_menu()
|
|
|
def _refresh_fix_menu(self):
|
|
|
#cprint("_refresh_fix_menu")
|
|
|
- s=time.time(); _XXX=0
|
|
|
|
|
|
menu_buff = {"DIM":0,"DIM-SUB":0,"FIX":0,"FIX-SUB":0}
|
|
|
|
|
|
- elem_buffer = []
|
|
|
-
|
|
|
for fix in FIXTURES.fixtures:
|
|
|
sdata = FIXTURES.fixtures[fix]
|
|
|
|
|
|
- elem_attr_fix = None
|
|
|
- if fix in self.elem_attr:
|
|
|
- elem_attr_fix = self.elem_attr[fix]
|
|
|
-
|
|
|
if "DIM" in sdata["ATTRIBUT"] and "_ACTIVE" in sdata["ATTRIBUT"] and len(sdata["ATTRIBUT"]) == 2:
|
|
|
KEY = "DIM-SUB"
|
|
|
else:
|
|
@@ -1460,7 +1401,7 @@ class MASTER():
|
|
|
modes.val("REC-FX",0)
|
|
|
modes.val("REC",0)
|
|
|
|
|
|
- cfg = get_exec_btn_cfg(nr)
|
|
|
+ _ = get_exec_btn_cfg(nr)
|
|
|
#master._refresh_exec()
|
|
|
return 1
|
|
|
def exec_edit(self,nr):
|
|
@@ -1476,7 +1417,6 @@ class MASTER():
|
|
|
def exec_select(self,nr):
|
|
|
cprint("Master.exec_select","-- EXEC SELECT ------------------------------")
|
|
|
sdata = EXEC.val_exec[nr]
|
|
|
- cmd = ""
|
|
|
for fix in sdata:
|
|
|
if fix == "CFG":
|
|
|
continue
|
|
@@ -1492,7 +1432,6 @@ class MASTER():
|
|
|
#elem["bg"] = "yellow"
|
|
|
|
|
|
def exec_go(self,nr,val=None,xfade=None,event=None,button="",ptfade=None):
|
|
|
- s=time.time()
|
|
|
t_start = time.time()
|
|
|
if xfade is None and meta.FADE._is():
|
|
|
xfade = meta.FADE.val()
|
|
@@ -1547,11 +1486,7 @@ class MASTER():
|
|
|
self._exec_go(rdata,cfg,fcmd,value,xfade=0,xFLASH=xFLASH)
|
|
|
elif button == "go" or ( modes.val("GO") or ( "BUTTON" in cfg and cfg["BUTTON"] in ["go","GO"])):
|
|
|
fcmd = FIXTURES.update_raw(rdata)
|
|
|
- e=time.time()
|
|
|
- #print("_GO TIME:","{:0.02f}".format(e-s),int(e*10)/10)
|
|
|
self._exec_go(rdata,cfg,fcmd,value,xfade=xfade,xFLASH=xFLASH,ptfade=ptfade,nr=nr)
|
|
|
- e=time.time()
|
|
|
- #print("GO TIME:","{:0.02f}".format(e-s),int(e*10)/10)
|
|
|
return
|
|
|
|
|
|
if not (modes.val("FLASH") or ( "BUTTON" in cfg and cfg["BUTTON"] == "FL")): #FLASH
|
|
@@ -1578,8 +1513,7 @@ class MASTER():
|
|
|
vcmd = execlib.reshape_exec( rdata ,value,xfade=xfade,ptfade=ptfade,DELAY=xdelay)
|
|
|
|
|
|
cmd = []
|
|
|
- delay=0
|
|
|
- for i,v in enumerate(fcmd):
|
|
|
+ for i,_ in enumerate(fcmd):
|
|
|
#print("go",i,v)
|
|
|
if xFLASH:
|
|
|
vcmd[i]["FLASH"] = 1
|
|
@@ -1744,11 +1678,6 @@ class WindowManager():
|
|
|
if cb_ok:
|
|
|
cb_ok()
|
|
|
|
|
|
- resize = 1
|
|
|
- if "resize" in c.args:
|
|
|
- if not c.args["resize"]:
|
|
|
- resize = 0
|
|
|
- #if resize:
|
|
|
libwin.get_cur_window_geo(_filter=name,win=w)
|
|
|
|
|
|
if name in ["ENCODER"]:
|
|
@@ -1835,6 +1764,9 @@ thread.start_new_thread(refresh_exec_mc,())
|
|
|
|
|
|
FIXTURES = fixlib.Fixtures()
|
|
|
|
|
|
+from lib import mc_api
|
|
|
+thread.start_new_thread(mc_api.mc_set_patch_loop,(FIXTURES,))
|
|
|
+
|
|
|
def LOAD_SHOW():
|
|
|
EXEC.load_exec()
|
|
|
FIXTURES.load_patch()
|
|
@@ -1903,7 +1835,6 @@ def open_sdl_window():
|
|
|
|
|
|
thread.start_new_thread(open_sdl_window,())
|
|
|
|
|
|
-mc_fix = MC_FIX()
|
|
|
def mc_fix_loop():
|
|
|
global master
|
|
|
time.sleep(5)
|
|
@@ -1911,17 +1842,16 @@ def mc_fix_loop():
|
|
|
while 1:
|
|
|
try:
|
|
|
if c >= 1:
|
|
|
- #master._refresh_exec()
|
|
|
c=0
|
|
|
for nr in EXEC.val_exec:
|
|
|
- cfg = get_exec_btn_cfg(nr)
|
|
|
+ get_exec_btn_cfg(nr)
|
|
|
except Exception as e:
|
|
|
print("MC_FIX EXCEPTION",e)
|
|
|
#raise e
|
|
|
c+=1
|
|
|
try:
|
|
|
data = FIXTURES.fixtures
|
|
|
- mc_fix.set(index="fix",data=data)
|
|
|
+ mc_api.mc_set_fix(index="fix",data=data)
|
|
|
except Exception as e:
|
|
|
print("MC_FIX EXCEPTION",e)
|
|
|
time.sleep(1/10)
|