Quellcode durchsuchen

fix: sdl-fix missing ZOOM (rr>1000), FIX-EDITOR XX-FINE

micha vor 7 Monaten
Ursprung
Commit
d6b0ca1ce8
3 geänderte Dateien mit 50 neuen und 12 gelöschten Zeilen
  1. 14 3
      lib/libtk.py
  2. 25 7
      tkgui/fix.py
  3. 11 2
      tksdl/fix.py

+ 14 - 3
lib/libtk.py

@@ -86,6 +86,10 @@ class ELEM_FADER():
         self.elem = []
         self._cb = cb
         self._fader_cb = fader_cb
+        self.width = 0
+        if "width" in args:
+            self.width = int(args["width"])
+
         width=11
         frameS = tk.Frame(self.frame,bg="#005",width=width)
         frameS.pack(fill=tk.Y, side=tk.LEFT)
@@ -111,7 +115,12 @@ class ELEM_FADER():
                 self._cb([self,"set_nr",txt])
         dialog._cb = _cb
         dialog.askstring("ATTR","set NR:",initialvalue=txt)
-
+    def _check_fine(self,txt):
+        if txt.endswith(" FINE"):
+            txt = txt.replace(" FINE","-FINE")
+        while " -" in txt:
+            txt = txt.replace(" -","-")
+        return txt
     def set_attr(self,_event=None):
         txt= self.attr["text"]
         def _cb(data):
@@ -119,8 +128,10 @@ class ELEM_FADER():
                 print("err443",self,"_cb",data)
                 return None
             txt = data["Value"]
+            txt = self._check_fine(txt)
             #print(self,"set_attr._cb()",txt)
             self._set_attr(txt)
+
             if self._cb:
                 self._cb([self,"set_attr",txt])
         dialog._cb = _cb
@@ -199,13 +210,13 @@ class ELEM_FADER():
         j=0
         self.font8 = ("FreeSans",8)
         frameS=self.frame
-
+        w = self.width 
         self.b = tk.Button(frameS,bg="#ffa",text="{}".format(self.nr), width=4,command=test_command,font=self.font8 )
         self.b.pack(fill=tk.BOTH, side=tk.TOP)
         self.label = self.b
         self.elem.append(self.b)
         
-        self.b = tk.Scale(frameS,bg="#ffa", width=28,from_=from_,to=to,command=self.fader_event)
+        self.b = tk.Scale(frameS,bg="#ffa", width=28+w,from_=from_,to=to,command=self.fader_event)
         self.elem_fader = self.b
         self.b.pack(fill=tk.Y, side=tk.TOP)
         if init is not None:

+ 25 - 7
tkgui/fix.py

@@ -267,10 +267,10 @@ class GUI_FixtureEditor():
 
         self.r=0
         self.c=0
-        self.pb=12
+        self.pb=10
         self.j = 0
 
-        for page_nr in range(12):
+        for page_nr in range(10):
             self.draw_bank(page_nr)
 
         self._event_redraw()
@@ -303,7 +303,7 @@ class GUI_FixtureEditor():
                     frameS = tk.Frame(self.frame,bg="#a0aadd",width=width,border=2)
                 self.c=0
 
-            e= libtk.ELEM_FADER(frameS,nr=j+1,cb=self._cb,fader_cb=self._fader_cb)
+            e= libtk.ELEM_FADER(frameS,nr=j+1,cb=self._cb,fader_cb=self._fader_cb,width=14)
             e.pack()
             #e.attr["bg"] = "red"
             self.fader_elem.append(e)
@@ -341,6 +341,13 @@ class GUI_FixtureEditor():
         #print(" FixtureEditor._cb")
         #print(" ",name,"_cb.args >>",args,arg[1:])
         self.count_ch()
+        elm,mode,name = arg    
+        #print("_cb",arg)
+        if mode == "set_attr":
+            #print(" ->")
+            if name.endswith(" FINE"):
+                name = name.replace(" FINE","-FINE")
+                elm.label["text"] = name
     
 
     def count_ch(self):
@@ -357,10 +364,13 @@ class GUI_FixtureEditor():
                 #print("count_ch:",i,txt)
                 if txt.startswith("EMPTY"):
                     elem.attr["bg"] = "#fa0"
-                    elem.attr["activebackground"] = "#fa0"
+                    elem.attr["activebackground"] = "#ff0"
+                elif txt.endswith("-FINE"):
+                    elem.attr["bg"] = "#0b0"
+                    elem.attr["activebackground"] = "#ff0"
                 else:
                     elem.attr["bg"] = "#0f0"
-                    elem.attr["activebackground"] = "#0fa"
+                    elem.attr["activebackground"] = "#ff0"
                 ch_s.append([i,txt])
                 j=i
             else:
@@ -522,6 +532,7 @@ class GUI_FixtureEditor():
             print("set_fixid",[_event,self])
         dialog._cb = _cb
         dialog.askstring("FIXTURE ID:","ID:",initialvalue=txt)
+
     def set_name(self,_event=None):
         txt = self.name["text"]
         def _cb(data):
@@ -619,11 +630,18 @@ class GUI_FixtureEditor():
                             except:
                                 n.append("-") 
                             
-                            a.append(at ) #+":"+ str(fixture["ATTRIBUT"][at]["NR"]))
+                            at2 = at
+                            if at2.endswith(" FINE"):
+                                at2 = at2.replace(" FINE","-FINE")
+                            while " -" in at2:
+                                at2 = at2.replace(" -","-")
+                            at2 = at2.replace("  "," ")
+                            a.append(at2 ) #+":"+ str(fixture["ATTRIBUT"][at]["NR"]))
 
                             if at.endswith("-FINE"):
                                 m.append("-")
-                            elif at in MAIN._FIX_FADE_ATTR: #["PAN","TILT","DIM","RED","GREEN","BLUE","CYAN","YELLOW","MAGENTA","FOCUS","ZOOM","FROST"]:
+                            elif at in MAIN._FIX_FADE_ATTR: 
+                                #["PAN","TILT","DIM","RED","GREEN","BLUE","CYAN","YELLOW","MAGENTA","FOCUS","ZOOM","FROST"]:
                                 m.append("F")
                             else:
                                 m.append("S")

+ 11 - 2
tksdl/fix.py

@@ -565,6 +565,7 @@ while 1:
                             pygame.draw.rect(window,[58,58,58],[2,r,2000,25])
                     except:pass
                     bx.text = "ID:"+ k 
+
                     bx.text += " "+v["NAME"]
                     bx.font0 = bx_font0
                     bx.btn1.bg_on = [0,255,255]
@@ -572,6 +573,11 @@ while 1:
                     bx.pos  = [10+10,r,BTN_WIDTH,20]
 
                     if "ATTRIBUT" in v:
+                        try: # info
+                            if int(k) == 12001:
+                                #print("   ",k,k2,k2_ATTR)
+                                print("-",v["ATTRIBUT"].keys())
+                        except: pass
                         bcv_r = 0
                         bcv_g = 0
                         bcv_b = 0
@@ -611,6 +617,8 @@ while 1:
                         for k2 in ATTR:
                             k2_ATTR = ATTR[k2]
 
+
+
                             if is_hidden_attr(k2):
                                 continue
 
@@ -630,6 +638,7 @@ while 1:
                             if "VALUE2"in k2_ATTR:
                                 dmx_val = k2_ATTR["VALUE2"]
 
+
                             if k3 not in table_grid:
                                 bx = sdl_elm.Button(window,pos=[600,rr,60,20])
                                 bx.btn1.color_on = [255,255,0]
@@ -640,6 +649,7 @@ while 1:
                                 table_grid[k3] = bx
 
 
+
                             if "ACTIVE" in k2_ATTR:
                                 if k2_ATTR["ACTIVE"] >=1:
                                     table_grid[k3].btn1.val.set(1)
@@ -675,8 +685,7 @@ while 1:
                             
 
                             table_grid_draw.append(k3) #table_grid[k3]
-                            if rr > 1000:
-                                break
+
                             acount +=1
                             if acount %block_wrap==0:
                                 r += r_buf