|
@@ -1,3 +1,4 @@
|
|
|
+
|
|
|
|
|
|
import math
|
|
|
import random
|
|
@@ -51,11 +52,6 @@ parser.add_option("", "--videoplayer", dest="videoplayer",#default=1,
|
|
|
parser.add_option("", "--title", dest="title",default="SCREEN",
|
|
|
help="set title")
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
(options, args) = parser.parse_args()
|
|
|
|
|
@@ -80,8 +76,6 @@ def read_index():
|
|
|
if ips is None:
|
|
|
ips = {}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
return ips
|
|
|
|
|
|
def select_ip(ips, univ=2):
|
|
@@ -104,7 +98,13 @@ if options.countdown:
|
|
|
for cdmx in cdmx_start:
|
|
|
try:
|
|
|
cdmx = int(cdmx)
|
|
|
- COUNTER.append({"DMX":cdmx,"DIM":0,"PAN":127,"TILT":127,"CONTROL":0,"SEC":10,"RED":255,"GREEN":255,"BLUE":255,"_time":time.time(),"_RUN":0,"_SEC":">{}<".format(cdmx)})
|
|
|
+ _tmp={"DMX":cdmx,"DIM":0,"PAN":127,"TILT":127
|
|
|
+ ,"CONTROL":0,"SEC":10
|
|
|
+ ,"RED":255,"GREEN":255,"BLUE":255
|
|
|
+ ,"_time":time.time(),"_RUN":0
|
|
|
+ ,"_SEC":">{}<".format(cdmx)
|
|
|
+ }
|
|
|
+ COUNTER.append(_tmp)
|
|
|
except Exception as e:
|
|
|
print("EXCEPTION COUNTER INIT ",cdmx)
|
|
|
|
|
@@ -146,42 +146,8 @@ except:pass
|
|
|
|
|
|
|
|
|
|
|
|
-def scan_capture(name="MiraBox",serial=""):
|
|
|
- ls = os.listdir("/dev/")
|
|
|
- name = name.upper()
|
|
|
- serial = serial.upper()
|
|
|
- out = []
|
|
|
- for l in ls:
|
|
|
- if l.startswith("video"):
|
|
|
-
|
|
|
- cmd="udevadm info --query=all /dev/{}".format(l)
|
|
|
- print("# cmd:",cmd)
|
|
|
- r = os.popen(cmd)
|
|
|
- ok_name = 0
|
|
|
- ok_capture = 0
|
|
|
- ok_serial = 0
|
|
|
-
|
|
|
- for line in r.readlines():
|
|
|
- line = line.strip()
|
|
|
- line = line.upper()
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if "ID_V4L_CAPABILITIES=:capture:".upper() in line:
|
|
|
- ok_capture = 1
|
|
|
- if name != "" and "_MODEL" in line and name in line:
|
|
|
- ok_name = 1
|
|
|
- if serial != "" and "ID_SERIAL_SHORT" in line and serial in line:
|
|
|
- ok_serial = 1
|
|
|
-
|
|
|
- if (name == "" or ok_name) and (serial == "" or ok_serial) and ok_capture:
|
|
|
- print(l,"# name:",ok_name,"capture:",ok_capture,"serial:",ok_serial,"# OK !",[name,serial])
|
|
|
- out.append([l,name,serial])
|
|
|
- else:
|
|
|
- print("#",l,"# name:",ok_name,"capture:",ok_capture,"serial:",ok_serial,"# FAIL !",[name,serial])
|
|
|
- print()
|
|
|
- return out
|
|
|
-
|
|
|
+sys.path.insert(0,"/opt/LibreLight/Xdesk/")
|
|
|
+from tool.video_capture import scan_capture
|
|
|
|
|
|
class Vopen():
|
|
|
|
|
@@ -385,10 +351,6 @@ class Vopen():
|
|
|
if self.cv2:
|
|
|
if self._stop:
|
|
|
return
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
if self.fname.startswith("cam_"):
|
|
|
self._open_cam()
|
|
@@ -397,24 +359,15 @@ class Vopen():
|
|
|
|
|
|
|
|
|
print("_init ?",self.Rcap)
|
|
|
-
|
|
|
-
|
|
|
print("open ?" ,self.Rcap.isOpened())
|
|
|
self.Rcap.read()
|
|
|
|
|
|
|
|
|
self.Rsuccess = 1
|
|
|
self._read()
|
|
|
+
|
|
|
def _del(self):
|
|
|
self._stop = 1
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
self.buffer = []
|
|
|
self.Rcap.release()
|
|
@@ -423,10 +376,6 @@ class Vopen():
|
|
|
self.Rcap = None
|
|
|
self.cap = None
|
|
|
del self.Rcap
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
gc.collect()
|
|
|
|
|
|
|
|
@@ -461,13 +410,6 @@ class Vopen():
|
|
|
else:
|
|
|
img = self.rescale_frame2(img, 200)
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
|
|
|
if self.fname.startswith("cam_"):
|
|
@@ -518,10 +460,6 @@ class Vopen():
|
|
|
if angle in r:
|
|
|
pass
|
|
|
elif 0:
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
bg_shape = bg_shape[::-1]
|
|
|
delta_y = -65
|
|
|
delta_x = 30
|
|
@@ -545,8 +483,6 @@ class Vopen():
|
|
|
|
|
|
bg_shape = tuple(bg_shape)
|
|
|
rot_mat = self.cv2.getRotationMatrix2D(center,angle,1.0)
|
|
|
-
|
|
|
-
|
|
|
frame = self.cv2.warpAffine(image, rot_mat, bg_shape )
|
|
|
return frame
|
|
|
except Exception as e:
|
|
@@ -614,12 +550,10 @@ class Vopen():
|
|
|
if self.img is None:
|
|
|
return
|
|
|
|
|
|
-
|
|
|
self.img = self.rescale_frame(self.img, percent=self.scale)
|
|
|
|
|
|
|
|
|
self.img = self.rotateImage(self.img, self.angle)
|
|
|
-
|
|
|
self.shape = self.img.shape[1::-1]
|
|
|
|
|
|
if len(self.buffer) % 100 == 0:
|
|
@@ -679,13 +613,8 @@ class Vopen():
|
|
|
yellow[0] = int(yellow[0]*self.dim/255)
|
|
|
yellow[1] = int(yellow[1]*self.dim/255)
|
|
|
yellow[2] = int(yellow[2]*self.dim/255)
|
|
|
-
|
|
|
+
|
|
|
if self.fname.startswith("cam_"):
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
pass
|
|
|
elif 1:
|
|
|
p1 = [self.x+2,self.y+2]
|
|
@@ -700,12 +629,7 @@ class Vopen():
|
|
|
|
|
|
hx=int(xx/2)
|
|
|
hy=int(yy/2)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
p1 = [self.x-hx,self.y-hy]
|
|
|
p2 = [self.x+__xw-hx,self.y+__yw-hy]
|
|
|
p3 = [self.x+__xw-hx,self.y-hy]
|
|
@@ -721,24 +645,10 @@ class Vopen():
|
|
|
pygame.draw.line(wn,yellow,[self.x+2-__xw,self.y+2-__yw],[self.x+__xw-4-__xw,self.y+__yw-4-__yw])
|
|
|
pygame.draw.line(wn,yellow,[self.x+__xw-4-__xw,self.y+2-__yw],[self.x+2-__xw,self.y+__yw-4-__yw])
|
|
|
|
|
|
-
|
|
|
-
|
|
|
pz = 0
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
if self.success and wn and self.im:
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
xx ,yy = self.im.get_size()[:2]
|
|
|
-
|
|
|
-
|
|
|
if self.fname.startswith("cam_"):
|
|
|
wn.blit(self.im, (int(self.x-xx/2), int(self.y)))
|
|
|
else:
|
|
@@ -809,7 +719,13 @@ if type(options.videoplayer) is str:
|
|
|
cdmx = int(cdmx)
|
|
|
videoplayer.append( Vopen(cdmx,_id=_vid) )
|
|
|
_vid += 1
|
|
|
- VIDEO.append({"DMX":cdmx,"DIM":0,"PAN":127,"TILT":127,"CONTROL":0,"SEC":10,"VIDEO":"3","RED":255,"GREEN":255,"BLUE":255,"_time":time.time(),"_RUN":0,"_SEC":">{}<".format(cdmx)})
|
|
|
+ _tmp = {"DMX":cdmx,"DIM":0,"PAN":127,"TILT":127
|
|
|
+ ,"CONTROL":0,"SEC":10,"VIDEO":"3"
|
|
|
+ ,"RED":255,"GREEN":255,"BLUE":255
|
|
|
+ ,"_time":time.time()
|
|
|
+ ,"_RUN":0,"_SEC":">{}<".format(cdmx)
|
|
|
+ }
|
|
|
+ VIDEO.append(_tmp)
|
|
|
except Exception as e:
|
|
|
print("EXCEPTION COUNTER INIT ",cdmx)
|
|
|
|
|
@@ -825,8 +741,7 @@ def loop_videoplayer():
|
|
|
ok = 1
|
|
|
except Exception as e:
|
|
|
print("EXCEPTION loop_videoplayer ",e)
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
if ok == 0:
|
|
|
time.sleep(0.1)
|
|
|
else:
|
|
@@ -852,26 +767,21 @@ def loop2_videoplayer():
|
|
|
|
|
|
|
|
|
_videoplayer = videoplayer2[:]
|
|
|
-
|
|
|
+
|
|
|
ok = 0
|
|
|
j =0
|
|
|
for i in _videoplayer:
|
|
|
try:
|
|
|
r = i._read()
|
|
|
-
|
|
|
if r:
|
|
|
print(j,len(videoplayer2),i,len(i.buffer))
|
|
|
ok = 1
|
|
|
except Exception as e:
|
|
|
print("EXCEPTION loop2_videoplayer ",e)
|
|
|
+
|
|
|
time.sleep(0.002)
|
|
|
j += 1
|
|
|
- if ok == 0:
|
|
|
- pass
|
|
|
- else:
|
|
|
- pass
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
p = 16
|
|
@@ -933,6 +843,7 @@ try:
|
|
|
pass
|
|
|
except Exception as e:
|
|
|
print( "Exc",options.mode,e)
|
|
|
+
|
|
|
print("_x2 , -X",_x2)
|
|
|
|
|
|
import pygame
|
|
@@ -1064,11 +975,9 @@ print()
|
|
|
print()
|
|
|
print()
|
|
|
|
|
|
-window = pygame.display.set_mode(MAIN_SIZE,pg.RESIZABLE)
|
|
|
-
|
|
|
+window = pygame.display.set_mode(MAIN_SIZE)
|
|
|
+
|
|
|
pg.display.set_caption('LibreLight VPU-{}'.format(options.title))
|
|
|
-
|
|
|
-
|
|
|
|
|
|
|
|
|
class Fix():
|
|
@@ -1093,29 +1002,23 @@ class Fix():
|
|
|
|
|
|
spalte = (_id-1)%_y +1
|
|
|
zeile = int((_id-1)/_x2)
|
|
|
-
|
|
|
|
|
|
add_row = _x*CFG_BLOCK["h-split"]*CFG_BLOCK["v-split"]
|
|
|
|
|
|
|
|
|
sid = (_id-1)*2 + zeile*CFG_BLOCK["h-split"]*_x2
|
|
|
-
|
|
|
sid = sid+1
|
|
|
-
|
|
|
sub_pos= [pos[0]*block[0],pos[1]*block[1]]
|
|
|
sub_fix = SubFix(sid,sub_pos,sub_block,univ,dmx,ch)
|
|
|
self.sub_fix.append(sub_fix)
|
|
|
|
|
|
sid = sid+1
|
|
|
-
|
|
|
sub_pos= [pos[0]*block[0]+block[0]/2,pos[1]*block[1]]
|
|
|
sub_fix = SubFix(sid,sub_pos,sub_block,univ,dmx,ch)
|
|
|
self.sub_fix.append(sub_fix)
|
|
|
|
|
|
|
|
|
sid = (_id-1)*2+1 + _x2*CFG_BLOCK["h-split"] + zeile*CFG_BLOCK["h-split"]*_x2
|
|
|
-
|
|
|
-
|
|
|
sub_pos= [pos[0]*block[0],pos[1]*block[1]+block[1]/2]
|
|
|
sub_fix = SubFix(sid,sub_pos,sub_block,univ,dmx,ch)
|
|
|
self.sub_fix.append(sub_fix)
|
|
@@ -1171,7 +1074,6 @@ class SubFix():
|
|
|
def calc(self,data):
|
|
|
|
|
|
dmx_sub = [30]*10
|
|
|
-
|
|
|
dmx = self.dmx -1
|
|
|
_dmx_sub = []
|
|
|
if self.dmx >= 0:
|
|
@@ -1180,10 +1082,8 @@ class SubFix():
|
|
|
_dmx_sub = data[dmx:dmx+self.ch]
|
|
|
if _dmx_sub:
|
|
|
dmx_sub = _dmx_sub
|
|
|
-
|
|
|
dim = dmx_sub[0]/255
|
|
|
|
|
|
-
|
|
|
r = dmx_sub[1]*dim
|
|
|
g = dmx_sub[2]*dim
|
|
|
b = dmx_sub[3]*dim
|
|
@@ -1218,9 +1118,11 @@ class POINTER():
|
|
|
def row_move(self,x,y):
|
|
|
self._x = x
|
|
|
self._y = y
|
|
|
+
|
|
|
def move(self,pos):
|
|
|
self.pos = pos
|
|
|
self.on = 1
|
|
|
+
|
|
|
def cross(self,x,y):
|
|
|
self.x = x
|
|
|
self.y = y
|
|
@@ -1232,18 +1134,14 @@ class POINTER():
|
|
|
pos[1] += y
|
|
|
fix_x= self.fix.x
|
|
|
fix_y= self.fix.y +y
|
|
|
-
|
|
|
|
|
|
if self.on:
|
|
|
pygame.draw.rect(window,self.rgb,pos)
|
|
|
-
|
|
|
-
|
|
|
|
|
|
|
|
|
fr = font15.render("{}/{}".format(fix_x+1,fix_y) ,1, (200,200,200))
|
|
|
|
|
|
_nr = fix_y * _x + fix_x +1
|
|
|
-
|
|
|
fr = font15.render("{:02}".format(_nr ) ,1, (200,200,200))
|
|
|
|
|
|
window.blit(fr,(pos[0]+2,pos[1]+2 ))
|
|
@@ -1252,13 +1150,8 @@ class POINTER():
|
|
|
|
|
|
txt=str(pos)
|
|
|
fr = font15.render(txt ,1, (200,200,200))
|
|
|
-
|
|
|
window.blit(fr,(10,1))
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
fr = font15.render("X:{:03}".format(self._x) ,1, (200,200,200))
|
|
|
window.blit(fr,(10,30))
|
|
@@ -1359,6 +1252,7 @@ frame2 = 0
|
|
|
frame_t = time.time()
|
|
|
frame2_t = time.time()
|
|
|
IP = "yyy"
|
|
|
+
|
|
|
def draw_overlay():
|
|
|
global fps,fps2
|
|
|
fr = font15.render("DMX-FPS:{}".format(fps) ,1, (200,0,255))
|
|
@@ -1429,6 +1323,7 @@ def open_text_block():
|
|
|
for i in range(10-len(lines)):
|
|
|
lines.append("LINE ERROR")
|
|
|
return lines
|
|
|
+
|
|
|
TEXT_BLOCK = open_text_block()
|
|
|
TEXT_BLOCK_TIME = time.time()
|
|
|
|
|
@@ -1480,7 +1375,6 @@ def draw_circle(surface,color, pos, radius):
|
|
|
def rDMX(univ,dmx):
|
|
|
return univ*512+dmx
|
|
|
|
|
|
-
|
|
|
def generate_grid(mapping=0):
|
|
|
_log = []
|
|
|
|
|
@@ -1490,16 +1384,14 @@ def generate_grid(mapping=0):
|
|
|
head = "univ,dmx,x,y,ch\n"
|
|
|
head = "nr,id,info\n"
|
|
|
print("csv:",head)
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
_log.append(head)
|
|
|
dmx = 1-1
|
|
|
ch = 4
|
|
|
|
|
|
y=0
|
|
|
x=0
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
for i in range((_y)*(_x)):
|
|
|
|
|
|
if x > 8 and i%8 == 0:
|
|
@@ -1511,12 +1403,7 @@ def generate_grid(mapping=0):
|
|
|
_dmx = dmx - (_univ)*512
|
|
|
|
|
|
pos=[x,y]
|
|
|
-
|
|
|
-
|
|
|
line="{},{},x\n".format(i+1,i+1)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
_log.append(line)
|
|
|
dmx += ch
|
|
|
x+=1
|
|
@@ -1558,26 +1445,13 @@ def init_grid(mapping=0,_x=4,_y=4,_xp=0,_yp=0,start=0,name="init_gird"):
|
|
|
y+=1
|
|
|
if y >= _y:
|
|
|
break
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
-
|
|
|
_id = int(line[1])
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
pos = [x+_xp,y+_yp]
|
|
|
f = Fix(_id,pos,block)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
GRID.append(f)
|
|
|
x+=1
|
|
|
-
|
|
|
return GRID
|
|
|
|
|
|
def find_pix(x,y):
|
|
@@ -1587,25 +1461,16 @@ def find_pix(x,y):
|
|
|
Y = 0
|
|
|
|
|
|
pos = fix.POS()
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
if x > pos[0] and x < pos[0]+pos[2]:
|
|
|
X = 1
|
|
|
if y > pos[1] and y < pos[1]+pos[3]:
|
|
|
Y = 1
|
|
|
if X and Y:
|
|
|
-
|
|
|
-
|
|
|
return fix
|
|
|
|
|
|
GRID = []
|
|
|
|
|
|
GRID_A = []
|
|
|
-
|
|
|
-
|
|
|
-GRID_B = []
|
|
|
-
|
|
|
|
|
|
NR = 0
|
|
|
START_UNIV=2
|
|
@@ -1663,21 +1528,14 @@ def draw_box(pos1,pos2,color=[128,128,128],text=1):
|
|
|
pygame.draw.aaline(window,color,_pos1,_pos2,1)
|
|
|
|
|
|
def grab(x=55,y=55,w=60,h=60):
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
crop = None
|
|
|
rect = pygame.Rect(x, y, w, h)
|
|
|
try:
|
|
|
sub = window.subsurface(rect)
|
|
|
-
|
|
|
crop = pygame.Surface((w,h))
|
|
|
crop.blit(sub, (0,0))
|
|
|
except ValueError as e:
|
|
|
- pass
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ pass
|
|
|
|
|
|
return crop
|
|
|
|
|
@@ -1699,48 +1557,33 @@ def reshape(GRID,GRID_OUT,_x,_y,name="GRID_Z"):
|
|
|
y_min = 99999
|
|
|
y_max = 0
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ pos= [0,0]
|
|
|
+ pos[0] = _x+p*3
|
|
|
+ pos[1] = p*8+65
|
|
|
+
|
|
|
|
|
|
tmp_font = pygame.font.SysFont("freemonobold",int(p*0.8))
|
|
|
|
|
|
fr = tmp_font.render("OUTPUT: "+str(name) ,1, (255,255,255))
|
|
|
- fr_r = fr.get_rect(center=(int(wx/2),int(0+pm_wy-p*1.5)))
|
|
|
-
|
|
|
- pos= [0,0]
|
|
|
- pos[0] = _x+p*3
|
|
|
- pos[1] = p*8+65
|
|
|
+ fr_r = fr.get_rect(center=(int(wx/2),int(0+pm_wy-p*0-10)))
|
|
|
window.blit(fr,pos)
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
fr = tmp_font.render("INPUT" ,1, (255,255,255))
|
|
|
fr_r = fr.get_rect(center=(int(wx/2),int(60+pm_wy-p/2)))
|
|
|
window.blit(fr,fr_r)
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
j = 0
|
|
|
for fix in GRID_OUT:
|
|
|
- if j >= 64:
|
|
|
+ if j >= 64:
|
|
|
break
|
|
|
j+=1
|
|
|
ii = i
|
|
|
-
|
|
|
pos = fix.POS(40,60)
|
|
|
rgb = fix.rgb
|
|
|
pos[0]+=_x
|
|
|
pos[1]+=_y
|
|
|
+
|
|
|
|
|
|
pygame.draw.rect(window,[0,40,0],pos)
|
|
|
|
|
@@ -1748,15 +1591,12 @@ def reshape(GRID,GRID_OUT,_x,_y,name="GRID_Z"):
|
|
|
for fix2 in GRID:
|
|
|
if fix._id == fix2._id:
|
|
|
_xposs = fix2.POS(40,60)
|
|
|
-
|
|
|
-
|
|
|
xposs.append( _xposs)
|
|
|
|
|
|
for xpos in xposs:
|
|
|
sub = grab(xpos[0],xpos[1]+pm_wy,xpos[2],xpos[3])
|
|
|
if sub:
|
|
|
- if 1:
|
|
|
- window.blit(sub, (pos[0]+z,pos[1]+z))
|
|
|
+ window.blit(sub, (pos[0]+z,pos[1]+z))
|
|
|
else:
|
|
|
|
|
|
pygame.draw.rect(window,[40,0,0],pos)
|
|
@@ -1773,8 +1613,6 @@ def reshape(GRID,GRID_OUT,_x,_y,name="GRID_Z"):
|
|
|
y_max += xpos[3]
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
apos = fix.POS(40,60)
|
|
|
apos[0]+=_x
|
|
|
apos[1]+=_y
|
|
@@ -1782,9 +1620,7 @@ def reshape(GRID,GRID_OUT,_x,_y,name="GRID_Z"):
|
|
|
|
|
|
|
|
|
if NR:
|
|
|
- pygame.draw.rect(window,[30,40,0],[apos[0],apos[1],12,9])
|
|
|
-
|
|
|
- pygame.draw.rect(window,[20,40,0],[x+apos[0]+2+z,y+apos[1]+2+z-pm_wy,12,9])
|
|
|
+ pygame.draw.rect(window,[20,20,20],[apos[0],apos[1],12,8])
|
|
|
|
|
|
fix_id = fix._id
|
|
|
if fix_id > 8*8:
|
|
@@ -1792,21 +1628,16 @@ def reshape(GRID,GRID_OUT,_x,_y,name="GRID_Z"):
|
|
|
if NR:
|
|
|
if fix_id != i+1:
|
|
|
fr = font12.render("{:02}".format(fix._id) ,1, (255,255,0))
|
|
|
-
|
|
|
window.blit(fr,(apos[0],apos[1]))
|
|
|
-
|
|
|
else:
|
|
|
fr = font12.render("{:02}".format(fix._id) ,1, (100,100,255))
|
|
|
-
|
|
|
window.blit(fr,(apos[0],apos[1]))
|
|
|
i += 1
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
pos1= [x+x_min,y+x_min]
|
|
|
pos2= [x_max+x_min,y_min+y_max]
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
@@ -1831,27 +1662,15 @@ def reload_grid():
|
|
|
print("==== reload_grid")
|
|
|
global GRID
|
|
|
global GRID_A
|
|
|
- global GRID_B
|
|
|
try:
|
|
|
GRID = init_grid(_x=_x,_y=_y,name="GRID")
|
|
|
GRID_A = init_grid(_x=8,_y=16,mapping=1,name="GRID_A")
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
except Exception as e:
|
|
|
print("Except: grid re init",e)
|
|
|
|
|
|
VPU_TEXT = []
|
|
|
def load_vpu_text(nr=0):
|
|
|
txt = "NONE"
|
|
|
- if not VPU_TEXT:
|
|
|
- pass
|
|
|
if len(VPU_TEXT) > nr:
|
|
|
txt = VPU_TEXT[0]
|
|
|
return txt
|
|
@@ -2356,7 +2175,6 @@ def main():
|
|
|
global GRID
|
|
|
|
|
|
global GRID_A
|
|
|
- global GRID_B
|
|
|
global FUNC
|
|
|
global count_tilt
|
|
|
global TEXT_BLOCK
|
|
@@ -2366,18 +2184,13 @@ def main():
|
|
|
global dataA
|
|
|
global frame2
|
|
|
|
|
|
-
|
|
|
-
|
|
|
reload_grid()
|
|
|
- print("GRID LEN:",len(GRID))
|
|
|
-
|
|
|
|
|
|
s=time.time()
|
|
|
-
|
|
|
r = ""
|
|
|
IP = "xx"
|
|
|
+
|
|
|
while running:
|
|
|
-
|
|
|
if TEXT_BLOCK_TIME+5 < time.time():
|
|
|
TEXT_BLOCK = open_text_block()
|
|
|
TEXT_BLOCK_TIME = time.time()
|
|
@@ -2413,7 +2226,6 @@ def main():
|
|
|
|
|
|
draw_gobo(GRID,data)
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
@@ -2425,37 +2237,37 @@ def main():
|
|
|
draw_counter(COUNTER)
|
|
|
|
|
|
pointer.draw(0,pm_wy)
|
|
|
- draw_fix_nr(GRID)
|
|
|
+
|
|
|
+ pygame.draw.rect(window,[5,5,5],[0,60,MAIN_SIZE[0],p*9])
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
spos = [0,0,0,0]
|
|
|
if PIXEL_MAPPING >= 1:
|
|
|
try:
|
|
|
GRID_X = GRID_A[8*8:]
|
|
|
xx = p*8
|
|
|
- reshape(GRID,GRID_X,xx+102,-xx,name="GRID_B")
|
|
|
+ reshape(GRID,GRID_X,xx+102,-xx,name="GRID_A2")
|
|
|
except Exception as e:
|
|
|
print("Exception 23123",e)
|
|
|
|
|
|
- reshape(GRID,GRID_A,0,0,name="GRID_A")
|
|
|
+ reshape(GRID,GRID_A,0,0,name="GRID_A1")
|
|
|
else:
|
|
|
reshape(GRID,GRID_A,spos[0]+spos[2]+20,10)
|
|
|
-
|
|
|
|
|
|
+
|
|
|
+ draw_fix_nr(GRID)
|
|
|
|
|
|
frame_area()
|
|
|
|
|
|
|
|
|
pygame.display.flip()
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
clock.tick(25)
|
|
|
-
|
|
|
|
|
|
if 'SDL_VIDEO_WINDOW_POS' in os.environ:
|
|
|
del os.environ['SDL_VIDEO_WINDOW_POS']
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
frame2 += 1
|
|
|
|
|
|
if __name__ == "__main__":
|