소스 검색

add: RAY- and R- sdl_store WINDOW

micha 4 달 전
부모
커밋
b9b0c4fd67
5개의 변경된 파일108개의 추가작업 그리고 68개의 파일을 삭제
  1. 25 0
      _LibreLightDesk.py
  2. 2 8
      tkray/dmx.py
  3. 68 55
      tkray/fix.py
  4. 8 1
      tool/movewin.py
  5. 5 4
      tool/tk_elm.py

+ 25 - 0
_LibreLightDesk.py

@@ -2014,6 +2014,7 @@ if __run_main:
     data.append({"text":"SDL-MIDI"})
     data.append({"text":"CLOCK"})
     data.append({"text":"RAY-DMX"})
+    data.append({"text":"R-FIX-LIST"})
     data.append({"text":"SDL-DMX"})
     data.append({"text":"SDL-VPU"})
     data.append({"text":"SDL-OSZI"})
@@ -2173,6 +2174,30 @@ if __run_main:
     cls = sdl_config #: None #GUI_CONF
     cb_ok = None
 
+    c = window_create_sdl_buffer(args=args,cls=cls,data=data,cb_ok=cb_ok,gui=master,scroll=1)
+    window_manager.new(None,name,wcb=c)
+    if libwin.split_window_show(pos_list,_filter=name):
+        window_manager.top(name)
+
+    # =======================================================================
+    name="R-FIX-LIST"
+    def sdl_config():
+        cmd="/usr/bin/python3 /opt/LibreLight/Xdesk/tkray/fix.py " #&"
+        print(cmd)
+
+        def xyz123(cmd):
+            os.system(cmd)
+        thread.start_new_thread(xyz123,(cmd,))
+        return [None,None,None]
+    args = {"title":name,"master":0,"width":W1,"height":H1,"left":L1,"top":TOP}
+    geo = libwin.split_window_position(pos_list,name)
+    if geo:
+        args.update(geo)
+
+    data = []
+    cls = sdl_config #: None #GUI_CONF
+    cb_ok = None
+
     c = window_create_sdl_buffer(args=args,cls=cls,data=data,cb_ok=cb_ok,gui=master,scroll=1)
     window_manager.new(None,name,wcb=c)
     if libwin.split_window_show(pos_list,_filter=name):

+ 2 - 8
tkray/dmx.py

@@ -4,15 +4,9 @@ import pyray
 #import raylib as pyray
 import sys
 sys.path.insert(0,"/opt/LibreLight/Xdesk/")
-#for i in dir(pyray):
-#    if i.startswith("draw_"):
-#        print(i)
 
-#exit()
-#pyray.ConfigFlags(pyray.FLAG_MSAA_4X_HINT) #|pyray.FLAG_WINDOW_RESIZABLE  )
-pyray.ConfigFlags(pyray.FLAG_WINDOW_RESIZABLE  )
-pyray.set_config_flags(pyray.FLAG_WINDOW_HIGHDPI )
-pyray.set_config_flags(pyray.FLAG_MSAA_4X_HINT)
+#pyray.set_config_flags(pyray.FLAG_WINDOW_HIGHDPI )
+#pyray.set_config_flags(pyray.FLAG_MSAA_4X_HINT)
 pyray.set_config_flags(pyray.FLAG_WINDOW_RESIZABLE)
 
 

+ 68 - 55
tkray/fix.py

@@ -4,7 +4,7 @@ import sys
 sys.path.insert(0,"/opt/LibreLight/Xdesk/")
 
 
-CAPTION = 'RAY-FIX-LIST'
+CAPTION = 'R-FIX-LIST'
 import tool.movewin as movewin
 
 import pathlib
@@ -17,37 +17,20 @@ win_title =CAPTION.strip().split()[-1]
 store = movewin.load_all_sdl(win_title)
 print(store)
 POS=[10,10]
+W=760
+H=450
 if store:
+    POS[0] += 5   #frame kompensation
+    POS[1] += 29  #frame kompensation
     POS=[store[-2],store[-1]]
 
-#pyray.glfw_window_hint(4,1)
-#glfw_init_hint
-
-for i in dir(pyray):
-    if "hint" in i.lower():
-        print(i)
-
-#pyray.SetConfigFlags(FLAG_WINDOW_RESIZABLE); 
-#pyray.ConfigFlags(pyray.FLAG_WINDOW_RESIZABLE  )
-#for i in range(1,20):
-#    try:
-#        pyray.ConfigFlags(i) #pyray.FLAG_WINDOW_RESIZABLE  )
-#    except Exception as e:
-#        print(e)
-pyray.init_window(760, 450, CAPTION) #"RAY-DMX")#,10,10,10,10)
-#pyray.init_window(0, 0, CAPTION) #"RAY-DMX")#,10,10,10,10)
-pyray.ConfigFlags(pyray.FLAG_WINDOW_RESIZABLE  )
-#pyray.SetWindowMaxSize(2000,2000)
+
+
+pyray.set_config_flags(pyray.FLAG_WINDOW_RESIZABLE)
+pyray.init_window(W, H, CAPTION) #"RAY-DMX")#,10,10,10,10)
 pyray.set_window_min_size(200,200)
 pyray.set_window_max_size(1000,1000)
-#pyray.set_window_state()
-#pyray.TextureFilter(font10,1)
-#FLAG_RESIZABLE_WINDOW
 
-#POS=[100,200]
-#pyray.set_window_size(POS[0],POS[1])
-#POS=[200,100]
-#pyray.set_window_size(POS[0],POS[1])
 
 win_con = movewin.Control()
 win_con.title = win_title
@@ -143,20 +126,38 @@ class BUTTON():
 
     def event(self,x,y,mouse):
         try:
-            #print("POS:",old_x,old_y,mouse,xevent.type)
-            xevent.dict={"pos":[old_y,old_x],"button":1,"buttons":[0,0,0]}
-            #xevent.type=3
-            for i,v in enumerate(mouse):
-                if i==0:
-                    if v == "release":
-                        xevent.type=6
-                        xevent.dict["button"] = 1
-                        #self.btn.btn1.val.set(0)
-                    if v == "press":
-                        xevent.type=5
-                        xevent.dict["button"] = 1
-                        #self.btn.btn1.val.set(255)
-            xevent.dict["buttons"] = mouse
+            buttons = [0,0,0]
+            button = 0
+            PRESS=5 #1025
+            RELEASE=6 #1026
+            _type=0
+            for i in range(3):#2,0,-1):
+                #print(i,mouse)
+                if mouse[i] == "press":
+                    _type=PRESS
+                if mouse[i] == "release":
+                    _type=RELEASE
+                if mouse[i]:
+                    buttons[i] = 1
+                    button = i+1
+
+            xevent.dict={"pos":[y,x],"button":button,"buttons":buttons,"type":_type}
+
+            #print(xevent.dict)
+            pos=self.btn.pos
+            
+            if check_area(pos,[y,x]):
+                #print("POS:",x,y,mouse,xevent.type)
+                for i,v in enumerate(mouse):
+                    if i==0:
+                        #if v == "release": # or v == "click":
+                        if v == "click": #"press" or v == "click": # or v == "release":
+                            self.btn.btn1.type = "toggle"
+                            self.btn.btn1.press() 
+                            #xevent.type=5
+                            #xevent.dict["button"] = 1
+                            #self.btn.btn1.val.set(0)
+            #xevent.dict["buttons"] = mouse
             #print(xevent.dict,xevent.type,xevent.button)
             self.btn.event(xevent)
         except Exception as e:
@@ -228,7 +229,7 @@ def check_area(pos,event_pos):
 buttons={} #[]
 cur = None
 history = []
-
+KEY_BUF={}
 
 add=0
 while not pyray.window_should_close():
@@ -286,7 +287,7 @@ while not pyray.window_should_close():
                 add=1
             btn.btn.btn1.name = txt
             btn.btn.btn1.color_on = [255,255,0,255]
-            btn.btn.btn1.val.set(0)
+            #btn.btn.btn1.val.set(0)
             #if cur in btn.btn.btn1.name:
             #    btn.btn.btn1.val.set(255)
             #    #btn.btn.btn1.press() #val.set(255)
@@ -322,25 +323,37 @@ while not pyray.window_should_close():
                 mouse[i] = ev
                 mouse_change=1
 
+        if mouse_change:
+            print("MOUSE:",mouse,old_x,old_y) #=[None,None,None]
+
+
+        for i in range(1,12+1):
+            _KEY = "KEY_F{}".format(i)
+            x = pyray.KeyboardKey[_KEY]
+            #k_val=pyray.is_key_pressed(x)
+            k_val=pyray.is_key_down(x)
+            if _KEY not in KEY_BUF:
+                KEY_BUF[_KEY] = k_val
+            if KEY_BUF[_KEY] != k_val:
+                print("KEY_CHANGE",_KEY,k_val)
+                KEY_BUF[_KEY] = k_val
+
+        x=pyray.get_key_pressed()
+        if x:
+            print("key",x)
+        x=pyray.is_key_pressed(pyray.KEY_F1)
+        if x:
+            print("key",x)
+
         if mouse != mouse_old and mouse != [None,None,None]:
             #print(mouse)
             mouse_old = mouse[:]
-
             
+        aapos = draw_mouse_box(None,[old_x,old_y],mouse_old,color=[128,128,128],text=1)
+
         for k,btn in buttons.items():
             btn.event(old_x,old_y,mouse_old)
-            #if "press" == mouse_old[0]:
-            if "release" == mouse_old[0]:
-                btn.button = 1
-                #if check_area(btn.btn.pos,[old_x,old_y]):#event_pos):
-                if check_area(btn.btn.pos,[old_y,old_x]):#event_pos):
-                    #print(k,btn.btn.pos)
-                    #btn.btn.btn1.val.set(255)
-                    #cur = k
-                    cur = k # btn.btn.btn1.name
             btn.draw()
-            aapos = draw_mouse_box(None,[old_x,old_y],mouse_old,color=[128,128,128],text=1)
-
         
         pyray.draw_text_ex(font20,"POS:{}:{}".format(int(m.x),int(m.y)),[10,34], 20, 0,  pyray.VIOLET)
 
@@ -367,7 +380,7 @@ while not pyray.window_should_close():
         if pyray.is_window_resized():
             print( "RESIZE WINDOW OK")
         #print(pyray.FLAG_WINDOW_RESIZABLE  )
-
+        #print("E",pyray.is_window_focused() )
     except KeyboardInterrupt as e:
         raise e
     except Exception as e:# KeyInterupt

+ 8 - 1
tool/movewin.py

@@ -136,6 +136,7 @@ def get_store_sdl_line():
     lines.extend( winfo2(name="SDL-"))
     lines.extend( winfo2(name="TK-"))
     lines.extend( winfo2(name="RAY-"))
+    lines.extend( winfo2(name="R-"))
     lines.extend( winfo2(name="EXEC-BTN"))
     lines.extend( winfo2(name="EXEC-XWING"))
     out_lines=[]
@@ -143,7 +144,9 @@ def get_store_sdl_line():
         t=line[2].split()
         for k in t:
             k = k.replace(" ", "_")
-            if "SDL-" in k or "RAY-" in k or "TK-" in k or "EXEC-BTN" in k or "EXEC-XWING" in k:
+            for j in ["SDL-","RAY-","R-","TK-","EXEC-BTN", "EXEC-XWING"]:
+                if not k.startswith(j): 
+                    continue
                 s=line[-2]
                 p=line[-1]
 
@@ -242,6 +245,10 @@ def startup_all_sdl():
                 cmd=cmd.format("dmx.py")
                 #os.popen(cmd)
                 start_sub(cmd,"SDL-DMX",mute=1)
+            elif line[1] == "R-FIX-LIST":
+                cmd=cmd.format("fix.py")
+                #r=os.popen(cmd)
+                start_sub(cmd,"R-FIX-LIST",mute=1)
             elif line[1] == "RAY-DMX":
                 cmd=cmd.format("dmx.py")
                 #r=os.popen(cmd)

+ 5 - 4
tool/tk_elm.py

@@ -118,7 +118,8 @@ class ELEM_BUF():
         self.val.set(0)
 
     def press(self):
-        #print("ELEM_BUF.press",[self.name,self.type,self.val.get()])
+        print()
+        print("ELEM_BUF.press",[self.name,self.type,self.val.get()])
         if self.type == "fader":
             self.inc(self.increment)
 
@@ -462,12 +463,12 @@ class Button():
             #print(self)
             self._set_mouse_focus(1)
 
-
+            #print(":",event.dict)
             if "button" in event.dict:
                 mode = ""
-                if event.type == 5:
+                if event.dict["type"] == 5:
                     mode = "press"
-                if event.type == 6: 
+                if event.dict["type"] == 6: 
                     mode = "release"
 
                 e = [event.button,mode]