|
@@ -66,10 +66,11 @@ class LOCK_BUF():
|
|
|
|
|
|
|
|
|
node_list = LOCK_BUF() #[]
|
|
|
-
|
|
|
+csel = 0
|
|
|
def fill_form(event=None):
|
|
|
cprint(sys._getframe().f_code.co_name,color="yellow")
|
|
|
- global node_list
|
|
|
+ global node_list,csel
|
|
|
+
|
|
|
clear_form()
|
|
|
|
|
|
node_list2 = node_list.get()
|
|
@@ -101,7 +102,7 @@ def fill_form(event=None):
|
|
|
e_mac2.delete("0","end")
|
|
|
e_mac2.insert("end",node_list2[sel]["MAC"].split(":")[-1])
|
|
|
|
|
|
- print("load",node_list2[sel])
|
|
|
+ #print("load",node_list2[sel])
|
|
|
e_lname.delete("0","end")
|
|
|
e_lname.insert("end",node_list2[sel]["lname"])
|
|
|
e_sname.delete("0","end")
|
|
@@ -154,8 +155,8 @@ def poll(delay=1,ip=""):
|
|
|
cprint("err poll() no ip !",color="red")
|
|
|
return
|
|
|
|
|
|
- b_scan.insert("end", "ArtNetPoll -> "+str(ip)+"\n")
|
|
|
- b_scan.yview("end")
|
|
|
+ log_text.insert("end", "ArtNetPoll -> "+str(ip)+"\n")
|
|
|
+ log_text.yview("end")
|
|
|
nodescan2.ArtPoll(ip=ip)
|
|
|
nodes = load_node_list()
|
|
|
refresh_node_list(nodes)
|
|
@@ -167,7 +168,7 @@ import nodescan2
|
|
|
def load_node_list():
|
|
|
cprint(sys._getframe().f_code.co_name,"------------",color="yellow")
|
|
|
global node_list,Scrollbar,mc
|
|
|
- li_nodes.delete("0","end")
|
|
|
+ #li_nodes.delete("0","end")
|
|
|
|
|
|
ips = nodescan2.os_list_ip() #example
|
|
|
|
|
@@ -175,6 +176,7 @@ def load_node_list():
|
|
|
if not mc:
|
|
|
cprint("mc (memcached) is none",color="red")
|
|
|
mc = connect_mc()
|
|
|
+ node_list.set([])
|
|
|
return
|
|
|
|
|
|
nodes = []
|
|
@@ -182,6 +184,7 @@ def load_node_list():
|
|
|
if not artpoll:
|
|
|
cprint("mc.get('index-artpoll') is none ",color="red")
|
|
|
mc = connect_mc()
|
|
|
+ node_list.set([])
|
|
|
return
|
|
|
|
|
|
for k in artpoll:
|
|
@@ -206,18 +209,23 @@ def load_node_list():
|
|
|
ok=1
|
|
|
|
|
|
return node_list
|
|
|
-
|
|
|
+
|
|
|
+old_node_listbox = []
|
|
|
+
|
|
|
def refresh_node_list(nodes):
|
|
|
cprint(sys._getframe().f_code.co_name,color="yellow")
|
|
|
- li_nodes.delete("0","end")
|
|
|
- li_nodes.insert("end"," - none -")
|
|
|
+ global csel,old_node_listbox
|
|
|
+
|
|
|
|
|
|
node_nr = 1
|
|
|
nodesB = {}
|
|
|
for node in node_list.get(): #nodes:
|
|
|
k = node["MAC"]
|
|
|
nodesB[k] = node
|
|
|
-
|
|
|
+
|
|
|
+ if not nodesB:
|
|
|
+ li_nodes.delete("0","end")
|
|
|
+ li_nodes.insert("end"," - none -")
|
|
|
|
|
|
k_sort = list(nodesB.keys())
|
|
|
k_sort.sort()
|
|
@@ -232,35 +240,37 @@ def refresh_node_list(nodes):
|
|
|
print(" ",k)
|
|
|
node = nodesB[k]
|
|
|
|
|
|
- txt = " "*5 + "="*30
|
|
|
+ txt = str(node_nr).rjust(3," ") +" " + "-"*30
|
|
|
bg=""
|
|
|
out.append({"txt":txt,"bg":bg})
|
|
|
|
|
|
- bg = "lightgrey"
|
|
|
- txt = str(node_nr).rjust(3," ") +" "+ node["lname"]
|
|
|
- out.append({"txt":txt,"bg":bg})
|
|
|
+ bg = "white" #lightgrey"
|
|
|
+ fg = ""
|
|
|
+ #bg = "blue"
|
|
|
+ #fg = "white"
|
|
|
+ txt = str(node_nr).rjust(3," ") +" L-Name:"+ node["lname"]
|
|
|
+ out.append({"txt":txt,"bg":bg,"fg":fg})
|
|
|
+
|
|
|
+ #bg = "blue"
|
|
|
+ #fg = "white"
|
|
|
+ txt = str(node_nr).rjust(3," ") +" S-Name:"+ node["sname"]
|
|
|
+ out.append({"txt":txt,"bg":bg,"fg":fg})
|
|
|
|
|
|
- ip = str(node_nr).rjust(3," ") +" "+ node["IP"]
|
|
|
bg = ""
|
|
|
+ txt = str(node_nr).rjust(3," ") +" "+ node["IP"]
|
|
|
if "PortTypes" in node:
|
|
|
+ #print("-----", node["PortTypes"], node["PortTypes"][0] ,node["PortTypes"][0] == b"@")
|
|
|
if not node["PortTypes"]:
|
|
|
pass
|
|
|
- if node["PortTypes"][0] == "@":
|
|
|
- ip += " DMX-in"
|
|
|
+ if node["PortTypes"][0] == 64: #b"@":
|
|
|
+ txt += " DMX-in"
|
|
|
bg ="yellow"
|
|
|
else:
|
|
|
- ip += " DMX-out"
|
|
|
+ txt += " DMX-out"
|
|
|
bg ="lightgreen"
|
|
|
-
|
|
|
- txt = str(node_nr).rjust(3," ") +" short Name:"+ node["sname"]
|
|
|
- out.append({"txt":txt,"bg":bg})
|
|
|
-
|
|
|
- txt=ip
|
|
|
- bg = ""
|
|
|
out.append({"txt":txt,"bg":bg})
|
|
|
|
|
|
- inout = " UNIVERS OUT="+ str(ord(node["SwOut"][0:1]))+" IN="+ str(ord(node["SwIn"][0:1]))
|
|
|
- txt = str(node_nr).rjust(3," ") + inout
|
|
|
+ txt = str(node_nr).rjust(3," ") + " UNIVERS OUT="+ str(ord(node["SwOut"][0:1]))+" IN="+ str(ord(node["SwIn"][0:1]))
|
|
|
bg = ""
|
|
|
out.append({"txt":txt,"bg":bg})
|
|
|
|
|
@@ -306,6 +316,9 @@ def refresh_node_list(nodes):
|
|
|
out.append({"txt":"","bg":"white"})
|
|
|
|
|
|
# insert nodes in listbox
|
|
|
+ if out == old_node_listbox:
|
|
|
+ return
|
|
|
+ old_node_listbox = out[:]
|
|
|
if out:
|
|
|
li_node_scroll = li_nodes.yview()
|
|
|
li_nodes.delete("0","end")
|
|
@@ -313,10 +326,16 @@ def refresh_node_list(nodes):
|
|
|
#print("list:",i)
|
|
|
li_nodes.insert("end",i["txt"])
|
|
|
bg=i["bg"]
|
|
|
+ fg="black"
|
|
|
+ if "fg" in i:
|
|
|
+ fg=i["fg"]
|
|
|
if not bg:
|
|
|
bg = "lightgrey"
|
|
|
- bg = "#ddd"
|
|
|
- li_nodes.itemconfig("end", bg=bg)
|
|
|
+ bg = "" ##ddd"
|
|
|
+ li_nodes.itemconfig("end", bg=bg,fg=fg)
|
|
|
+ print(csel)
|
|
|
+ #li_nodes.yview(li_node_scroll )
|
|
|
+ li_nodes.selection_set(csel)
|
|
|
|
|
|
|
|
|
|
|
@@ -434,8 +453,8 @@ def send_artdmx(val=127):
|
|
|
import lib.ArtNetNode as an
|
|
|
if form["IP2"] and form["univ"]:
|
|
|
#artnet = an.ArtNetNode(to=form["netmask"],univ=form["univ"],port=4566)
|
|
|
- b_scan.insert("end", "ArtDMX -> "+str(form["IP2"])+" univ:"+str(form["univ"])+" v="+ str(val)+"\n")
|
|
|
- b_scan.yview("end")
|
|
|
+ log_text.insert("end", "ArtDMX -> "+str(form["IP2"])+" univ:"+str(form["univ"])+" v="+ str(val)+"\n")
|
|
|
+ log_text.yview("end")
|
|
|
artnet = an.ArtNetNode(to=form["IP2"],univ=form["univ"],port=4566)
|
|
|
artnet.send([val]*512,port=6454)
|
|
|
print(artnet._data)
|
|
@@ -531,7 +550,7 @@ def set_node_out(evnet=None):
|
|
|
# TK-WINDOW
|
|
|
# ----------------------------------------------
|
|
|
root = Tkinter.Tk()
|
|
|
-root.geometry("700x600+100+100")
|
|
|
+root.geometry("650x600+100+100")
|
|
|
root.title( title)
|
|
|
|
|
|
fframe = Tkinter.Frame(root)
|
|
@@ -545,17 +564,17 @@ font3 = ("Helvetica", 12) # 16
|
|
|
font20 = font=("Helvetica", 12) # 22
|
|
|
font120 = font=("Helvetica", 22) # 22
|
|
|
|
|
|
-b_scan = Tkinter.Button(fframe,text="refresh",width=8,command=poll,font=font2)
|
|
|
-b_scan.pack(side="left",expand=0,fill="y")
|
|
|
+log_text = Tkinter.Button(fframe,text="refresh",width=8,command=poll,font=font2)
|
|
|
+log_text.pack(side="left",expand=0,fill="y")
|
|
|
|
|
|
-b_scan = Tkinter.Button(fframe,text="ArtNetPoll ->",width=10,command=poll,font=font2)
|
|
|
-b_scan.configure(bg="#0f0")
|
|
|
+log_text = Tkinter.Button(fframe,text="ArtNetPoll ->",width=10,command=poll,font=font2)
|
|
|
+log_text.configure(bg="#0f0")
|
|
|
|
|
|
|
|
|
scrollbar = Tkinter.Scrollbar(cframe)
|
|
|
-scrollbar.pack(side=Tkinter.RIGHT, fill="y")
|
|
|
+scrollbar.pack(side=Tkinter.LEFT, fill="y")
|
|
|
|
|
|
-li_nodes = Tkinter.Listbox(cframe,exportselection=0,width=35,font=font1)
|
|
|
+li_nodes = Tkinter.Listbox(cframe,exportselection=0,width=35,font=font1,height=16)
|
|
|
li_nodes.pack(side="left",expand=0,fill="y")
|
|
|
li_nodes.bind("<ButtonRelease-1>",fill_form )
|
|
|
|
|
@@ -600,21 +619,21 @@ c.pack(side="left",expand=0,fill="y")
|
|
|
line_frame = Tkinter.Frame(eframe)
|
|
|
line_frame.pack(side="top",expand=0,fill="x")
|
|
|
Tkinter.Label(line_frame,text="OLD IP:",font=font3,width=6).pack(side="left",expand=0,fill="y")
|
|
|
-e_ip = Tkinter.Entry(line_frame,font=font20,width=26,state="disabled")
|
|
|
+e_ip = Tkinter.Entry(line_frame,font=font20,width=16,state="disabled")
|
|
|
e_ip["bg"] = "lightgrey"
|
|
|
e_ip.pack(side="left")
|
|
|
|
|
|
-b_scan = Tkinter.Button(line_frame,text="clean",font=font2,relief="flat",command=clear_form)
|
|
|
-b_scan.pack(side="left",expand=0)
|
|
|
-#b_scan = Tkinter.Button(line_frame,width=14,font=font3)
|
|
|
-#b_scan.pack(side="left",expand=1)
|
|
|
+log_text = Tkinter.Button(line_frame,text="clean",font=font2,relief="flat",command=clear_form)
|
|
|
+log_text.pack(side="left",expand=0)
|
|
|
+#log_text = Tkinter.Button(line_frame,width=14,font=font3)
|
|
|
+#log_text.pack(side="left",expand=1)
|
|
|
|
|
|
# ----------------------------------------------
|
|
|
line_frame = Tkinter.Frame(eframe)
|
|
|
line_frame.pack(side="top",expand=0,fill="x")
|
|
|
e_ip_label = Tkinter.Label(line_frame,text=" IP:",font=font3,width=6)
|
|
|
e_ip_label.pack(side="left",expand=0,fill="y")
|
|
|
-e_ip_new = Tkinter.Entry(line_frame,font=font20,width=26)
|
|
|
+e_ip_new = Tkinter.Entry(line_frame,font=font20,width=16)
|
|
|
e_ip_new.bind("<Return>", set_ip )
|
|
|
e_ip_new.bind("<KP_Enter>", set_ip)
|
|
|
e_ip_new.bind("<ISO_Left_Tab>", set_ip)
|
|
@@ -630,29 +649,30 @@ variable.set("255.0.0.0") # default value
|
|
|
Tkinter.Label(line_frame,text="MASK:",font=font3,width=6).pack(side="left",expand=0,fill="y")
|
|
|
e_mask_new = Tkinter.OptionMenu(line_frame, variable,"255.255.255.0","255.0.0.0") #,width=10)
|
|
|
e_mask_new.configure(font=("Helvetica", 12))
|
|
|
-e_mask_new.configure(width=12)
|
|
|
+e_mask_new.configure(width=13)
|
|
|
e_mask_new["bg"] = "#fff"
|
|
|
e_mask_new.pack(side="left")
|
|
|
-e=Tkinter.Label(line_frame,text="")
|
|
|
-e.configure(width=11)
|
|
|
-e.pack(side="left")
|
|
|
+#e=Tkinter.Label(line_frame,text="")
|
|
|
+#e.configure(width=1)
|
|
|
+#e.pack(side="left")
|
|
|
|
|
|
-b_scan = Tkinter.Button(line_frame,text="SEND TO NODE",command=set_ip,width=14,font=font1)
|
|
|
-b_scan.pack(side="left",expand=0)
|
|
|
+log_text = Tkinter.Button(line_frame,text="SEND TO NODE",bg="lightgreen",command=set_ip,width=13,font=font1)
|
|
|
+log_text.pack(side="left",expand=0)
|
|
|
|
|
|
#-------------------------------------------- line
|
|
|
line_frame = Tkinter.Frame(eframe)
|
|
|
line_frame.pack(side="top",expand=0,fill="x")
|
|
|
Tkinter.Label(line_frame,text="MAC:",font=font3,width=6).pack(side="left",expand=0,fill="y")
|
|
|
-e_mac = Tkinter.Entry(line_frame,width=23,font=font20)
|
|
|
+e_mac = Tkinter.Entry(line_frame,width=13,font=font20)
|
|
|
e_mac.pack(side="left")
|
|
|
e_mac["bg"] = "lightgrey"
|
|
|
|
|
|
e_mac2 = Tkinter.Entry(line_frame,width=3,font=font20)
|
|
|
e_mac2.pack(side="left")
|
|
|
+e_mac2.config(bg="orange")
|
|
|
e_mac2.bind("<Return>", send_mac )
|
|
|
e_mac2.bind("<KP_Enter>", send_mac)
|
|
|
-Tkinter.Button(line_frame,text="SEND TO NODE",command=send_mac,width=14,font=font1).pack(side="left",expand=0)
|
|
|
+Tkinter.Button(line_frame,text="SEND TO NODE !",bg="orange",command=send_mac,width=14,font=font1).pack(side="left",expand=0)
|
|
|
# ----------------------------------------------
|
|
|
line_frame = Tkinter.Frame(eframe)
|
|
|
line_frame.pack(side="top",expand=0,fill="x")
|
|
@@ -664,12 +684,12 @@ c.pack(side="left",expand=0,fill="y")
|
|
|
line_frame = Tkinter.Frame(eframe)
|
|
|
line_frame.pack(side="top",expand=0,fill="x")
|
|
|
Tkinter.Label(line_frame,text="DMX:",font=font3,width=6).pack(side="left",expand=0,fill="y")
|
|
|
-b_set_node_pin = Tkinter.Button(line_frame,text="HW-PIN",command=set_node_pin,width=6,font=font3)
|
|
|
+b_set_node_pin = Tkinter.Button(line_frame,text="HW-PIN",bg="orange",command=set_node_pin,width=5,font=font3)
|
|
|
b_set_node_pin.pack(side="left",expand=0)
|
|
|
-b_set_node_in = Tkinter.Button(line_frame,text="IN",command=set_node_in,width=6,font=font3)
|
|
|
+b_set_node_in = Tkinter.Button(line_frame,text="IN",bg="orange",command=set_node_in,width=2,font=font3)
|
|
|
b_set_node_in.pack(side="left",expand=0)
|
|
|
|
|
|
-b_set_node_out = Tkinter.Button(line_frame,text="OUT",command=set_node_out,width=6,font=font3)
|
|
|
+b_set_node_out = Tkinter.Button(line_frame,text="OUT",bg="orange",command=set_node_out,width=2,font=font3)
|
|
|
b_set_node_out.pack(side="left",expand=0)
|
|
|
|
|
|
|
|
@@ -678,7 +698,7 @@ b_set_node_out.pack(side="left",expand=0)
|
|
|
line_frame = Tkinter.Frame(eframe)
|
|
|
line_frame.pack(side="top",expand=0,fill="x")
|
|
|
Tkinter.Label(line_frame,text="CMD",font=font3,width=6).pack(side="left",expand=0,fill="y")
|
|
|
-e_cmd = Tkinter.Entry(line_frame,font=font3,width=26)
|
|
|
+e_cmd = Tkinter.Entry(line_frame,font=font3,width=16)
|
|
|
CMD="" #DMX OUT STORE"
|
|
|
c=SEND_CMD(CMD,entry=e_cmd)
|
|
|
e_cmd.bind("<Return>", c )
|
|
@@ -688,14 +708,14 @@ e_cmd.pack(side="left")
|
|
|
line_frame = Tkinter.Frame(eframe)
|
|
|
line_frame.pack(side="top",expand=0,fill="x")
|
|
|
Tkinter.Label(line_frame,text="LName",font=font3,width=6).pack(side="left",expand=0,fill="y")
|
|
|
-e_lname = Tkinter.Entry(line_frame,font=font3,width=26)
|
|
|
+e_lname = Tkinter.Entry(line_frame,font=font3,width=16)
|
|
|
e_lname.pack(side="left")
|
|
|
|
|
|
#-------------------------------------------- line
|
|
|
line_frame = Tkinter.Frame(eframe)
|
|
|
line_frame.pack(side="top",expand=0,fill="x")
|
|
|
Tkinter.Label(line_frame,text="SName",font=font3,width=6).pack(side="left",expand=0,fill="y")
|
|
|
-e_sname = Tkinter.Entry(line_frame,font=font3,width=26)
|
|
|
+e_sname = Tkinter.Entry(line_frame,font=font3,width=16)
|
|
|
e_sname.pack(side="left")
|
|
|
#-------------------------------------------- line
|
|
|
line_frame = Tkinter.Frame(eframe)
|
|
@@ -710,11 +730,11 @@ e_artnet_uni1.pack(side="left")
|
|
|
Tkinter.Label(line_frame,text="UNI:",font=font3,width=4).pack(side="left",expand=0,fill="y")
|
|
|
e_artnet_uni1 = Tkinter.Entry(line_frame,font=font3,width=4)
|
|
|
e_artnet_uni1.pack(side="left")
|
|
|
-Tkinter.Button(line_frame,text="send ArtAddr",command=send_artaddr,width=14,font=font1).pack(side="left",expand=0)
|
|
|
+Tkinter.Button(line_frame,text="send ArtAddr",bg="lightgreen",command=send_artaddr,width=14,font=font1).pack(side="left",expand=0)
|
|
|
#-------------------------------------------- line
|
|
|
|
|
|
-b_scan = Tkinter.Text(eframe,width=20,font=font2)
|
|
|
-b_scan.pack(side="top",expand=1,fill="x")
|
|
|
+log_text = Tkinter.Text(eframe,width=10,font=font2)
|
|
|
+log_text.pack(side="top",expand=1,fill="x")
|
|
|
|
|
|
|
|
|
|
|
@@ -788,7 +808,7 @@ e_cmd5.pack(side="left")
|
|
|
|
|
|
def network_listenet():
|
|
|
cprint(sys._getframe().f_code.co_name,color="yellow")
|
|
|
- b_scan.insert("end", "log:\n" )
|
|
|
+ log_text.insert("end", "log:\n" )
|
|
|
while 1:
|
|
|
#print(".")
|
|
|
if nodescan2.node_cmd_buf_list:
|
|
@@ -799,10 +819,10 @@ def network_listenet():
|
|
|
stamp = str(time.time())+"\n"
|
|
|
stamp = time.strftime("%Y-%m-%d %X\n")
|
|
|
|
|
|
- b_scan.insert("end",stamp)
|
|
|
- b_scan.insert("end", msg +"\n")
|
|
|
+ log_text.insert("end",stamp)
|
|
|
+ log_text.insert("end", msg +"\n")
|
|
|
|
|
|
- b_scan.see("end")
|
|
|
+ log_text.see("end")
|
|
|
time.sleep(0.1)
|
|
|
|
|
|
|