Ver código fonte

extend: GUI Editor (like the Programmer), add: show data

micha 3 anos atrás
pai
commit
be91c32af4
8 arquivos alterados com 711 adições e 4 exclusões
  1. 85 0
      Editor.py
  2. 528 0
      Editor2.py
  3. 43 0
      fx.py
  4. 5 4
      lib/chat.py
  5. 43 0
      preset.py
  6. 1 0
      show/mitte.p
  7. 3 0
      show/preset.log
  8. 3 0
      show/rot.p

+ 85 - 0
Editor.py

@@ -0,0 +1,85 @@
+#! /usr/bin/python
+# -*- coding: utf-8 -*-
+
+"""
+This file is part of librelight.
+
+librelight is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+librelight is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with librelight.  If not, see <http://www.gnu.org/licenses/>.
+
+(c) 2012 micha.rathfelder@gmail.com
+"""
+
+import time
+import tkinter 
+import sys
+import _thread as thread
+import tkinter as tk
+
+root = tk.Tk()
+
+frame = tk.Frame(root)
+frame.pack(fill=tk.X, side=tk.TOP)
+data = []
+i=0
+for r in range(3):
+    frame.columnconfigure(r, weight=1)
+    cd = []
+    for c in range(8):
+        i+=1
+        frame.columnconfigure(c, weight=1)
+        b = tk.Button(frame,bg="red", text='MH'+str(i)+' r:'+str(r+1)+' c:'+str(c+1))
+        b.grid(row=r, column=c, sticky=tk.W+tk.E)
+        cd.append(b)
+
+frame = tk.Frame(root)
+frame.pack(fill=tk.X, side=tk.TOP)
+data = []
+i=0
+for c in range(8):
+    frame.columnconfigure(c, weight=1)
+    cd = []
+    for r in range(3):
+        i+=1
+        frame.columnconfigure(r, weight=1)
+        b = tk.Button(frame,bg="green", text='PAN'+str(i)+' r:'+str(r+1)+' c:'+str(c+1))
+        b.grid(row=r, column=c, sticky=tk.W+tk.E)
+        cd.append(b)
+
+
+frame = tk.Frame(root)
+frame.pack(fill=tk.X, side=tk.TOP)
+data = []
+for c in range(10):
+    frame.columnconfigure(c, weight=1)
+    cd = []
+    for r in range(10):
+        frame.columnconfigure(r, weight=1)
+        b = tk.Button(frame, text='r:'+str(r+1)+' c:'+str(c+1))
+        b.grid(row=r, column=c, sticky=tk.W+tk.E)
+        cd.append(b)
+
+
+frame = tk.Frame(root)
+frame.pack(fill=tk.X, side=tk.TOP)
+data = []
+for c in range(3):
+    frame.columnconfigure(c, weight=1)
+    cd = []
+    for r in range(3):
+        frame.columnconfigure(r, weight=1)
+        b = tk.Button(frame,bg="grey", text='r:'+str(r+1)+' c:'+str(c+1))
+        b.grid(row=r, column=c, sticky=tk.W+tk.E)
+        cd.append(b)        
+
+root.mainloop()

+ 528 - 0
Editor2.py

@@ -0,0 +1,528 @@
+#! /usr/bin/python
+# -*- coding: utf-8 -*-
+
+"""
+This file is part of librelight.
+
+librelight is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+librelight is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with librelight.  If not, see <http://www.gnu.org/licenses/>.
+
+(c) 2012 micha.rathfelder@gmail.com
+"""
+
+import time
+import tkinter 
+import sys
+import _thread as thread
+import tkinter as tk
+
+from tkinter import font
+
+
+import lib.chat as chat
+
+root = tk.Tk()
+root["bg"] = "red"
+
+#default_font = font.Font(family='Helvetica', size=12, weight='bold')
+default_font = font.Font(family='Helvetica', size=10, weight='normal')
+#default_font.configure(size=9)
+root.option_add("*Font", default_font)
+
+
+from collections import OrderedDict
+
+
+CUES    = OrderedDict()
+groups  = OrderedDict()
+
+BLIND = 0
+POS   = ["PAN","TILT","MOTION"]
+COLOR = ["RED","GREEN","BLUE","COLOR"]
+BEAM  = ["GOBO","G-ROT","PRISMA","P-ROT","FOCUS","SPEED"]
+INT   = ["DIM","SHUTTER","STROBE","FUNC"]
+client = chat.tcp_sender()
+
+class Xevent():
+    def __init__(self,elem,attr=None,data=None,mode=None):
+        self.data=data
+        self.attr = attr
+        self.elem = elem
+        self.mode = mode
+    def encoder(self,attr,data,elem,action=""):
+        if action == "click":
+            if self.data["ATTRIBUT"][attr]["ACTIVE"]:
+                self.data["ATTRIBUT"][attr]["ACTIVE"] = 0
+                self.elem["bg"] = "grey"
+            else:
+                self.data["ATTRIBUT"][attr]["ACTIVE"] = 1
+                self.elem["bg"] = "yellow"
+            return 1
+
+    
+        v=data["ATTRIBUT"][attr]["VALUE"]
+        change=0
+        if action == "+":
+            v+= 4.11
+            change=1
+        elif action == "-":
+            v-= 4.11
+            change=1
+
+            
+        if v < 0:
+            v=0
+        elif v > 256:
+            v=256
+            
+        if change:
+            data["ATTRIBUT"][attr]["ACTIVE"] = 1
+            elem["bg"] = "yellow"
+            data["ATTRIBUT"][attr]["VALUE"] = v
+            elem["text"] = str(attr)+' '+str(round(v,2))
+            self.update_dmx(attr=attr,data=data)
+            
+            
+    def update_dmx(self,attr,data):
+        global BLIND
+        dmx = data["DMX"]
+        val = None
+        if attr == "VDIM":
+            for attr in data["ATTRIBUT"]:
+                dmx = data["DMX"]
+                if data["ATTRIBUT"][attr]["NR"] < 0:
+                    continue
+                dmx += data["ATTRIBUT"][attr]["NR"]
+                #print(attr)
+                val = data["ATTRIBUT"][attr]["VALUE"]
+                if data["ATTRIBUT"][attr]["MASTER"]:
+                    val = val * (data["ATTRIBUT"]["VDIM"]["VALUE"] / 255.)
+                if val is not None:            
+                    cmd = "d{}:{}".format(dmx,int(val))
+                    #print("cmd",cmd)
+                    if not BLIND:
+                        client.send(cmd )
+                    else:
+                        pass#print("BLIND ! cmd",cmd)
+                    
+            
+        elif data["ATTRIBUT"][attr]["NR"] >= 0:
+            dmx += data["ATTRIBUT"][attr]["NR"]
+            val = data["ATTRIBUT"][attr]["VALUE"]
+            if data["ATTRIBUT"][attr]["MASTER"]:
+                if "VDIM" in data["ATTRIBUT"]:
+                    val = val * (data["ATTRIBUT"]["VDIM"]["VALUE"] / 255.)
+            if val is not None:            
+                cmd = "d{}:{}".format(dmx,int(val))
+                #print("cmd",cmd)
+                if not BLIND:
+                    client.send(cmd )
+                else:
+                    pass#print("BLIND ! cmd",cmd)
+
+            
+    def cb(self,event):
+        #print("cb",self,event,data)
+        print("cb",self.attr,self.mode,event)
+        #print(self.obj.keys())
+        try:
+            #v = self.data["ATTRIBUT"][self.attr]
+            
+            change = 0
+            if self.mode == "COMMAND":
+                
+                if self.attr == "CLEAR":
+                    if event.num == 1:
+                        for fix in self.data.fixtures:
+                            print( "clr",fix)
+                            data = self.data.fixtures[fix]
+                            #print("elm",self.data.elem_attr[fix])
+                            for attr in data["ATTRIBUT"]:
+                                if attr.endswith("-FINE"):
+                                    continue
+                                self.data.elem_attr[fix][attr]["bg"] = "grey"
+                                data["ATTRIBUT"][attr]["ACTIVE"] = 0
+                            #print(data["ATTRIBUT"])
+                if self.attr == "BLIND":
+                    global BLIND
+                    if event.num == 1:
+                        
+                        if self.data.val_commands[self.attr]:
+                            self.data.val_commands[self.attr] = 0
+                            BLIND = 0
+                            self.data.elem_command[self.attr]["bg"] = "green"
+                        else:
+                            self.data.val_commands[self.attr] = 1
+                            BLIND = 1
+                            self.data.elem_command[self.attr]["bg"] = "red"
+                        print("BLIND",self.data.val_commands)
+                        
+                return 0
+
+            
+            if self.mode == "ENCODER":
+                #if self.attr == "VDIM":
+                #    self.attr = "DIM"
+                for fix in self.data.fixtures:
+                    data = self.data.fixtures[fix]
+                    
+                    for attr in data["ATTRIBUT"]:
+                        if attr.endswith("-FINE"):
+                            continue
+                        elem = self.data.elem_attr[fix][attr]
+                        if self.attr != attr:
+                            continue
+                        if event.num == 1:
+                            #self.encoder(attr=attr,data=data,elem=elem,action="click")
+                            data["ATTRIBUT"][attr]["ACTIVE"] = 1
+                            elem["bg"] = "yellow"
+                            
+
+                        if not data["ATTRIBUT"][attr]["ACTIVE"]:
+                            continue
+                        
+                        if event.num == 4:
+                            self.encoder(attr=attr,data=data,elem=elem,action="+")
+                            #if attr == "DIM":
+                            #    self.encoder(attr="VDIM",data=data,elem=elem,action="+")
+                        elif event.num == 5:
+                            self.encoder(attr=attr,data=data,elem=elem,action="-")
+                            #if attr == "DIM":
+                            #     self.encoder(attr="VDIM",data=data,elem=elem,action="-")
+                return 0
+                                
+
+
+                
+            if event.num == 1:
+                self.encoder(attr=self.attr,data=self.data,elem=self.elem,action="click")
+
+            elif event.num == 4:
+                self.encoder(attr=self.attr,data=self.data,elem=self.elem,action="+")
+            elif event.num == 5:
+                self.encoder(attr=self.attr,data=self.data,elem=self.elem,action="-")
+            
+
+                
+
+        
+        except Exception as e:
+            print("== cb EXCEPT",e)
+            print("Error on line {}".format(sys.exc_info()[-1].tb_lineno))
+        #print(self.elem["text"],self.attr,self.data)
+        
+                                            
+        
+def wheel(event,d=None):
+    print("wheel",event,d)
+    
+import copy
+
+class Master():
+    def __init__(self):
+        self.load()
+        self.all_attr =[]
+        self.elem_attr = {}
+        self.commands =["BLIND","CLEAR","STORE"]
+        self.elem_command = {}
+        self.val_commands = {}
+        
+    def load(self):
+        fixture = OrderedDict()
+        
+        DATA = OrderedDict()
+        DATA["DIM"]   = {"NR": 0, "MASTER": "1", "MODE": "F", "VALUE": 0.0,"ACTIVE":0}
+        DATA["RED"]   = {"NR": 3, "MASTER": "", "MODE": "F", "VALUE": 255.0,"ACTIVE":0}
+        DATA["GREEN"] = {"NR": 4, "MASTER": "", "MODE": "F", "VALUE": 255.0,"ACTIVE":0}
+        DATA["BLUE"]  = {"NR": 5, "MASTER": "", "MODE": "F", "VALUE": 127.0,"ACTIVE":0}
+        fix = {"DMX": 20, "UNIVERS": 2, "NAME": "IRGB", "ATTRIBUT": DATA}
+
+        DATA = OrderedDict()
+        DATA["VDIM"]  = {"NR": -1, "MASTER": "", "MODE": "F", "VALUE": 0.0,"ACTIVE":0}
+        DATA["RED"]   = {"NR": 2, "MASTER": "1", "MODE": "F", "VALUE": 255.0,"ACTIVE":0}
+        DATA["GREEN"] = {"NR": 1, "MASTER": "1", "MODE": "F", "VALUE": 255.0,"ACTIVE":0}
+        DATA["BLUE"]  = {"NR": 0, "MASTER": "1", "MODE": "F", "VALUE": 127.0,"ACTIVE":0}
+        fix3 = {"DMX": 20, "UNIVERS": 2, "NAME": "VRGB", "ATTRIBUT": DATA}
+
+        DATA = OrderedDict()
+        DATA["DIM-FINE"]  = {"NR": 8, "MASTER": "", "MODE": "F", "VALUE": 5.0,"ACTIVE":0}
+        DATA["VDIM"]  = {"NR": -1, "MASTER": "", "MODE": "F", "VALUE": 0.0,"ACTIVE":0}
+        DATA["PAN"]   = {"NR": 0, "MASTER": "", "MODE": "F", "VALUE": 127.0,"ACTIVE":0}
+        DATA["PAN-FINE"]   = {"NR": 1, "MASTER": "", "MODE": "F", "VALUE": 127.0,"ACTIVE":0}
+        DATA["TILT"]  = {"NR": 2, "MASTER": "", "MODE": "F", "VALUE": 127.0,"ACTIVE":0}
+        DATA["TILT-FINE"]  = {"NR": 3, "MASTER": "", "MODE": "F", "VALUE": 127.0,"ACTIVE":0}
+        DATA["RED"]   = {"NR": 6, "MASTER": "1", "MODE": "F", "VALUE": 255.0,"ACTIVE":0}
+        DATA["GREEN"] = {"NR": 7, "MASTER": "1", "MODE": "F", "VALUE": 255.0,"ACTIVE":0}
+        DATA["BLUE"]  = {"NR": 8, "MASTER": "1", "MODE": "F", "VALUE": 127.0,"ACTIVE":0}
+        fixTMH = {"DMX": 20, "UNIVERS": 2, "NAME": "MH-BEAM", "ATTRIBUT": DATA}
+
+        fi = copy.deepcopy(fixTMH)
+        fi["DMX"] = 241
+        fixture["2001"] = fi
+
+        fi = copy.deepcopy(fixTMH)
+        fi["DMX"] = 461
+        fixture["2002"] = fi
+
+        fi = copy.deepcopy(fix3)
+        fi["DMX"] = 441
+        fixture["2003"] = fi
+
+        fi = copy.deepcopy(fix3)
+        fi["DMX"] = 461
+        fixture["2005"] = fi
+        
+
+        
+        fi = copy.deepcopy(fix)
+        fi["DMX"] = 401
+        fixture["1001"] = fi
+        
+        fi = copy.deepcopy(fix)
+        fi["DMX"] = 421
+        fi["ATTRIBUT"]["BLUE"]["VALUE"] = 22
+        fixture["1002"] = fi
+
+        fi = copy.deepcopy(fix)
+        fi["DMX"] = 441
+        fi["ATTRIBUT"]["BLUE"]["VALUE"] = 22
+        fixture["1003"] = fi
+        
+        self.fixtures = fixture
+        self.preset = OrderedDict()
+        #["IRIS   OPEN", {"74": {"IRIS": 0.0, "_activ": 1, "_selection_nr": 1}}],
+        for i in range(60):
+            self.preset["NAME"] = "PRESET "+str(i+1)
+            DATA = OrderedDict()
+            DATA["2001"] = {"VDIM":200,"RED":2}
+            DATA["2002"] = {"VDIM":100,"RED":2}
+            DATA["2003"] = {"VDIM":50,"RED":2}
+            
+            self.preset["DATA"] = DATA
+            
+            
+    def draw_fix(self,fix,data):
+        i=0
+        c=0
+        r=0
+        frame = tk.Frame(root,bg="black")
+        frame.pack(fill=tk.X, side=tk.TOP)
+
+        b = tk.Button(frame,bg="lightblue", text="FIX:"+str(fix)+" "+data["NAME"],width=20)
+        b.bind("<Button>",Xevent(elem=b).cb)
+        b.grid(row=r, column=c, sticky=tk.W+tk.E)
+        c+=1
+        #r+=1
+        if fix not in self.elem_attr:
+            self.elem_attr[fix] = {}
+            
+        for attr in data["ATTRIBUT"]:
+            
+            if attr not in self.all_attr:
+                self.all_attr.append(attr)
+            if attr not in self.elem_attr[fix]:
+                self.elem_attr[fix][attr] = []
+            if attr.endswith("-FINE"):
+                continue
+            v= data["ATTRIBUT"][attr]["VALUE"]
+            
+            b = tk.Button(frame,bg="grey", text=str(attr)+' '+str(round(v,2)),width=10)
+            self.elem_attr[fix][attr] = b
+            b.bind("<Button>",Xevent(elem=b,attr=attr,data=data).cb)
+            b.grid(row=r, column=c, sticky=tk.W+tk.E)
+            c+=1
+            if c >=8:
+                c=0
+                r+=1
+                
+    def draw_enc(self):
+        i=0
+        c=0
+        r=0
+        frame = tk.Frame(root,bg="black")
+        frame.pack(fill=tk.X, side=tk.TOP)
+
+        b = tk.Label(frame,bg="black", text="--------------------------------------- ---------------------------------------")
+        b.grid(row=r, column=c, sticky=tk.W+tk.E)
+        r=0
+        
+        frame = tk.Frame(root,bg="black")
+        frame.pack(fill=tk.X, side=tk.TOP)
+
+        
+        b = tk.Button(frame,bg="lightblue", text="ENCODER")
+        #b.bind("<Button>",Xevent(elem=b).cb)
+        b.grid(row=r, column=c, sticky=tk.W+tk.E)
+        r+=1      
+        for attr in self.all_attr:
+            if attr.endswith("-FINE"):
+                continue
+            v=0
+            b = tk.Button(frame,bg="orange", text=str(attr)+'',width=10)
+            b.bind("<Button>",Xevent(elem=b,attr=attr,data=self,mode="ENCODER").cb)
+            b.grid(row=r, column=c, sticky=tk.W+tk.E)
+            c+=1
+            if c >=8:
+                c=0
+                r+=1
+    def draw_command(self):
+        i=0
+        c=0
+        r=0
+        frame = tk.Frame(root,bg="black")
+        frame.pack(fill=tk.X, side=tk.TOP)
+
+        b = tk.Label(frame,bg="black", text="--------------------------------------- ---------------------------------------")
+        b.grid(row=r, column=c, sticky=tk.W+tk.E)
+        r=0
+        
+        frame = tk.Frame(root,bg="black")
+        frame.pack(fill=tk.X, side=tk.TOP)
+       
+        b = tk.Button(frame,bg="lightblue", text="COMMANDS")
+        #b.bind("<Button>",Xevent(elem=b).cb)
+        b.grid(row=r, column=c, sticky=tk.W+tk.E)
+        r+=1      
+        for comm in self.commands:
+            v=0
+            
+            b = tk.Button(frame,bg="white", text=str(comm),width=10)
+            if comm not in self.elem_command:
+                self.elem_command[comm] = b
+                self.val_commands[comm] = 0
+            b.bind("<Button>",Xevent(elem=b,attr=comm,data=self,mode="COMMAND").cb)
+            b.grid(row=r, column=c, sticky=tk.W+tk.E)
+            c+=1
+            if c >=8:
+                c=0
+                r+=1
+    def draw_preset(self):
+        i=0
+        c=0
+        r=0
+        frame = tk.Frame(root,bg="black")
+        frame.pack(fill=tk.X, side=tk.TOP)
+
+        b = tk.Label(frame, text="--------------------------------------- ---------------------------------------")
+        b.grid(row=r, column=c, sticky=tk.W+tk.E)
+        r=0
+        
+        frame = tk.Frame(root,bg="black")
+        frame.pack(fill=tk.X, side=tk.TOP)
+       
+        b = tk.Button(frame,bg="lightblue", text="PRESET")
+        #b.bind("<Button>",Xevent(elem=b).cb)
+        b.grid(row=r, column=c, sticky=tk.W+tk.E)
+        r+=1      
+        for k in self.commands:
+            v=0
+            b = tk.Button(frame,bg="white", text=str(k))
+            b.bind("<Button>",Xevent(elem=b,attr=k,data=self,mode="COMMAND").cb)
+            b.grid(row=r, column=c, sticky=tk.W+tk.E)
+            c+=1
+            if c >=8:
+                c=0
+                r+=1
+    def render(self):
+        for fix in self.fixtures:
+            data = self.fixtures[fix]
+            print( fix)
+            self.draw_fix(fix,data)
+        self.draw_enc()
+        self.draw_command()
+
+master =Master()
+master.render()
+
+
+root.mainloop()
+
+    
+sys.exit()
+
+cmd = ["BLIND",]
+frame = tk.Frame(root,bg="black")
+frame.pack(fill=tk.X, side=tk.TOP)
+data = []
+i=0
+for r in range(3):
+    frame.columnconfigure(r, weight=1)
+    cd = []
+    for c in range(8):
+        i+=1
+        frame.columnconfigure(c, weight=1)
+        b = tk.Button(frame,bg="red", text='MH'+str(i)+' r:'+str(r+1)+' c:'+str(c+1))
+        b.bind("<Button>",Xevent(o=b).cb)
+        b.grid(row=r, column=c, sticky=tk.W+tk.E)
+        cd.append(b)
+
+
+
+
+#fixture.append(fix)
+frame = tk.Frame(root,bg="black")
+frame.pack(fill=tk.X, side=tk.TOP)
+data = []
+i=0
+for r in range(3):
+    frame.columnconfigure(r, weight=1)
+    cd = []
+    for c in range(8):
+        i+=1
+        frame.columnconfigure(c, weight=1)
+        b = tk.Button(frame,bg="red", text='MH'+str(i)+' r:'+str(r+1)+' c:'+str(c+1))
+        b.bind("<Button>",wheel)
+        b.grid(row=r, column=c, sticky=tk.W+tk.E)
+        cd.append(b)
+
+frame = tk.Frame(root,bg="black")
+frame.pack(fill=tk.X, side=tk.TOP)
+data = []
+i=0
+for c in range(8):
+    frame.columnconfigure(c, weight=1)
+    cd = []
+    for r in range(3):
+        i+=1
+        frame.columnconfigure(r, weight=1)
+        b = tk.Button(frame,bg="green", text='PAN'+str(i)+' r:'+str(r+1)+' c:'+str(c+1))
+        b.grid(row=r, column=c, sticky=tk.W+tk.E)
+        cd.append(b)
+
+
+frame = tk.Frame(root,bg="black")
+frame.pack(fill=tk.X, side=tk.TOP)
+data = []
+for c in range(10):
+    frame.columnconfigure(c, weight=1)
+    cd = []
+    for r in range(10):
+        frame.columnconfigure(r, weight=1)
+        b = tk.Button(frame, text='r:'+str(r+1)+' c:'+str(c+1))
+        b.grid(row=r, column=c, sticky=tk.W+tk.E)
+        cd.append(b)
+
+
+frame = tk.Frame(root,bg="black")
+frame.pack(fill=tk.X, side=tk.TOP)
+data = []
+for c in range(3):
+    frame.columnconfigure(c, weight=1)
+    cd = []
+    for r in range(3):
+        frame.columnconfigure(r, weight=1)
+        b = tk.Button(frame,bg="grey", text='r:'+str(r+1)+' c:'+str(c+1))
+        b.grid(row=r, column=c, sticky=tk.W+tk.E)
+        cd.append(b)        
+
+root.mainloop()

+ 43 - 0
fx.py

@@ -0,0 +1,43 @@
+
+
+
+import lib.chat as chat
+import time
+
+import lib.motion as motion 
+
+def inp():
+    c = chat.tcp_sender()
+    while 1:
+        x = input(":: ")
+        c.send(x)
+
+
+fx = []
+#for i in range(10):
+def loop():
+    c = chat.tcp_sender()
+    x = 0
+
+    fx1 = motion.Effect(size=30,speed=2500)
+    fx2 = motion.Effect(TYPE="cosinus",size=30,speed=2500)
+    fd1 = motion.FadeFast(start=10,target=10,fadetime=4)
+    
+    while 1:
+        xfd1= int(fd1.next())
+        #print("fd",xfd1)
+        if xfd1 == 10:
+            fd1 = motion.FadeFast(start=xfd1,target=200,fadetime=4)
+        if xfd1 == 200:
+            fd1 = motion.FadeFast(start=xfd1,target=10,fadetime=4)
+
+        x1 = int(fx1.next(50))
+        x2 = int(fx2.next(127))
+        x += 3
+        if x >= 255:
+            x=0
+        c.send("d201:{},d241:{},d243:{}".format(xfd1,x2,x1))
+        time.sleep(0.051)
+
+loop()
+#inp()

+ 5 - 4
lib/chat.py

@@ -26,14 +26,15 @@ import time
 
 
 class tcp_sender(object):
-    def __init__(self):
+    def __init__(self,port=50000):
+        self.port = port
         self.connect()
         
     def connect(self,client_name="unkown"):
         self.xip = "127.0.0.1" #raw_input("IP-Adresse: ")
         self.xs = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
         try:
-            self.xs.connect((self.xip, 50000))
+            self.xs.connect((self.xip, self.port)) #50000))
         except ConnectionRefusedError as e:
             print("ConnectionRefusedError: ", "ERR: {0} ".format(e.args) ,end="")
             print("Server nicht ereichbar/unterbrochen")
@@ -56,7 +57,7 @@ def dummyCB(msg):
     print("dummy_CB",msg)
 
 
-def cmd(cb=dummyCB):
+def cmd(cb=dummyCB,port=50000):
     import socket
     import select
 
@@ -64,7 +65,7 @@ def cmd(cb=dummyCB):
     server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
     #self.xs.getsockopt(socket.AF_INET, socket.SO_REUSEADDR )
 
-    server.bind(("", 50000))
+    server.bind(("", port))
     server.listen(1)
 
     clients = []

+ 43 - 0
preset.py

@@ -0,0 +1,43 @@
+
+
+
+import lib.chat as chat
+import time
+
+import lib.motion as motion 
+
+def inp():
+    c = chat.tcp_sender()
+    while 1:
+        x = input(":: ")
+        c.send(x)
+
+
+fx = []
+#for i in range(10):
+def loop():
+    c = chat.tcp_sender()
+    x = 0
+
+    fx1 = motion.Effect(size=30,speed=2500)
+    fx2 = motion.Effect(TYPE="cosinus",size=30,speed=2500)
+    fd1 = motion.FadeFast(start=10,target=10,fadetime=4)
+    
+    while 1:
+        xfd1= int(fd1.next())
+        #print("fd",xfd1)
+        if xfd1 == 10:
+            fd1 = motion.FadeFast(start=xfd1,target=200,fadetime=4)
+        if xfd1 == 200:
+            fd1 = motion.FadeFast(start=xfd1,target=10,fadetime=4)
+
+        x1 = int(fx1.next(50))
+        x2 = int(fx2.next(127))
+        x += 3
+        if x >= 255:
+            x=0
+        c.send("d201:{},d241:{},d243:{}".format(xfd1,x2,x1))
+        time.sleep(0.051)
+
+loop()
+#inp()

+ 1 - 0
show/mitte.p

@@ -0,0 +1 @@
+RED=d205:255,d206:0,d207:0

+ 3 - 0
show/preset.log

@@ -0,0 +1,3 @@
+RED=RED:255,BLUE:0,GREEN:0
+BLUE=RED:0,BLUE:255,GREEN:0
+GREEN=RED:0,BLUE:0,GREEN:255

+ 3 - 0
show/rot.p

@@ -0,0 +1,3 @@
+d205:255,d206:0,d207:0
+d205:255,d206:0,d207:0
+d205:255,d206:0,d207:0