|
@@ -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
|