Sfoglia il codice sorgente

fix: FixtureEditor -IMPORT, -USER, -GLOBAL dialog

micha 1 anno fa
parent
commit
04f95df84e
2 ha cambiato i file con 28 aggiunte e 19 eliminazioni
  1. 21 14
      _LibreLightDesk.py
  2. 7 5
      tkgui/GUI.py

+ 21 - 14
_LibreLightDesk.py

@@ -3181,7 +3181,7 @@ def _fixture_create_import_list():
     path = "/home/user/LibreLight/show"
     blist = []
     for sname in os.listdir(path):
-        print("   ",sname)
+        #print("   ",sname)
         try:
             fname = path+"/"+sname+"/patch.sav"
             if os.path.isfile(fname):
@@ -3192,16 +3192,18 @@ def _fixture_create_import_list():
                 for line in lines:
                     line = line.split("\t")
                     line = json.loads(line[2])
-                    print(line)
+                    #print(line)
                     name = line["NAME"]
                     blist.append([name,fname+":"+name,path])
-                    print(":",i,name,fname)
+                    #blist.append([name,fname,path])
+                    #print(":",i,name,fname)
         except Exception as e:
             print("exception",e)
     return blist
 
 def _fixture_load_import_list():
     return _fixture_create_import_list()
+
     pass
     path = HOME+"/LibreLight/fixture.index.json"
     if not os.path.isfile(path):
@@ -3218,6 +3220,7 @@ def _fixture_load_import_list():
         lines = f.readlines()
         f.close()
         for line in lines:
+            print("_fixture_load__import",line)
             line = line.strip()
             blist.append(json.loads(line))
 
@@ -3231,7 +3234,7 @@ def _fixture_load_data(path,number):
 
 
 class _LOAD_FIXTURE_LIST():
-    def __init__(self,mode="<name>"):
+    def __init__(self,mode="<mode>"):
         self.mode = mode
         self.data = []
     def get(self,frame,cb=None,master=None,bg="black"):
@@ -3248,18 +3251,19 @@ class _LOAD_FIXTURE_LIST():
         blist = self.data
 
         if self.mode == "USER":
-            r=_fixture_load_user_list() 
-            blist.extend( r )
+            _r=_fixture_load_user_list() 
+            blist.extend( _r )
 
         elif self.mode == "GLOBAL":
-            r=_fixture_load_global_list() 
-            blist.extend( r )
+            _r=_fixture_load_global_list() 
+            blist.extend( _r )
 
         elif self.mode == "IMPORT":
-            r=_fixture_load_import_list() 
-            blist.extend( r )
+            _r=_fixture_load_import_list() 
+            #_r=[["1","2","3"],["A","B","C"]]
+            blist.extend( _r )
 
-        print("BLIST",blist)
+        #print("BLIST",blist[:3^])
 
         if cb is None: 
             cb = DummyCallback #("load_show_list.cb")
@@ -3267,9 +3271,9 @@ class _LOAD_FIXTURE_LIST():
         _tmp_name = ""
         _tmp_flag = 0
 
-        blist = blist[:50]
+        blist = blist[:10]
         for i in blist:
-            #print(i)
+            #print("i",i)
             if i[0] != _tmp_name:
                 _tmp_flag = "#aaf"
                 if i[0] == "user":
@@ -3279,6 +3283,7 @@ class _LOAD_FIXTURE_LIST():
 
             c=0
             for j in i:
+                #print("j",j)#,i[j])
                 bg="lightgrey"
                 dbg="lightgrey"
                 if i[1] > time.strftime("%Y-%m-%d %X",  time.localtime(time.time()-3600*4)):
@@ -3300,7 +3305,9 @@ class _LOAD_FIXTURE_LIST():
                     if base.show_name == i[0]:
                         b.config(activebackground=bg)
                     b.grid(row=r, column=c, sticky=tk.W+tk.E)
-                else:#ief c > 0:
+                else: #ief c > 0:
+                    #print("OWKFDLKFDLFKDLFK ")
+                    #print([j,c,r])
                     b = tk.Button(frame,text=j,anchor="w",bg=dbg,relief="sunken")
                     b.config(activebackground=dbg)
                     b.grid(row=r, column=c, sticky=tk.W+tk.E)

+ 7 - 5
tkgui/GUI.py

@@ -848,6 +848,7 @@ class GUI_FixtureEditor():
         self.b = tk.Button(self.frame,bg="lightblue",text="USER", width=5)#,command=self.event) #bv.change_dmx)
         self.b["command"] = self.open_fixture_list_user
         self.b.pack( side=tk.LEFT)
+
         self.b = tk.Button(self.frame,bg="lightblue",text="GLOBAL", width=5)#,command=self.event) #bv.change_dmx)
         self.b["command"] = self.open_fixture_list_global
         self.b.pack( side=tk.LEFT)
@@ -954,7 +955,7 @@ class GUI_FixtureEditor():
             nr = args["nr"] #.nr
             j=[]
             jdata = {'VALUE': int(a1), 'args': [] , 'FADE': 0,'DMX': str(nr)}
-            print("   ",jdata)
+            ##print("   ",jdata)
             j.append(jdata)
             jclient_send(j)
         except Exception as e:
@@ -962,12 +963,13 @@ class GUI_FixtureEditor():
             print(e)
 
     def _cb(self,arg,name="<name>",**args):
-        print(" FixtureEditor._cb")
-        print(" ",name,"_cb.args >>",args,arg[1:])
+        #print(" FixtureEditor._cb")
+        #print(" ",name,"_cb.args >>",args,arg[1:])
         self.count_ch()
     
 
     def count_ch(self):
+        #print("FixtureEditor.count_ch:")
         #e._set_attr( "---")
         ch_s = []
         j=-1
@@ -977,7 +979,7 @@ class GUI_FixtureEditor():
             #print(dir(elem))
             txt = elem.attr["text"]
             if txt:
-                print("count_ch:",i,txt)
+                #print("count_ch:",i,txt)
                 elem.attr["bg"] = "#0f0"
                 elem.attr["activebackground"] = "#0fa"
                 ch_s.append([i,txt])
@@ -1035,7 +1037,7 @@ class GUI_FixtureEditor():
 
         def cb(**args):
             print("open_fixture_list")
-            self._cb(args,name="open_fixture_list") 
+            #self._cb(args,name="open_fixture_list") 
             if self.pw:
                 self.pw.w.tk.destroy()
             #self.load_EMPTY()