You can subscribe to this list here.
2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(121) |
Dec
(58) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2011 |
Jan
(38) |
Feb
(36) |
Mar
(7) |
Apr
(2) |
May
(32) |
Jun
(24) |
Jul
(16) |
Aug
(21) |
Sep
(17) |
Oct
(62) |
Nov
(60) |
Dec
(70) |
2012 |
Jan
(54) |
Feb
(41) |
Mar
(21) |
Apr
(38) |
May
(76) |
Jun
(47) |
Jul
(25) |
Aug
(72) |
Sep
(29) |
Oct
(64) |
Nov
(93) |
Dec
(97) |
2013 |
Jan
(100) |
Feb
(168) |
Mar
(115) |
Apr
(59) |
May
(37) |
Jun
(32) |
Jul
(45) |
Aug
(42) |
Sep
(24) |
Oct
(73) |
Nov
(64) |
Dec
(4) |
2014 |
Jan
(14) |
Feb
(57) |
Mar
(58) |
Apr
(10) |
May
(18) |
Jun
(12) |
Jul
(7) |
Aug
(12) |
Sep
(15) |
Oct
(6) |
Nov
(32) |
Dec
(17) |
2015 |
Jan
(50) |
Feb
(5) |
Mar
(1) |
Apr
(26) |
May
(10) |
Jun
(3) |
Jul
(3) |
Aug
(2) |
Sep
(3) |
Oct
(18) |
Nov
(18) |
Dec
(8) |
2016 |
Jan
(33) |
Feb
(35) |
Mar
(50) |
Apr
(20) |
May
(25) |
Jun
(17) |
Jul
(8) |
Aug
(73) |
Sep
(64) |
Oct
(51) |
Nov
(20) |
Dec
(14) |
2017 |
Jan
(41) |
Feb
(57) |
Mar
(44) |
Apr
(136) |
May
(32) |
Jun
(39) |
Jul
(2) |
Aug
(12) |
Sep
(32) |
Oct
(103) |
Nov
(12) |
Dec
(4) |
2018 |
Jan
(9) |
Feb
(1) |
Mar
(60) |
Apr
(24) |
May
(15) |
Jun
(1) |
Jul
(2) |
Aug
(23) |
Sep
(15) |
Oct
(57) |
Nov
(21) |
Dec
(77) |
2019 |
Jan
(62) |
Feb
(99) |
Mar
(98) |
Apr
(49) |
May
(6) |
Jun
(3) |
Jul
(6) |
Aug
(18) |
Sep
(9) |
Oct
(15) |
Nov
(30) |
Dec
(6) |
2020 |
Jan
(14) |
Feb
(2) |
Mar
(22) |
Apr
(33) |
May
(47) |
Jun
(12) |
Jul
|
Aug
|
Sep
(4) |
Oct
(2) |
Nov
(5) |
Dec
(5) |
2021 |
Jan
(4) |
Feb
(101) |
Mar
(13) |
Apr
(32) |
May
(40) |
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
(25) |
Nov
(12) |
Dec
|
2022 |
Jan
(154) |
Feb
(82) |
Mar
(63) |
Apr
(27) |
May
(26) |
Jun
(5) |
Jul
(12) |
Aug
(23) |
Sep
(17) |
Oct
(37) |
Nov
(13) |
Dec
(21) |
2023 |
Jan
(43) |
Feb
(43) |
Mar
(15) |
Apr
(8) |
May
(3) |
Jun
(25) |
Jul
(6) |
Aug
(38) |
Sep
(5) |
Oct
(20) |
Nov
(9) |
Dec
(28) |
2024 |
Jan
(15) |
Feb
(2) |
Mar
(12) |
Apr
(2) |
May
(8) |
Jun
(10) |
Jul
(10) |
Aug
(2) |
Sep
(3) |
Oct
(15) |
Nov
(6) |
Dec
(20) |
2025 |
Jan
|
Feb
(2) |
Mar
(6) |
Apr
(2) |
May
(2) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <net...@us...> - 2010-11-07 00:04:45
|
Revision: 90 http://openautomation.svn.sourceforge.net/openautomation/?rev=90&view=rev Author: netzkind Date: 2010-11-06 22:51:09 +0000 (Sat, 06 Nov 2010) Log Message: ----------- fixed error in logic for address syntax check Modified Paths: -------------- CometVisu/trunk/visu/edit/visuconfig_edit.js Modified: CometVisu/trunk/visu/edit/visuconfig_edit.js =================================================================== --- CometVisu/trunk/visu/edit/visuconfig_edit.js 2010-11-06 18:48:39 UTC (rev 89) +++ CometVisu/trunk/visu/edit/visuconfig_edit.js 2010-11-06 22:51:09 UTC (rev 90) @@ -361,7 +361,7 @@ switch (type) { case "address": - return !Boolean(val.match(/^[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{1,2}$/)); + return Boolean(val.match(/^[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{1,2}$/) != null); break; case "numeric": return Boolean(val.match(/^\d+([\.,]\d+)?$/g)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-06 23:29:10
|
Revision: 91 http://openautomation.svn.sourceforge.net/openautomation/?rev=91&view=rev Author: nilss1 Date: 2010-11-06 23:29:03 +0000 (Sat, 06 Nov 2010) Log Message: ----------- no longer get WireGateInstance as Argument to new Classes, instead user parent Class and make self.WG = parent.WG. This way each class can reach all parents using self._parent Modified Paths: -------------- PyWireGate/trunk/WireGate.py PyWireGate/trunk/comet_server/CometServer.py PyWireGate/trunk/connector.py PyWireGate/trunk/console_server/consoleserver.py PyWireGate/trunk/cycler.py PyWireGate/trunk/datastore.py PyWireGate/trunk/knx_connector/BusMonitor.py PyWireGate/trunk/knx_connector/DPT_Types.py PyWireGate/trunk/knx_connector/GroupSocket.py PyWireGate/trunk/knx_connector/KNX_Connector.py PyWireGate/trunk/owfs_connector/OWFS_Connector.py Modified: PyWireGate/trunk/WireGate.py =================================================================== --- PyWireGate/trunk/WireGate.py 2010-11-06 22:51:09 UTC (rev 90) +++ PyWireGate/trunk/WireGate.py 2010-11-06 23:29:03 UTC (rev 91) @@ -31,6 +31,7 @@ class WireGate(daemon.Daemon): def __init__(self,REDIRECTIO=False): + self._parent = self self.WG = self self.watchdoglist = {} self.connectors = {} Modified: PyWireGate/trunk/comet_server/CometServer.py =================================================================== --- PyWireGate/trunk/comet_server/CometServer.py 2010-11-06 22:51:09 UTC (rev 90) +++ PyWireGate/trunk/comet_server/CometServer.py 2010-11-06 23:29:03 UTC (rev 91) @@ -33,8 +33,12 @@ CONNECTOR_NAME = 'Comet Server' CONNECTOR_VERSION = 0.1 CONNECTOR_LOGNAME = 'comet_server' - def __init__(self,WireGateInstance, instanceName): - self.WG = WireGateInstance + def __init__(self,parent, instanceName): + self._parent = parent + if parent: + self.WG = parent.WG + else: + self.WG = False self.instanceName = instanceName defaultconfig = { 'port' : 4498 Modified: PyWireGate/trunk/connector.py =================================================================== --- PyWireGate/trunk/connector.py 2010-11-06 22:51:09 UTC (rev 90) +++ PyWireGate/trunk/connector.py 2010-11-06 23:29:03 UTC (rev 91) @@ -7,8 +7,9 @@ CONNECTOR_LOGNAME = __name__ isrunning=False - def __init__(self,WireGateInstance,instanceName): - self.WG = WireGateInstance + def __init__(self,parent,instanceName): + self._parent = parent + self.WG = parent.WG self.instanceName = instanceName """Overide""" def start(self): @@ -24,7 +25,7 @@ def log(self,msg,severity='info',instance=False): if not instance: instance = self.instanceName - self.WG.log(msg,severity,instance) + self._parent.log(msg,severity,instance) def shutdown(self): self.log("%s (%s) shutting down" % (self.CONNECTOR_NAME, self.instanceName) ,'info','WireGate') Modified: PyWireGate/trunk/console_server/consoleserver.py =================================================================== --- PyWireGate/trunk/console_server/consoleserver.py 2010-11-06 22:51:09 UTC (rev 90) +++ PyWireGate/trunk/console_server/consoleserver.py 2010-11-06 23:29:03 UTC (rev 91) @@ -35,8 +35,12 @@ CONNECTOR_VERSION = 0.1 CONNECTOR_LOGNAME = 'console_server' - def __init__(self,WireGateInstance, instanceName): - self.WG = WireGateInstance + def __init__(self,parent, instanceName): + self._parent = parent + if parent: + self.WG = parent.WG + else: + self.WG = False self.instanceName = instanceName defaultconfig = { 'port' : 4401 Modified: PyWireGate/trunk/cycler.py =================================================================== --- PyWireGate/trunk/cycler.py 2010-11-06 22:51:09 UTC (rev 90) +++ PyWireGate/trunk/cycler.py 2010-11-06 23:29:03 UTC (rev 91) @@ -20,101 +20,146 @@ import time -class cycler: - def __init__(self,WireGateInstance): - self.WG = WireGateInstance - +class TaskRunner: + def __init__(self,parent): + self._parent = parent + if parent: + self.WG = parent.WG + else: + self.WG = False self.isrunning = True - ## Dummy Timer + self.waiting = threading.Timer(0,lambda: None) - self.waiting.setDaemon(1) + + self.mutex = threading.RLock() + + ## function for time based sortingg of tasks self.getTime = lambda x: x.getTime - self.timerList = [] + + ## all not running tasks goes here + self.taskList = [] + + ## all started tasks goes here self.running = {} def debug(self,msg): print "DEBUG Cycler: %s" % msg - def remove(self, obj): + + def remove(self, task): if not self.isrunning: - ## dont try to get a mutex + + ## dont try to get a mutex on shutdown return False try: self.mutex.acquire() - if obj in self.timerList: + if task in self.taskList: try: - self.timerList.remove(obj) + self.taskList.remove(task) except: pass - self.debug("Removed %r" % obj.action) - if len(self.timerList) == 0: + self.debug("Removed %r" % task.action) + if len(self.taskList) == 0: ## kill waiting timer self.debug("Cancel GLobal wait") self.waiting.cancel() - if obj in self.running: + + if task in self.running: try: - if self.running[obj].isAlive(): - self.running[obj].cancel() - self.debug("Canceled %r" % obj.args) + if self.running[task].isAlive(): + self.running[task].cancel() + self.debug("Canceled %r" % task.args) finally: - self.debug("terminated %r" % obj.args) - del self.running[obj] + self.debug("terminated %r" % task.args) + del self.running[task] finally: self.mutex.release() + + + def event(self,rtime,function,*args,**kwargs): + if not self.isrunning: + ## dont try to get a mutex + return False + self.debug("adding event: %r (%r / %r)" % (function,args,kwargs)) + ## rtime is a date as unix timestamp + rtime = rtime - time.time() + if rtime >0: + task = Task(self,rtime,function,args=args,kwargs=kwargs) + self._Shedule(task) + return task + else: + print "expired %r (%r / %r)" % (function,args,kwargs) + def add(self,rtime,function,*args,**kwargs): if not self.isrunning: ## dont try to get a mutex return False self.debug("adding task: %r (%r / %r)" % (function,args,kwargs)) - self.addShedule(sheduleObject(self,self.WG,rtime,function,args=args,kwargs=kwargs)) + task = Task(self,rtime,function,args=args,kwargs=kwargs) + self._Shedule(task) + return task def cycle(self,rtime,function,*args,**kwargs): if not self.isrunning: ## dont try to get a mutex return False self.debug("adding cycliv task: %r (%r / %r)" % (function,args,kwargs)) - self.addShedule(sheduleObject(self,self.WG,rtime,function,cycle=True,args=args,kwargs=kwargs)) + task = Task(self,rtime,function,cycle=True,args=args,kwargs=kwargs) + self._Shedule(task) + return task - def addShedule(self,shed): - print "ADD _shed %r" % shed + def _Shedule(self,task): + print "adding task %r" % task self.mutex.acquire() - self.timerList.append(shed) + self.taskList.append(task) + ## Try to stop running timer + ## Fixme isalive try: self.waiting.cancel() except: pass - self.timerList.sort(key=self.getTime) + + self.taskList.sort(key=self.getTime) self.mutex.release() ## check if any Timer need activation self._check() - return shed - - + def _check(self): self.debug("Cycle") try: self.mutex.acquire() + print "acitve tasks %d " % threading.activeCount() + atasks = "Active tasks: " + for rtask in threading.enumerate(): + atasks += " %r" % rtask.getName() + + + print atasks ## all actions that need activation in next 60seconds - for shedobj in filter(lambda x: x.getTime() < 60, self.timerList): + for task in filter(lambda x: x.getTime() < 60, self.taskList): try: - self.running[shedobj] = threading.Timer(shedobj.getTime(),shedobj.run) - self.running[shedobj].start() - #print "run %s" % t.name + exectime = task.getTime() + name = "event" + if task.cycle: + name = "cycle" + self.running[task] = threading.Timer(exectime,task.run) + self.running[task].setName("%s_%r" % (name,time.asctime(time.localtime(task.timer)))) + self.running[task].start() except: print "Failed" raise - ## remove from List because its now in the past - self.timerList.remove(shedobj) + ## remove from List because its now active + self.taskList.remove(task) finally: - if len(self.timerList) >0: - print "Wait for later timer %r" % (self.timerList[0].getTime()-5) - self.waiting = threading.Timer(self.timerList[0].getTime()-5 ,self._check) + if len(self.taskList) >0: + print "Wait for later timer %r" % (self.taskList[0].getTime()-5) + self.waiting = threading.Timer(self.taskList[0].getTime()-5 ,self._check) self.waiting.start() self.mutex.release() @@ -125,35 +170,36 @@ try: ## stop all new timer self.mutex.acquire() + self.taskList = [] + for task in self.running.keys(): + print "acitve tasks %d " % threading.activeCount() + print "cancel task %r" % task.args + try: + rtask = self.running.pop(task) + rtask.cancel() + rtask.join() + except: + pass + + print self.waiting + print "Have Mutex" - self.waiting.cancel() try: - self.waiting.join(2) + self.waiting.cancel() + self.waiting.join() except: - ## maybe not even running pass print "Thread canceld" - self.timerList = [] - for obj in self.running.keys(): - print "cancel task %r" % obj.args - try: - tobecanceled = self.running.pop(obj) - - except: - pass - tobecanceled.cancel() - tobecanceled.is - tobecanceled.join(2) - - + + except: self.debug("SHUTDOWN FAILED") -class sheduleObject: - def __init__(self,parent,WireGateInstance,rtime,function,cycle=False,args = [],kwargs={}): +class Task: + def __init__(self,parent,rtime,function,cycle=False,args = [],kwargs={}): self.Parent = parent - self.WG = WireGateInstance + self.WG = parent.WG self.delay = rtime self.cycle = cycle self._set() @@ -171,7 +217,7 @@ self.Parent.remove(self) if self.cycle: self._set() - self.Parent.addShedule(self) + self.Parent._Shedule(self) def getTime(self): @@ -181,23 +227,37 @@ if __name__ == '__main__': try: - cycle = cycler(False) + cycle = TaskRunner(False) import sys import atexit - atexit.register(cycle.shutdown) + #atexit.register(cycle.shutdown) def write_time(text=''): print "running %s: %f" % (text,time.time()) write_time('Main') - cycle.cycle(4,write_time,"Cycletask1!") - #longtask=cycle.add(80,write_time,"task2!") - #f=cycle.add(7,write_time,"task3!") + cycle1 = cycle.cycle(4,write_time,"Cycletask1!") + cycle2 = cycle.cycle(8,write_time,"Cycletask2!") + + longtask=cycle.add(80,write_time,"Longtask 80 secs!") + + f=cycle.add(7,write_time,"task3!") + + cycle.event(time.mktime((2010,11,6,21,54,00,0,0,0)),write_time,"event 21:54") time.sleep(2) - #cycle.remove(f) - #time.sleep(5) - #cycle.remove(longtask) + cycle.remove(f) + time.sleep(5) + print "##################remove longtask %r" % longtask + cycle.remove(longtask) + + #cycle.cycle(4,write_time,"Cycletask6!") + print "KILL CYCLE" + cycle.remove(cycle1) + cycle.remove(cycle2) #cycle.shutdown() #cycle.add(6,write_time,"task4!") + while threading.activeCount() > 1: + time.sleep(1) except KeyboardInterrupt: - #cycle.shutdown() + cycle.shutdown() + cycle.waiting.join(5) sys.exit(0) Modified: PyWireGate/trunk/datastore.py =================================================================== --- PyWireGate/trunk/datastore.py 2010-11-06 22:51:09 UTC (rev 90) +++ PyWireGate/trunk/datastore.py 2010-11-06 23:29:03 UTC (rev 91) @@ -15,7 +15,7 @@ """ Datastore Instance """ - def __init__(self,WireGateInstance): + def __init__(self,parent): #################################################### ## Function: __init__ ## Parameter: @@ -24,7 +24,8 @@ ## Contructor for the DATASTORE instance ## #################################################### - self.WG = WireGateInstance + self._parent = parent + self.WG = parent.WG self.log("DATASTORE starting up") self.DBLOADED = False self.dataobjects = {} @@ -82,7 +83,7 @@ type(self.dataobjects[id]) except KeyError: ## create a new one if it don't exist - self.dataobjects[id] = dataObject(self.WG,id) + self.dataobjects[id] = dataObject(self,id) ## return it self.locked.release() return self.dataobjects[id] @@ -95,7 +96,7 @@ loaddict = json.load(db) db.close() for name, obj in loaddict.items(): - self.dataobjects[name] = dataObject(self.WG,obj['id'],obj['name']) + self.dataobjects[name] = dataObject(self,obj['id'],obj['name']) self.dataobjects[name].lastupdate = obj['lastupdate'] self.dataobjects[name].config = obj['config'] self.dataobjects[name].connected = obj['connected'] @@ -154,8 +155,9 @@ class dataObject: - def __init__(self,WireGateInstance,id,name=False): - self.WG = WireGateInstance + def __init__(self,parent,id,name=False): + self._parent = parent + self.WG = parent.WG ## Threadlocking self.write_mutex = threading.RLock() Modified: PyWireGate/trunk/knx_connector/BusMonitor.py =================================================================== --- PyWireGate/trunk/knx_connector/BusMonitor.py 2010-11-06 22:51:09 UTC (rev 90) +++ PyWireGate/trunk/knx_connector/BusMonitor.py 2010-11-06 23:29:03 UTC (rev 91) @@ -20,12 +20,15 @@ import time class busmonitor: - def __init__(self, WireGateInstance,connectorInstance): - self.WG = WireGateInstance - self.KNX = connectorInstance + def __init__(self, parent): + self._parent = parent + if parent: + self.WG = parent.WG + else: + self.WG = False self.nicehex=lambda x: " ".join(map(lambda y:"%.2x" % y,x)) self.tobinstr=lambda n,b=8: "".join([str((n >> y) & 1) for y in range(b-1, -1, -1)]) - self.dpt = DPT_Types.dpt_type(WireGateInstance) + self.dpt = DPT_Types.dpt_type(self) ## FIXME: Not fully implemented self.apcicodes = { @@ -101,7 +104,7 @@ if msg['ctrl2']['DestAddrType'] == 0 and msg['apdu']['tpdu'] == "T_DATA_XXX_REQ": msg['dstaddr'] = self._decodeGrpAddr(buf[3:5]) - id = "%s:%s" % (self.KNX.instanceName, msg['dstaddr']) + id = "%s:%s" % (self._parent.instanceName, msg['dstaddr']) ## search Datastoreobject dsobj = self.WG.DATASTORE.get(id) @@ -265,10 +268,15 @@ except KeyError: pass return apci + + def log(self,msg,severity='info',instance=False): + if not instance: + instance = self.instanceName + self._parent.log(msg,severity,instance) + def debug(self,msg): - #print "DEBUG: BUSMON: "+ repr(msg) - pass + self.log("DEBUG: BUSMON: "+ repr(msg),'debug') if __name__ == "__main__": Modified: PyWireGate/trunk/knx_connector/DPT_Types.py =================================================================== --- PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-06 22:51:09 UTC (rev 90) +++ PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-06 23:29:03 UTC (rev 91) @@ -23,8 +23,12 @@ import struct class dpt_type: - def __init__(self,WireGateInstance): - self.WG = WireGateInstance + def __init__(self,parent): + self._parent = parent + if parent: + self.WG = parent.WG + else: + self.WG = False self.DECODER = { 1:self.decodeDPT1, # EIS 1/7 / 1 bit 0=Aus/1=Ein 2:self.decodeDPT2, # EIS 8 / 2 bit 0,1=Frei/2=Prio_Aus/3=Prio_Ein @@ -133,8 +137,8 @@ def log(self,msg,severity='info',instance=False): if not instance: instance = "dpt-types" - if self.WG: - self.WG.log(msg,severity,instance) + if self._parent: + self._parent.log(msg,severity,instance) def toByteArray(self,val,length): ## Set ByteArray Modified: PyWireGate/trunk/knx_connector/GroupSocket.py =================================================================== --- PyWireGate/trunk/knx_connector/GroupSocket.py 2010-11-06 22:51:09 UTC (rev 90) +++ PyWireGate/trunk/knx_connector/GroupSocket.py 2010-11-06 23:29:03 UTC (rev 91) @@ -20,12 +20,15 @@ import time class groupsocket: - def __init__(self, WireGateInstance, connectorInstance): - self.WG = WireGateInstance - self.KNX = connectorInstance + def __init__(self, parent): + self._parent = parent + if parent: + self.WG = parent.WG + else: + self.WG = False self.nicehex=lambda x: " ".join(map(lambda y:"%.2x" % y,x)) self.tobinstr=lambda n,b=8: "".join([str((n >> y) & 1) for y in range(b-1, -1, -1)]) - self.dpt = DPT_Types.dpt_type(WireGateInstance) + self.dpt = DPT_Types.dpt_type(self) def decode(self,buf,src,dst): ## Accept List Hex or Binary Data @@ -49,7 +52,7 @@ msg['srcaddr'] = self._decodePhysicalAddr(src) try: msg['dstaddr'] = self._decodeGrpAddr(dst) - id = "%s:%s" % (self.KNX.instanceName, msg['dstaddr']) + id = "%s:%s" % (self._parent.instanceName, msg['dstaddr']) if (buf[0] & 0x3 or (buf[1] & 0xC0) == 0xC0): ##FIXME: unknown APDU self.debug("unknown APDU from "+msg['srcaddr']+" to "+msg['dstaddr']+ " raw:"+buf) @@ -88,9 +91,14 @@ def _decodeGrpAddr(self,raw): return "%d/%d/%d" % ((raw >> 11) & 0x1f, (raw >> 8) & 0x07, (raw) & 0xff) + + def log(self,msg,severity='info',instance=False): + if not instance: + instance = self.instanceName + self._parent.log(msg,severity,instance) def debug(self,msg): - #print "DEBUG: GROUPSOCKET: "+ repr(msg) + self.log("DEBUG: GROUPSOCKET: "+ repr(msg),'debug') pass Modified: PyWireGate/trunk/knx_connector/KNX_Connector.py =================================================================== --- PyWireGate/trunk/knx_connector/KNX_Connector.py 2010-11-06 22:51:09 UTC (rev 90) +++ PyWireGate/trunk/knx_connector/KNX_Connector.py 2010-11-06 23:29:03 UTC (rev 91) @@ -33,17 +33,18 @@ CONNECTOR_NAME = 'KNX Connector' CONNECTOR_VERSION = 0.2 CONNECTOR_LOGNAME = 'knx_connector' - def __init__(self,WireGateInstance, instanceName): - self.WG = WireGateInstance + def __init__(self,parent, instanceName): + self._parent = parent + self.WG = parent.WG self.instanceName = instanceName self.KNX = EIBConnection.EIBConnection() self.KNXBuffer = EIBConnection.EIBBuffer() self.KNXSrc = EIBConnection.EIBAddr() self.KNXDst = EIBConnection.EIBAddr() - self.busmon = BusMonitor.busmonitor(WireGateInstance,self) - self.groupsocket = GroupSocket.groupsocket(WireGateInstance,self) - self.dpt = DPT_Types.dpt_type(WireGateInstance) + self.busmon = BusMonitor.busmonitor(self) + self.groupsocket = GroupSocket.groupsocket(self) + self.dpt = DPT_Types.dpt_type(self) self.GrpAddrRegex = re.compile(r"(?:|(\d+)\x2F)(\d+)\x2F(\d+)$",re.MULTILINE) Modified: PyWireGate/trunk/owfs_connector/OWFS_Connector.py =================================================================== --- PyWireGate/trunk/owfs_connector/OWFS_Connector.py 2010-11-06 22:51:09 UTC (rev 90) +++ PyWireGate/trunk/owfs_connector/OWFS_Connector.py 2010-11-06 23:29:03 UTC (rev 91) @@ -26,8 +26,12 @@ CONNECTOR_NAME = 'OWFS Connector' CONNECTOR_VERSION = 0.1 CONNECTOR_LOGNAME = 'owfs_connector' - def __init__(self,WireGateInstance, instanceName): - self.WG = WireGateInstance + def __init__(self,parent, instanceName): + self._parent = parent + if parent: + self.WG = parent.WG + else: + self.WG = False self.instanceName = instanceName defaultconfig = { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <net...@us...> - 2010-11-06 18:48:47
|
Revision: 89 http://openautomation.svn.sourceforge.net/openautomation/?rev=89&view=rev Author: netzkind Date: 2010-11-06 18:48:39 +0000 (Sat, 06 Nov 2010) Log Message: ----------- new design, set as default: "discreet" Modified Paths: -------------- CometVisu/trunk/ChangeLog CometVisu/trunk/visu/index.html CometVisu/trunk/visu/lib/templateengine.js Added Paths: ----------- CometVisu/trunk/visu/fonts/ CometVisu/trunk/visu/fonts/AUTHORS CometVisu/trunk/visu/fonts/COPYING CometVisu/trunk/visu/fonts/ChangeLog CometVisu/trunk/visu/fonts/License.txt CometVisu/trunk/visu/fonts/README CometVisu/trunk/visu/fonts/TODO CometVisu/trunk/visu/fonts/liberationsans-bold.ttf CometVisu/trunk/visu/fonts/liberationsans-regular.ttf CometVisu/trunk/visu/images/ CometVisu/trunk/visu/images/body_bg.png CometVisu/trunk/visu/images/button_bg.png CometVisu/trunk/visu/images/dot_green.png CometVisu/trunk/visu/images/dot_red.png CometVisu/trunk/visu/images/gradient.png CometVisu/trunk/visu/images/hr_bg.png CometVisu/trunk/visu/style_discreet.css Modified: CometVisu/trunk/ChangeLog =================================================================== --- CometVisu/trunk/ChangeLog 2010-11-06 18:10:49 UTC (rev 88) +++ CometVisu/trunk/ChangeLog 2010-11-06 18:48:39 UTC (rev 89) @@ -11,6 +11,7 @@ - Added XML Schema / XSD to validate config-XML - New Feature: tag for videos (HTML5 based) - changed procedures for creating new widgets +- added design "discreet", set as default 0.5.0 ===== Added: CometVisu/trunk/visu/fonts/AUTHORS =================================================================== --- CometVisu/trunk/visu/fonts/AUTHORS (rev 0) +++ CometVisu/trunk/visu/fonts/AUTHORS 2010-11-06 18:48:39 UTC (rev 89) @@ -0,0 +1,23 @@ +AUTHORS + +Current Contributors (sorted alphabetically): + + - Caius 'kaio' Chance <caius.chance at gmail.com> + Project Owner + Red Hat, Inc. + + - Denis Jacquerye <moyogo at gmail.com> + Project Contributor + + - Herbert Duerr <duerr at sun.com> + Narrow Fonts Contributor + Oracle, Inc. + +Previous Contributors + + - Steve Matteson + Original Designer (support period expired) + Ascender, Inc. + + - Mark Webbink <mwebbink AT redhat.com> + Release coordinator, Red Hat Inc. Added: CometVisu/trunk/visu/fonts/COPYING =================================================================== --- CometVisu/trunk/visu/fonts/COPYING (rev 0) +++ CometVisu/trunk/visu/fonts/COPYING 2010-11-06 18:48:39 UTC (rev 89) @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program 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. + + This program 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 this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. Added: CometVisu/trunk/visu/fonts/ChangeLog =================================================================== --- CometVisu/trunk/visu/fonts/ChangeLog (rev 0) +++ CometVisu/trunk/visu/fonts/ChangeLog 2010-11-06 18:48:39 UTC (rev 89) @@ -0,0 +1,224 @@ +* Wed Jul 21 2010 Pravin Satpute <psa...@re...> +- Update for New Release 1.06 +- Added New Family Narrow (Contribution from Herbert Duerr <her...@or...>) +- updated version of fonts + +* Mon 10 May 2010 Caius 'kaio' Chance <me at kaio.net> +- Fixed Romanian glyphs, U+021A, 021B, 0218, 0219, 0162, 0163, 015E, 015F, + 2010, 2011. (rhbz#440992) +- Fixed height of arrows U+2190, 2192, 2194. (Issue #2) + +* Thu 06 May 2010 Caius 'kaio' Chance <me at kaio.net> +- Cleaned up points and auto-instructed hinting of 'u', 'v', 'w', 'y'. +(rhbz#463036) +- Created the first project icon. (Issue #5) + +* Wed May 05 2010 Caius 'kaio' Chance <k at kaio.net> +- Incorrect cent sign glyph (U+00A2) in Sans and Mono +style in Liberation fonts. (rhbz#474522) + +* Wed 28 Apr 2010 Caius 'kaio' Chance <me at kaio.net> +- rhbz#510174: Corrected version number of all SFD files. +- Corrected license exceptions to GPLv2. +- Updated README file. + +* Tue 27 Apr 2010 Caius 'kaio' Chance <me at kaio.net> +- Renamed Narrow Fonts. +- Updated list of contributors. +- Released version 1.05.3. + +* Thu 22 Apr 2010 Herbert Duerr <duerr at sun.com> +- Contributed Liberation Sans Narrow Fonts. + +* Fri 12 Mar 2010 Caius 'kaio' Chance <me at kaio.me> +- Migrated to Google Code. +- Updated AUTHORS. +- Upgraded license to GPLv3+exceptions. + +* Sun 27 Jul 2009 Caius 'kaio' Chance <me at kaio.me> +- Fixed ttf pack preparation error. + +* Tue 21 Jul 2009 Caius 'kaio' Chance <me at kaio.me> +- Fixed 'wrongly encoded glyphs after U+10000' (rhbz#525498), + provided by Denis Jacquerye <moyogo at gmail.com>. + +* Tue 21 Jul 2009 Caius 'kaio' Chance <me at kaio.me> +- Fixed fontforge script sfd2ttf.pe. +- Include traditional kern table for Sans and Serif. + +* Tue 14 Jul 2009 Caius 'kaio' Chance <me at kaio.me> +- Generated TTFs with tradition kern table, with fontforge ver 20090408. +- Added make target alias dist-src as dist-sfd. + +* Mon 13 Jul 2009 Caius 'kaio' Chance <me at kaio.me> +- Updated for generation of traditional kern table via scripts. + +* Mon 06 Jul 2009 Caius 'kaio' Chance <me at kaio.me> +- Reconverted SFDs from original TTFs with traditional kern table. +- Updated "clean" target in Makefile. + +* Tue 30 Jun 2009 Caius 'kaio' Chance <me at kaio.me> +- Reconverted SFDs from original TTFs with traditional kern table. +- Updated "clean" target in Makefile. + +* Tue 30 Jun 2009 Caius 'kaio' Chance <me at kaio.me> +- Generated cleaner SFD from original TTFs. +- Include Makefile in sources tarball. + +* Wed 24 Jun 2009 Caius 'kaio' Chance <me at kaio.me> +- Makefile: pack SFD files as source tarball. +- Makefile: pack TTF files as ttf packs. +- Tidy up repository. +- Updated documents. + +* Mon 12 Jan 2009 Caius Chance <cchance at redhat.com> +- Fixed copyright holder name typo for Sans Regular font (rhbz#479521). + +* Tue 09 Dec 2008 Caius Chance <cchance at redhat.com> +- Changed cent sign glyph (U+00A2) to be coressed in Sans and Mono + (rhbz#474522). + +* Wed 03 Dec 2008 Caius Chance <cchance at redhat.com> +- Started 1.04.93.devel. +- Fixed blurriness of U+03BC for Sans Regular font (rhbz#473481). +- Fixed src tarball mis-inclusion of dist files in Makefile. + +* Fri 28 Nov 2008 Caius Chance <cchance at redhat.com> +- Corrected version number in Makefile. +- Fixed make target of source tarball. +- Uploaded 1.04.92 source tarball to release area. + +* Wed 15 Oct 2008 Caius Chance <cchance at redhat.com> +- Fixed blurred 'u' and 'W' for Sans Bold font (rhbz#463036). +- Released as version 1.04.92 + +* Wed 17 Sep 2008 Caius Chance <cchance at redhat.com> +- Fixed missing hinting instructions for all Mono fonts (rhbz#460090). +- Fixed missing hinting instructions for all Sans fonts (rhbz#460090). +- Fixed missing hinting instructions for all Serif fonts (rhbz#460090). +- Released as version 1.04.91 + +* Tue 09 Sep 2008 Caius Chance <cchance at redhat.com> +- Backed up all released files in ./dist directory. + +* Fri 05 Sep 2008 Caius Chance <cchance at redhat.com> +- Fixed incorrect glyph points and missing hinting instructions for: + Mono Bold Italic (up to U+2012) (rhbz#460090). + +* Mon 25 Aug 2008 Caius Chance <cchance at redhat.com> +- Fixed incorrect glyph points and missing hinting instructions for: + U+0079, U+03BC, U+0431, U+2010..2012, U+1114117 (rhbz#458592). +- Released as version 1.04.90. + +* Thu 13 Jul 2008 Caius Chance <cchance at redhat.com> +- Released as version 1.04. + +* Thu 12 Jun 2008 Caius Chance <cchance at redhat.com> +- Released as version 1.04.beta2 (1.03.99). +- Added ZIP package building for non-tar users. +- rhbz#440992: + - Created Romanian "T/t/S/s with comma below" (U+0218..021B) on all fonts. + - Fixed "T/s with cedilla below" (U+0162/0163) on all fonts. + - Created "Hyphen" and "Non-Breaking Hyphen" (U+2010..2011) on all fonts. + +* Wed 11 Jun 2008 Caius Chance <cchance at redhat.com> +- Added last Version 1.03 from original manufacturer. +- Renamed directory 'archive' to 'sandbox'. +- Added directory description in hosting home directory. +- Created ZIP packages for Version 1.03 and 1.04.beta. + +* Tue 04 Jun 2008 Caius Chance <cchance at redhat.com> +- rhbz#440992: + - Created "Hyphen" and "Non-Breaking Hyphen" (U+2010..2011) on Sans Regular. + +* Mon 03 Jun 2008 Caius Chance <cchance at redhat.com> +- rhbz#440992: + - Created Romanian "T/t/S/s with comma below" (U+0218..021B) on Sans Regular. + - Fixed "T/s with cedilla below" (U+0162/0163) on Sans Regular. + +* Fri 30 May 2008 Caius Chance <cchance at redhat.com> +- Release Version 1.04.beta (liberation-fonts-1_04_beta). + +* Thu 29 May 2008 Caius Chance <cchance at redhat.com> +- Correct SFD version numbers in "TTF Info" categor for correct version + number during export to TTFs. + +* Wed 28 May 2008 Caius Chance <cchance at redhat.com> +- Reencoded with "Glyph Order" by FontForge. +- Corrected font name for all Regular fonts. +- Generated TTFs (experimantal, in "archive") with old stle kern and dummy + DSIG table. +- Updated README in 1.04b TTFs (experimental, in "archive"). + +* Tue 27 May 2008 Caius Chance <cchance at redhat.com> +- Fixed Unicode name mis-mapping of Sans and Serif TTF files. +- Regenerate SFD files from Unicode name mis-mapping fixed Sans and Serif TTF + files. + +* Mon 26 May 2008 Caius Chance <cchance at redhat.com> +- Fixed Unicode name mis-mapping of Mono TTF files. +- Regenerate SFD files from Unicode name mis-mapping fixed Mono TTF files. +========== +- Applied following patches submitted by Nicolas Spalinger + <nicolas_spalinger sil org>: + - We-need-versioned-tarballs. + - Add-ignore-file-so-the-VCS-does-not-track-the-folder. + - Adjust-path-for-various-Makefile-targets-subfolders. + - Fix-versionning-mismatch-in-the-binary-font-metadata. + - Add-some-description-and-extra-lines-to-the-build-ta. + - Reword-and-restructure-maintainers-recommendations. + - Some-rewording-of-the-readme-file. +========== + +* Thu May 22 2008 Caius Chance <cchance at redhat.com> +- Added latest (1.03) TTF files from Ascender. (in 'archive') + +* Fri May 16 2008 Caius Chance <cchance at redhat.com> +- Change source tree as 'trunk', 'tags', 'branches'. +========== +- Applied following patches submitted by Nicolas Spalinger + <nicolas_spalinger sil org>: + - Add-more-information-about-the-upstream-designer. + - Minor-typo-and-layout-fixes. + - Adjust-fontforge-path-with-env-as-a-source-build. +========== + +* Wed May 14 2008 Caius Chance <cchance at redhat.com> +- Renamed target 'ttf' to 'build'. +- Removed 'Re-Package' chapter from README and refine contents. +- Changed AUTHORS contents. +- Created maintainer documentation MAINTAINER. + +* Tue May 06 2008 Caius Chance <cchance at redhat.com> +- Refined clean target. +- Removed TTFs from git. + +* Fri May 02 2008 Caius Chance <cchance at redhat.com> +- Imported into fedorahosted.org repository and be hosted. + https://fedorahosted.org/liberation-fonts/ +- Modified source root directory name definition in Makefile. +- Created 'dist' target for binary TTF tarball and 'src' for source tarball. +- Corrected Regular fonts filenames. +- Added TTF -> SFD make target. + +* Thu May 01 2008 Caius Chance <cchance at redhat.com> +- Converted previous TTF files into SFD files to be open source. +- Created fontforge SFD -> TTF scripts. +- Created Makefile. +- Added documentations: AUTHORS, ChangeLog, README. + +* Thu Apr 10 2008 Caius Chance <cchance at redhat.com> +- Fixed exchanged and incomplete glyphs (from Ascender). +- Repacked source tarball. +- Released version 1.03. + +* Tue Mar 25 2008 Caius Chance <cchance at redhat.com> +- Fixed alignment mismatch of dot accents (from Ascender). +- Released version 1.02. + +* Mon Jan 14 2008 Caius Chance <cchance at redhat.com> +- Updated new source tarball from Ascender. +- Released version 1.0. + +* Thu Jun 14 2007 Caius Chance <cchance at redhat.com> +- Updated new source tarball from Ascender. Added: CometVisu/trunk/visu/fonts/License.txt =================================================================== --- CometVisu/trunk/visu/fonts/License.txt (rev 0) +++ CometVisu/trunk/visu/fonts/License.txt 2010-11-06 18:48:39 UTC (rev 89) @@ -0,0 +1,19 @@ +LICENSE AGREEMENT AND LIMITED PRODUCT WARRANTY +LIBERATION FONT SOFTWARE + +This agreement governs the use of the Software and any updates to the Software, regardless of the delivery mechanism. Subject to the following terms, Red Hat, Inc. ("Red Hat") grants to the user ("Client") a license to this work pursuant to the GNU General Public License v.2 with the exceptions set forth below and such other terms as are set forth in this End User License Agreement. + + 1. The Software and License Exception. LIBERATION font software (the "Software") consists of TrueType-OpenType formatted font software for rendering LIBERATION typefaces in sans-serif, serif, and monospaced character styles. You are licensed to use, modify, copy, and distribute the Software pursuant to the GNU General Public License v.2 with the following exceptions: + + (a) As a special exception, if you create a document which uses this font, and embed this font or unaltered portions of this font into the document, this font does not by itself cause the resulting document to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the document might be covered by the GNU General Public License. If you modify this font, you may extend this exception to your version of the font, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. + + (b) As a further exception, any distribution of the object code of the Software in a physical product must provide you the right to access and modify the source code for the Software and to reinstall that modified version of the Software in object code form on the same physical product on which you received it. + + 2. Intellectual Property Rights. The Software and each of its components, including the source code, documentation, appearance, structure and organization are owned by Red Hat and others and are protected under copyright and other laws. Title to the Software and any component, or to any copy, modification, or merged portion shall remain with the aforementioned, subject to the applicable license. The "LIBERATION" trademark is a trademark of Red Hat, Inc. in the U.S. and other countries. This agreement does not permit Client to distribute modified versions of the Software using Red Hat's trademarks. If Client makes a redistribution of a modified version of the Software, then Client must modify the files names to remove any reference to the Red Hat trademarks and must not use the Red Hat trademarks in any way to reference or promote the modified Software. + + 3. Limited Warranty. To the maximum extent permitted under applicable law, the Software is provided and licensed "as is" without warranty of any kind, expressed or implied, including the implied warranties of merchantability, non-infringement or fitness for a particular purpose. Red Hat does not warrant that the functions contained in the Software will meet Client's requirements or that the operation of the Software will be entirely error free or appear precisely as described in the accompanying documentation. + + 4. Limitation of Remedies and Liability. To the maximum extent permitted by applicable law, Red Hat or any Red Hat authorized dealer will not be liable to Client for any incidental or consequential damages, including lost profits or lost savings arising out of the use or inability to use the Software, even if Red Hat or such dealer has been advised of the possibility of such damages. + + 5. General. If any provision of this agreement is held to be unenforceable, that shall not affect the enforceability of the remaining provisions. This agreement shall be governed by the laws of the State of North Carolina and of the United States, without regard to any conflict of laws provisions, except that the United Nations Convention on the International Sale of Goods shall not apply. +Copyright © 2007 Red Hat, Inc. All rights reserved. LIBERATION is a trademark of Red Hat, Inc. Added: CometVisu/trunk/visu/fonts/README =================================================================== --- CometVisu/trunk/visu/fonts/README (rev 0) +++ CometVisu/trunk/visu/fonts/README 2010-11-06 18:48:39 UTC (rev 89) @@ -0,0 +1,82 @@ + 1. What's this? + ================= + + The Liberation Fonts is font collection which aims to provide document + layout compatibility as usage of Times New Roman, Arial, Courier New. + + + 2. Requirements + ================= + + * fontforge is installed. + (http://fontforge.sourceforge.net) + + + 3. Install + ============ + + 3.1 Decompress tarball + + You can extract the files by following command: + + $ tar zxvf liberation-fonts-[VERSION].tar.gz + + 3.2 Build from the source + + Change into directory liberation-fonts-[VERSION]/ and build from sources by + following commands: + + $ cd liberation-fonts-[VERSION] + $ make + + The built font files will be available in 'build' directory. + + 3.3 Install to system + + For Fedora, you could manually install the fonts by copying the TTFs to + ~/.fonts for user wide usage, or to /usr/share/fonts/truetype/liberation + for system-wide availability. Then, run "fc-cache" to let that cached. + + For other distributions, please check out corresponding documentation. + + + 4. Usage + ========== + + Simply select preferred liberation font in applications and start using. + + + 5. License + ============ + + This font set had been released under GNU Public License version 2 + ("GPLv2") with exceptions. + + Please read file "COPYING" for GPLv2 license. + + Please read file "License.txt" for details of exceptions. + + + 6. For Maintainers + ==================== + + Before packaging a new release based on a new source tarball, you have to + update the version suffix in the Makefile: + + VER = [VERSION] + + Make sure that the defined version corresponds to the font software metadata + which you can check with ftinfo/otfinfo or fontforge itself. It is highly + recommended that file 'ChangeLog' is updated to reflect changes. + + Create a tarball with the following command: + + $ make dist + + The new versioned tarball will be available in the dist/ folder as + 'liberation-fonts-[NEW_VERSION].tar.gz'. + + 7. Credits + ============ + + Please read file "AUTHORS" for list of contributors. Added: CometVisu/trunk/visu/fonts/TODO =================================================================== --- CometVisu/trunk/visu/fonts/TODO (rev 0) +++ CometVisu/trunk/visu/fonts/TODO 2010-11-06 18:48:39 UTC (rev 89) @@ -0,0 +1,14 @@ +Here are todo for next release + +1) resolving bug related with hinting + - https://bugzilla.redhat.com/show_bug.cgi?id=606217 + - https://bugzilla.redhat.com/show_bug.cgi?id=591556 +2) shape improvement + - https://bugzilla.redhat.com/show_bug.cgi?id=591559 + - https://bugzilla.redhat.com/show_bug.cgi?id=487581 +3) Ascent Descent Values Improvement + - using absolute values instead of relative values in OS/2 table +4) RFE: Add Greek Polytonic support to Liberation fonts + - need some volunteer to add these shapes + - https://bugzilla.redhat.com/show_bug.cgi?id=473842 + Added: CometVisu/trunk/visu/fonts/liberationsans-bold.ttf =================================================================== (Binary files differ) Property changes on: CometVisu/trunk/visu/fonts/liberationsans-bold.ttf ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: CometVisu/trunk/visu/fonts/liberationsans-regular.ttf =================================================================== (Binary files differ) Property changes on: CometVisu/trunk/visu/fonts/liberationsans-regular.ttf ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: CometVisu/trunk/visu/images/body_bg.png =================================================================== (Binary files differ) Property changes on: CometVisu/trunk/visu/images/body_bg.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: CometVisu/trunk/visu/images/button_bg.png =================================================================== (Binary files differ) Property changes on: CometVisu/trunk/visu/images/button_bg.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: CometVisu/trunk/visu/images/dot_green.png =================================================================== (Binary files differ) Property changes on: CometVisu/trunk/visu/images/dot_green.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: CometVisu/trunk/visu/images/dot_red.png =================================================================== (Binary files differ) Property changes on: CometVisu/trunk/visu/images/dot_red.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: CometVisu/trunk/visu/images/gradient.png =================================================================== (Binary files differ) Property changes on: CometVisu/trunk/visu/images/gradient.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: CometVisu/trunk/visu/images/hr_bg.png =================================================================== (Binary files differ) Property changes on: CometVisu/trunk/visu/images/hr_bg.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: CometVisu/trunk/visu/index.html =================================================================== --- CometVisu/trunk/visu/index.html 2010-11-06 18:10:49 UTC (rev 88) +++ CometVisu/trunk/visu/index.html 2010-11-06 18:48:39 UTC (rev 89) @@ -3,16 +3,12 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> - <title>Test Client</title> + <title>CometVisu-Client</title> <meta name="viewport" content="width=device-width, initial-scale=1" /> - <link rel="stylesheet" type="text/css" href="style_orange.css" /> + <link rel="stylesheet" type="text/css" href="style_discreet.css" /> <link rel="stylesheet" media="only screen and (max-device-width: 480px)" href="style_orange_mobile.css" type="text/css" /> <script src="lib/jquery.js" type="text/javascript"></script> <script src="lib/jquery-ui.js" type="text/javascript"></script> -<!-- - <script src="lib/jquery-ui-1.8.4.custom.min.js" type="text/javascript"></script> - <script src="lib/jquery.tools.min.js" type="text/javascript"></script> ---> <script src="lib/scrollable.js" type="text/javascript"></script> <script src="lib/visuclient.js" type="text/javascript"></script> <script src="lib/knx_decode.js" type="text/javascript"></script> @@ -23,7 +19,6 @@ <body> <div id="top"> <div class="nav_path">-</div> - <hr /> </div> <div id="main" style="width:900px;position:relative; overflow: hidden; "> <div id="pages" class="clearfix" style="width:20000em; position:relative;clear:both;"><!-- all pages will be inserted here --> @@ -32,8 +27,8 @@ <div id="bottom"> <hr /> <div class="footer"> - <img src="icon/comet_64_ff8000.png" alt="CometVisu" /> - by <a href="http://www.cometvisu.org/">ComeVisu.org</a> - <a href=".">Reload</a> + <img src="icon/comet_64_000000.png" alt="CometVisu" /> + by <a href="http://www.cometvisu.org/">CometVisu.org</a> - <a href=".">Reload</a> </div> </div> </body> Modified: CometVisu/trunk/visu/lib/templateengine.js =================================================================== --- CometVisu/trunk/visu/lib/templateengine.js 2010-11-06 18:10:49 UTC (rev 88) +++ CometVisu/trunk/visu/lib/templateengine.js 2010-11-06 18:48:39 UTC (rev 89) @@ -148,7 +148,7 @@ // do nothing } else { var width = $( window ).width(); - var height = $( window ).height() - $( '#top' ).height() - $( '#bottom' ).height() - 2; + var height = $( window ).height() - $( '#top' ).outerHeight(true) - $( '#bottom' ).outerHeight(true) - 2; $( '#main' ).css( 'width', width ).css( 'height', height ); $( 'head' ).append( '<style type="text/css">.page{width:' + (width-0) + 'px;height:' + height + 'px;}</style>' ); Added: CometVisu/trunk/visu/style_discreet.css =================================================================== --- CometVisu/trunk/visu/style_discreet.css (rev 0) +++ CometVisu/trunk/visu/style_discreet.css 2010-11-06 18:48:39 UTC (rev 89) @@ -0,0 +1,287 @@ +@font-face { font-family: Liberation; src:url(fonts/liberationsans-regular.ttf); } +@font-face { font-family: Liberation; font-weight: bold; src:url(fonts/liberationsans-bold.ttf); } + +body +{ + color: white; + font-family: Liberation; + font-size: 5.5mm; + overflow: hidden; + margin:0; + background: #1d1d1d url(images/body_bg.png) repeat-x; +} + +h1 +{ + font-size: 2em; + margin-left: 15px; +} + +body hr +{ + clear:both; + color: #81664b; + background-color: #81664b; + height: 1px; + border:none; + padding:0px; + margin:0.1em; +} + +#pages hr { + border: 0; height: 30px; margin: 0 .1em; + background: transparent url(images/hr_bg.png) 50% repeat-x; + clear: both; +} + + +body br +{ + clear:both; +} + +div#top { + margin-top: 8px; +} + +.nav_path +{ + color: #81664b; + margin-left: 15px; +} +.nav_path a +{ + color: white; + text-decoration:none; +} + +.footer, +.footer * +{ + color: #000000; + font-size: 0.9em; + vertical-align: middle; +} + +.widget +{ + float:left; + width:48%; + margin: .2em; + padding: 0.3em; + /* border:yellow 1px solid; */ + border-color: #020202; + border-style: solid; + border-width: 2px 0px 0px 2px; + -moz-border-radius: 8px; + -webkit-border-radius: 8px; + border-radius: 8px; + min-height: 2em; + background-color: #101010; +} + +.text > div, +.link > a { + float:left; + text-align:left; + padding-left: 1em; +} + +.widget .label, +.widget.info .actor, +.text > div, +.link > a { + line-height: 2em; +} + +.widget .label +{ + float:left; + width:49%; +/* color:red; */ +/* padding-right:0.25em; */ + text-align:left; + padding-left: 1em; +/* border:blue 1px solid; */ +} +.widget .actor +{ + float:left; + margin-left:1em; + text-align:left; +} +.widget .actor div +{ + float:left; + white-space: pre-wrap; +} + + +.green.switchPressed div, .green.switchUnpressed div{ + background: transparent url(images/dot_green.png) no-repeat center center; + color: white !important; +} +.red.switchPressed div, .red.switchUnpressed div{ + background: transparent url(images/dot_red.png) no-repeat center center; + color: white !important; +} + + +.red +{ + color:#f44; + font-weight:bold; +} + +.green +{ + color:#4f4; +} + +.blue +{ + color:#44f; +} + +.purple +{ + color:#f4f; +} + +.link a +{ + color: #81664b; + width: 49%; +} + +.page +{ + float:left; + width: 900px; + overflow: auto; + position: relative; +} + +.switchPressed, .switchUnpressed { + border-style: solid; + -moz-border-radius: 12px; + -webkit-border-radius: 12px; + border-radius: 12px; + padding: 1px; + background: url(images/button_bg.png) #171717 repeat-x; +} + +.switchUnpressed +{ + border-width: 1px 2px 2px 1px; + border-color: #282828 #010101 #010101 #282828; + margin-top: 0px; +} +.switchUnpressed div, .switchPressed div +{ + padding: 5px; + width: 5em; + float: left; + background: transparent; + text-align: center; + cursor: pointer; +} + +.switchPressed +{ + border-width: 2px 1px 1px 2px; + border-color: #010101 #282828 #282828 #010101; + margin-top: 1px; +} + +.switchUnpressed div { + margin-left: -1px; +} + +.switchPressed div { + margin-top: -1px; +} + +.ui-slider { position: relative; text-align: left; } +.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.6em; height: 1.6em; cursor: default; } +.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } + +.ui-slider-horizontal { height: .8em; } +.ui-slider-horizontal .ui-slider-handle { top: -.5em; margin-left: -.8em; } +.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } +.ui-slider-horizontal .ui-slider-range-min { left: 0; } +.ui-slider-horizontal .ui-slider-range-max { right: 0; } + +.ui-slider-vertical { width: .8em; height: 100px; } +.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } +.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } +.ui-slider-vertical .ui-slider-range-min { bottom: 0; } +.ui-slider-vertical .ui-slider-range-max { top: 0; } +.ui-widget-content { border: 1px solid #dddddd; background: #000 ; color: #000; } +.ui-widget-content a { color: #333333; } +.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cccccc; background: #000 ; font-weight: bold; color: #1c94c4; } +.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; } +.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } + +.dim .actor +{ + width: 3em; +} +.widget .ui-slider +{ + width: 30%; + float: left; + margin-left: 10px; + margin-left: 1em; + margin-top: 0.5em; + border-color: #010101 #282828 #282828 #010101; + background: url(images/gradient.png) #a7a7a7 repeat-y; +} + +.widget .ui-slider-handle +{ + border-style: solid; + -moz-border-radius: 12px; + -webkit-border-radius: 12px; + border-radius: 12px; + padding: 1px; + background: url(images/button_bg.png) #171717 repeat-x; + border-width: 1px 2px 2px 1px; + border-color: #282828 #010101 #010101 #282828; +} +/* Clearfix */ +.clearfix:after { + content: "."; + display: block; + clear: both; + visibility: hidden; + line-height: 0; + height: 0; +} + +.clearfix { + display: inline-block; +} + +html[xmlns] .clearfix { + display: block; +} + +*:first-child+html .clearfix { + min-height: 0; +} + +* html .clearfix { + height: 1%; +} + +* html>body .clearfix { + display: inline-block; + width: 100%; +} + +* html .clearfix { + /* Hides from IE-mac \*/ + height: 1%; + /* End hide from IE-mac */ +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <net...@us...> - 2010-11-06 18:10:55
|
Revision: 88 http://openautomation.svn.sourceforge.net/openautomation/?rev=88&view=rev Author: netzkind Date: 2010-11-06 18:10:49 +0000 (Sat, 06 Nov 2010) Log Message: ----------- removed single unnecessary file Removed Paths: ------------- CometVisu/trunk/visu/edit/visudesign_editmode.js Deleted: CometVisu/trunk/visu/edit/visudesign_editmode.js =================================================================== --- CometVisu/trunk/visu/edit/visudesign_editmode.js 2010-11-06 18:08:50 UTC (rev 87) +++ CometVisu/trunk/visu/edit/visudesign_editmode.js 2010-11-06 18:10:49 UTC (rev 88) @@ -1,99 +0,0 @@ -/* visudesign_custom.js (c) 2010 by Christian Mayer [CometVisu at ChristianMayer dot de] - * - * This program 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 3 of the License, or (at your option) - * any later version. - * - * This program 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 this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA -*/ - -/** - * This class re-defines all methods so all elements behave like the - * original from _pure, but have additional data so the editor can - * work with. - * - */ -function VisuDesign_Custom() {}; // do NOT change here -VisuDesign_Custom.prototype = new VisuDesign(); // do NOT chagen here - - -VisuDesign_Custom.prototype.createPage = function(page, path) - { - var ret_val = new VisuDesign().createPage(page, path); - ret_val.data({path: path}); - ret_val.addClass("pagelink"); - return ret_val; - } - -VisuDesign_Custom.prototype.createLine = function() - { - var ret_val = new VisuDesign().createLine(); - return $("<div />").attr("class", "widget line").append(ret_val); - } - -VisuDesign_Custom.prototype.createText = function(page) - { - var ret_val = new VisuDesign().createText(page); - return ret_val; - } - -VisuDesign_Custom.prototype.createInfo = -VisuDesign_Custom.prototype.createShade = function( page ) - { - var ret_val = new VisuDesign().createInfo(page); - ret_val.data({ - pre: $(page).attr('pre'), - post: $(page).attr('post') - }); - ret_val.find(".actor").data("style", $(page).attr("design")); - return ret_val; - } - -VisuDesign_Custom.prototype.createDim = function( page ) - { - var ret_val = new VisuDesign().createDim(page); - ret_val.data({ - response_address: $(page).attr('response_address'), - response_datatype: $(page).attr('response_datatype') - }); - return ret_val; - } - -VisuDesign_Custom.prototype.createSwitch = -VisuDesign_Custom.prototype.createToggle = function( page ) - { - var ret_val = new VisuDesign().createSwitch(page); - ret_val.data({ - pre: $(page).attr('pre'), - post: $(page).attr('post'), - response_address: $(page).attr('response_address'), - response_datatype: $(page).attr('response_datatype') - }); - ret_val.find(".actor").data("style", $(page).attr("design")); - return ret_val; - } - -VisuDesign_Custom.prototype.createTrigger = function( page ) - { - var ret_val = new VisuDesign().createTrigger(page); - ret_val.data({ - pre: $(page).attr('pre'), - post: $(page).attr('post') - }); - ret_val.find(".actor").data("style", $(page).attr("design")); - return ret_val; - } - -VisuDesign_Custom.prototype.createUnknown = function( page ) - { - var ret_val = new VisuDesign().createUnknown(page); - return ret_val; - } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <net...@us...> - 2010-11-06 18:08:58
|
Revision: 87 http://openautomation.svn.sourceforge.net/openautomation/?rev=87&view=rev Author: netzkind Date: 2010-11-06 18:08:50 +0000 (Sat, 06 Nov 2010) Log Message: ----------- rewrite of editor-code, now auto-extensible; changed handling of creators in visudesign_pure; added automatic DPT and GA-dropdown; added validation for input-values Modified Paths: -------------- CometVisu/trunk/ChangeLog CometVisu/trunk/visu/edit/save_config.php CometVisu/trunk/visu/edit/style_edit.css CometVisu/trunk/visu/edit/visuconfig_edit.js CometVisu/trunk/visu/edit_config.html CometVisu/trunk/visu/lib/templateengine.js CometVisu/trunk/visu/lib/visudesign_custom.js CometVisu/trunk/visu/lib/visudesign_pure.js CometVisu/trunk/visu/visu_config.xsd Added Paths: ----------- CometVisu/trunk/visu/edit/get_addresses.php Modified: CometVisu/trunk/ChangeLog =================================================================== --- CometVisu/trunk/ChangeLog 2010-11-06 17:01:33 UTC (rev 86) +++ CometVisu/trunk/ChangeLog 2010-11-06 18:08:50 UTC (rev 87) @@ -1,7 +1,7 @@ HEAD ==== -- New Feature: editor +- New Feature: editor (easily extensible) - New Feature: generic slide widget - New Feature: slide and dim widgets allow range and step attributes - New Feature: ranges for mapping and style @@ -10,6 +10,7 @@ - New Feature: <text> has new optional attribute "align" - Added XML Schema / XSD to validate config-XML - New Feature: tag for videos (HTML5 based) +- changed procedures for creating new widgets 0.5.0 ===== Added: CometVisu/trunk/visu/edit/get_addresses.php =================================================================== --- CometVisu/trunk/visu/edit/get_addresses.php (rev 0) +++ CometVisu/trunk/visu/edit/get_addresses.php 2010-11-06 18:08:50 UTC (rev 87) @@ -0,0 +1,35 @@ +<?php +define('FILE_GA', "/etc/wiregate/eibga.conf"); +define('FILE_HG', "/etc/wiregate/eibga_hg.conf"); +define('FILE_MG', "/etc/wiregate/eibga_mg.conf"); + +$arrGA = parse_ini_file(FILE_GA, true); +$arrHG = parse_ini_file(FILE_HG, true); +$arrMG = parse_ini_file(FILE_MG, true); + + +$arrAdresses = array(); +foreach ($arrGA as $strGA => $arrData) { + $arrGAParts = explode("/", $strGA, 3); + + $strHG = ""; + if (true === isset($arrHG[$arrGAParts[0]])) { + $strHG = utf8_encode($arrHG[$arrGAParts[0]]['name']); + } + + $strMG = ""; + if (true === isset($arrMG[$arrGAParts[1]])) { + $strMG = utf8_encode($arrMG[$arrGAParts[1]]['name']); + } + + $arrAdresses[$strHG][$strMG][] = array( + "address" => $strGA, + "name" => utf8_encode($arrData['name']), + "dpt" => $arrData['DPTSubId'] + ); +} + +print json_encode($arrAdresses); +exit; + +?> Modified: CometVisu/trunk/visu/edit/save_config.php =================================================================== --- CometVisu/trunk/visu/edit/save_config.php 2010-11-06 17:01:33 UTC (rev 86) +++ CometVisu/trunk/visu/edit/save_config.php 2010-11-06 18:08:50 UTC (rev 87) @@ -125,6 +125,11 @@ // Parameter die mit "_" beginnen sind special purpose continue; } + + if ($strAttribute === "textContent") { + $objXML->nodeValue = $strValue; + continue; + } $objXML->setAttribute($strAttribute, $strValue); } Modified: CometVisu/trunk/visu/edit/style_edit.css =================================================================== --- CometVisu/trunk/visu/edit/style_edit.css 2010-11-06 17:01:33 UTC (rev 86) +++ CometVisu/trunk/visu/edit/style_edit.css 2010-11-06 18:08:50 UTC (rev 87) @@ -9,6 +9,8 @@ filter: alpha(opacity=50); opacity: 0.5; text-align: center; + float: none !important; + padding: 0 !important; } .editcontrol { @@ -62,7 +64,7 @@ width: 1.5em; } -div#addDummy { +div#addMaster { border: 1px solid #444; -moz-border-radius: 5px; -webkit-border-radius: 5px; Modified: CometVisu/trunk/visu/edit/visuconfig_edit.js =================================================================== --- CometVisu/trunk/visu/edit/visuconfig_edit.js 2010-11-06 17:01:33 UTC (rev 86) +++ CometVisu/trunk/visu/edit/visuconfig_edit.js 2010-11-06 18:08:50 UTC (rev 87) @@ -4,7 +4,10 @@ confirm_save: "Save config?", prompt_rename: "Rename page '%s' to ...", save_good: "Config has been successfully saved.", - save_bad: "Config not saved. Error: '%s'" + save_bad: "Config not saved. Error: '%s'", + value_required: "Field '%s' is required but empty. Please correct your input.", + value_invalid: "The value for field '%s' is invalid. Please correct your input.", + regexp_invalid: "There something wrong with the cable." } if (typeof texts[element] == "undefined") { @@ -20,10 +23,12 @@ return myText; } +var addressesCache; + jQuery(document).ready(function() { jQuery("div#addwidgetcontrol").bind("click", function() { - jQuery("#addDummy").trigger("show").find("#add_type").triggerHandler("change"); + jQuery("#addMaster").trigger("show").find("#add_type").triggerHandler("change"); }); $("#saveconfigcontrol").bind("click", function () { @@ -33,7 +38,19 @@ } }); + // get all GA from the server + $.getJSON('edit/get_addresses.php', function(data) { addressesCache = data}); + jQuery("#pages").bind("done", function() { + $("#pages hr, #pages br").each(function() { + if ($(this).closest(".widget").length == 0) { + $(this).wrap("<div class=\"widget line\" />"); + var d = $.extend({}, $(this).data()); + $(this).closest("div.widget").data(d); + } + }); + + jQuery(".page div").sortable({ handle: ".movecontrol", items: '.widget', @@ -54,13 +71,27 @@ jQuery(this).css("background-color", jQuery(this).data("background-color-old")); jQuery(this).find("div.editcontrol, div.movecontrol, div.removecontrol").remove(); }); + + var options = {}; + $("#addMaster").find("select#add_type").empty(); + jQuery.each(design.creators, function (index, e) { + $("#addMaster").find("select#add_type").append( + $("<option />").attr("value", index).html(index) + ); + }); }); jQuery(".removecontrol").live("click", function() { var widget = $(this).parents("div.widget"); var data = getWidgetData(widget, true); - var b = confirm(lingua("confirm_delete", data._text)); + var t; + if (data._type == "page") { + t = data.name; + } else { + t = data.textContent; + } + var b = confirm(lingua("confirm_delete", t)); if (b) { widget.remove(); } @@ -68,6 +99,7 @@ jQuery(".editcontrol").live("click", function() { + var widget = $(this).parents("div.widget"); if (widget.is(".pagelink")) { return renamePage(widget); @@ -78,29 +110,21 @@ // kennzeichnen welches Element grade bearbeitet wird widget.addClass("inedit"); - jQuery.each(data, function(i, element) { - // alle bekannten Einstellungen in die Maske einfügen - $("#addDummy").find("#add_" + i).val(element); - }); + $("#addMaster").data("widgetdata", data); - if (typeof data._text != "undefined") { - // text ist in einem Sonderfeld abgelegt - $("#addDummy #add_text").val(data._text) - } + $("#addMaster #add_type").find("option[value=" + data._type + "]").attr("selected", "selected"); - $("#addDummy #add_type").find("option[value=" + data._type + "]").attr("selected", "selected").trigger("change"); - - $("#addDummy").triggerHandler("show"); + $("#addMaster").triggerHandler("show"); }); jQuery("#pages").bind("done", function() { // die Selectlisten vorbelegen - $("#addDummy #add_mapping, #addDummy #add_style").empty().append($("<option />").attr("value", "").html("-")); + $("#addMaster #add_mapping, #addMaster #add_style").empty().append($("<option />").attr("value", "").html("-")); jQuery.each(mappings, function(i, element) { - $("#addDummy #add_mapping").append($("<option />").attr("value", i).html(i)); + $("#addMaster #add_mapping").append($("<option />").attr("value", i).html(i)); }); jQuery.each(styles, function(i, element) { - $("#addDummy #add_style").append($("<option />").attr("value", i).html(i)); + $("#addMaster #add_style").append($("<option />").attr("value", i).html(i)); }); }); @@ -108,14 +132,21 @@ jQuery(function() { - // dem AddDummy Leben einhauchen - jQuery("#addDummy") + // dem addMaster Leben einhauchen + jQuery("#addMaster") .bind("show", function() { if ($("#pages .inedit").is(".widget")) { $(this).find(".create").hide().end().find(".edit").show(); } else { $(this).find(".create").show().end().find(".edit").hide(); } + + // if we have widget-specific data, we must be in edit-mode + var widgetdata = $(this).data("widgetdata"); + if (typeof widgetdata != "undefined") { + $(this).find("#add_type").find("option[value=" + widgetdata._type + "]").attr("selected", "selected").trigger("change"); + } + $(this).show() .find("#add_type").triggerHandler("change") jQuery(".page div").sortable("destroy"); @@ -126,73 +157,162 @@ $("#pages").triggerHandler("done"); }) .bind("cleanup", function() { + $(this).removeData("widgetdata"); jQuery(this).find("input[type=text]").val(""); $("#pages").find(".inedit").removeClass("inedit"); }) .find("#add_cancel").click(function() { - jQuery("#addDummy").trigger("hide").trigger("cleanup") + jQuery("#addMaster").trigger("hide").trigger("cleanup") }) .end() .find("#add_type").change(function() { + // the type has been changed + // we need to change the input-field accordingly to match + // what attributes we need var val = jQuery(this).val(); - var divSelector = ""; - switch (val) { - case 'switch': - case 'toggle': - divSelector = ".add_text, .add_address, .add_datatype, .add_response_address, .add_response_datatype, .add_pre, .add_post, .add_mapping, .add_style"; - break; - case 'dim': - case 'slide': - divSelector = ".add_text, .add_address, .add_datatype, .add_response_address, .add_response_datatype, .add_pre, .add_post, .add_mapping, .add_style, .add_min, .add_max, .add_step"; - break; - case 'trigger': - divSelector = ".add_text, .add_address, .add_datatype, .add_pre, .add_post, .add_mapping, .add_style, .add_value"; - break; - case 'line': - divSelector = ""; - break; - case 'shade': - divSelector = ""; - break; - case 'info': - divSelector = ".add_text, .add_address, .add_datatype, .add_pre, .add_post, .add_mapping, .add_style"; - break; - case 'text': - divSelector = ".add_text"; - break; - case 'page': - divSelector = ".add_text"; - break; + var creator = design.getCreator(val); + var attributes = creator.attributes; + if (typeof attributes == "undefined") { + alert("there's something wrong with the cable"); + return; } - jQuery("#addDummy").find("div.add_inputs") - .not(divSelector).hide() - .find("input[type=text]").val("") - .end() - .end() - .filter(divSelector).show(); + var container = $("#addMaster div.inputs"); + var values = $.extend({}, $("#addMaster").data("widgetdata")); + + // alte Werte zwischenspeichern + container.find(":input").each(function() { + if ($(this).val() != "") { + var name = $(this).data("name"); + values[name] = $(this).val(); + } + }) + container.empty(); + + if (creator.content == "string") { + var element = $("<div />").addClass("add_input").addClass("content") + .append($("<label />").attr("for", "add_textContent").html("text-content")) + .append($("<input type=\"text\" id=\"add_textContent\"/>")); + if (typeof values["textContent"] != "undefined") { + element.find("input").val(values["textContent"]); + } + + container.append(element); + delete element; + } + + $.each(attributes, function (index, e) { + var element = $("<div />").addClass("add_input").addClass("attribute") + .append($("<label />").attr("for", "add_" + index).html(index)); + + switch (e.type) { + case "address": + element.append($("<select id=\"add_" + index + "\" />") + .append($("<option />").attr("value", "").html("-"))); + + element.find("select:first").append(getAddressesObject()); + + element.find("select").bind("change", function() { + // on changing the address, the coresponding datatype-field is + // automagically set + var name = $(this).attr("id"); + var dptFieldName = name.replace(/_?address$/i, "_datatype"); + var dpt = $(this).find("option:selected").attr("class").replace(/[^dpt_\d+\.\d+]*/, "").replace(/^dpt_/, ""); + $("#addMaster div.inputs #" + dptFieldName).val(dpt); + }); + + if (typeof values[index] != "undefined") { + element.find("option[value=" + values[index] + "]").attr("selected", "selected"); + } + + break; + + case "mapping": + element.append($("<select id=\"add_mapping\" />") + .append($("<option />").attr("value", "").html("-"))); + jQuery.each(mappings, function(i, tmp) { + element.find("select#add_mapping").append($("<option />").attr("value", i).html(i)); + }); + + if (typeof values[index] != "undefined") { + element.find("option[value=" + values[index] + "]").attr("selected", "selected"); + } + + break; + + case "style": + element.append($("<select id=\"add_style\" />") + .append($("<option />").attr("value", "").html("-"))); + jQuery.each(styles, function(i, tmp) { + element.find("select#add_style").append($("<option />").attr("value", i).html(i)); + }); + + if (typeof values[index] != "undefined") { + element.find("option[value=" + values[index] + "]").attr("selected", "selected"); + } + + break; + + default: + element.append($("<input type=\"text\" id=\"add_" + index + "\" />")); + + if (typeof values[index] != "undefined") { + element.find("input").val(values[index]); + } + + break; + } + + element.find(":input") + .data("name", index) + .data("required", e.required) + .data("type", e.type); + + container.append(element); + delete element; + }); }) .end() .find("#add_submit").click(function() { // Daten aus den Eingabefeldner übernehmen - // einfach alle rein - das Design weiß schon welche Daten es benötigt + // einfach alle rein - wir haben ja nur die passenden Felder + + var container = $("#addMaster div.inputs"); + var dataObject = { - value: jQuery("#addDummy input#add_value").val(), - address: jQuery("#addDummy input#add_address").val(), - datatype: jQuery("#addDummy input#add_datatype").val(), - response_address: jQuery("#addDummy input#add_response_address").val(), - response_datatype: jQuery("#addDummy input#add_response_datatype").val(), - pre: jQuery("#addDummy input#add_pre").val(), - post: jQuery("#addDummy input#add_post").val(), - mapping: jQuery("#addDummy select#add_mapping").val(), - design: jQuery("#addDummy select#add_style").val(), - min: jQuery("#addDummy input#add_min").val(), - max: jQuery("#addDummy input#add_max").val(), - step: jQuery("#addDummy input#add_step").val(), - textContent: jQuery("#addDummy input#add_text").val(), - nodeName: jQuery("#addDummy #add_type").val(), - name: jQuery("#addDummy input#add_text").val() // wird nur bei page benötigt - }; + nodeName: jQuery("#addMaster #add_type").val() + }; + + var error = false; + + // alte Werte zwischenspeichern + container.find(":input").each(function() { + var name; + if ($(this).closest("div.add_input").hasClass("attribute")) { + name = $(this).data("name"); + } else if ($(this).closest("div.add_input").hasClass("content")) { + name = "textContent"; + } + + if ($(this).val() != "") { + // validating + if (false === isInputValid($(this).val(), $(this).data("type"))) { + alert(lingua("value_invalid", name)); + // do not save + error = true; + } + dataObject[name] = $(this).val(); + } else if ($(this).data("required") === true) { + // do not save + alert(lingua("value_required", name)); + error = true; + } + }) + + if (error !== false) { + return; + } + // als path verwenden wir einfach den aktuellen UNIX-Timestamp // der wird nicht schon belegt sein var path = $(".page:visible:last").attr("id"); @@ -210,12 +330,55 @@ jQuery("#pages").triggerHandler("done"); // und dann noch mich wieder verstecken - jQuery("#addDummy").trigger("hide").trigger("cleanup"); + jQuery("#addMaster").trigger("hide").trigger("cleanup"); }) .end(); }); +/** + * check whether a user-given value matches the type-criterias and thus is valid + */ +function isInputValid(val, type) { + if (typeof type == "undefined" || type == null) { + // nicht mit Geistern rumschlagen + return true; + } + if (typeof type == "object") { + // wohl ein regulärer Ausdruck + try { + if (val.match(type)) { + return true; + } else { + return false; + } + + } catch (e) { + alert(lingua("regexp_invalid")); + return false; + } + } + + switch (type) { + case "address": + return !Boolean(val.match(/^[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{1,2}$/)); + break; + case "numeric": + return Boolean(val.match(/^\d+([\.,]\d+)?$/g)); + break; + case "string": + case "uri": + return Boolean(typeof val == "string"); + break; + case "mapping": + return Boolean(typeof mappings[val] != "undefined"); + break; + case "style": + return Boolean(typeof styles[val] != "undefined"); + break; + } +} + function saveConfig() { var configData = createObjectFromPage("#0.page"); var configDataJSON = JSON.stringify(configData); @@ -245,80 +408,17 @@ }); } -function getWidgetData(element, nodive) { +function getWidgetData(element) { var myObj = {}; + var e = $(element); - var a = $(e).find(".actor"); - if (e.is("div.switch")) { - // switch oder trigger - if (a.data("type") == "trigger") { - // trigger - myObj = { - address: a.data("GA"), - datatype: a.data("datatype"), - value: a.data("sendValue"), - pre: e.data("pre"), - post: e.data("post"), - mapping: a.data("mapping"), - style: a.data("style"), - _text: e.find("div.label").text(), - _type: "trigger" - }; - } else { - // switch - myObj = { - address: a.data("GA"), - datatype: a.data("datatype"), - pre: e.data("pre"), - post: e.data("post"), - mapping: a.data("mapping"), - style: a.data("style"), - response_address: e.data("response_address"), - response_datatype: e.data("response_datatype"), - _text: e.find("div.label").text(), - _type: "switch" - }; - } - } else if (e.is("div.text")) { - // text - myObj = { - _text: e.find("div.label").text(), - _type: "text" - }; - } else if (e.is("div.dim")) { - // slider - myObj = { - address: a.data("GA"), - datatype: a.data("datatype"), - mapping: a.data("mapping"), - style: a.data("style"), - min: a.data("min"), - max: a.data("max"), - step: a.data("step"), - response_address: e.data("response_address"), - response_datatype: e.data("response_datatype"), - _text: e.find("div.label").text(), - _type: "dim" - }; - } else if (e.is("div.info")) { - // Info-Feld - myObj = { - address: a.data("GA"), - datatype: a.data("datatype"), - pre: e.data("pre"), - post: e.data("post"), - mapping: a.data("mapping"), - style: a.data("style"), - _text: e.find("div.label").text(), - _type: "info" - }; - } else if (e.is("div.line")) { - // Trennlinie - myObj = { - _type: "line", - _text: "line" - } - } else if (e.is(".pagelink")) { + + myObj._type = e.data("nodeName"); + myObj.textContent = e.data("textContent"); + $.extend(myObj, e.data("attributes")); + + if (e.is(".pagelink")) { + // it's a page, we need to dive in // eine Sub-Seite // versuchen die Seiten-Id durch den Link zu bekommen var s = e.find("a"); @@ -334,19 +434,10 @@ if (subObject._elements.length > 0) { myObj = subObject; } - } else if (nodive) { - // wir sollen nicht rekursiv arbeiten, - // aber dieses eine Objekt liefern wir zurück - myObj = { - _type: "page", - _text: s.text(), // für edit-modus benötigt - name: s.text() - }; } } return myObj; - } function createObjectFromPage(pageObject) { @@ -378,7 +469,7 @@ function renamePage(widget) { var data = getWidgetData(widget, true); - var newText = prompt(lingua("prompt_rename", data._text), data._text); + var newText = prompt(lingua("prompt_rename", data.name), data.name); if (!newText) { return; } @@ -386,5 +477,35 @@ var path = widget.data("path"); widget.find("a").html(newText); + widget.data("name", newText); $("#pages").find("#" + path + ".page").find("h1").html(newText); +} + +var cachedAddressesObject; +function getAddressesObject() { + + if (typeof cachedAddressesObject == "object") { + return cachedAddressesObject.clone(); + } + + element = $("<select />"); + + $.each(addressesCache, function(hg, sub) { + $.each(sub, function(mg, addresses) { + element.append( + $("<optgroup />").attr("label", hg + " - " + mg) + ); + $.each(addresses, function (i, address) { + element.find("optgroup:last") + .append($("<option />").attr("value", address.address) + .addClass("dpt_" + address.dpt) + .html(address.name) + ) + }); + }); + }); + + cachedAddressesObject = element.children(); + + return cachedAddressesObject; } \ No newline at end of file Modified: CometVisu/trunk/visu/edit_config.html =================================================================== --- CometVisu/trunk/visu/edit_config.html 2010-11-06 17:01:33 UTC (rev 86) +++ CometVisu/trunk/visu/edit_config.html 2010-11-06 18:08:50 UTC (rev 87) @@ -13,7 +13,7 @@ <script src="lib/visuclient.js" type="text/javascript"></script> <script src="lib/knx_decode.js" type="text/javascript"></script> <script src="lib/visudesign_pure.js" type="text/javascript"></script> - <script src="edit/visudesign_editmode.js" type="text/javascript"></script> + <script src="lib/visudesign_custom.js" type="text/javascript"></script> <script src="lib/templateengine.js" type="text/javascript"></script> <script src="edit/visuconfig_edit.js" type="text/javascript"></script> <script src="edit/json2.js" type="text/javascript"></script> @@ -35,7 +35,7 @@ </div> </div> - <div id="addDummy"> + <div id="addMaster"> <form method="post" action="self"> <div class="addwidget"> <h2 class="create">Insert new widget</h2> @@ -43,73 +43,13 @@ <div class="editcontrols"> <label for="add_type">Typ</label> <select id="add_type"> - <option value="switch">switch</option> - <option value="trigger">trigger</option> - <option value="line">line</option> - <option value="dim">slider/dimmer</option> - <option value="shade">shade</option> - <option value="info">info</option> - <option value="text">text</option> - <option value="page">page</option> + <option>-</option> </select> - <div class="add_inputs add_text"> - <label for="add_text">Text</label> - <input type="text" id="add_text" /> - </div> - <div class="add_inputs add_address"> - <label for="add_address">address</label> - <input type="text" id="add_address" /> - </div> - <div class="add_inputs add_datatype"> - <label for="add_datatype">DPT</label> - <input type="text" id="add_datatype" /> - </div> - <div class="add_inputs add_value"> - <label for="add_value">Value</label> - <input type="text" id="add_value" /> - </div> + <div class="inputs"> - <div class="add_inputs add_response_address"> - <label for="add_response_address">response_address</label> - <input type="text" id="add_response_address" /> </div> - <div class="add_inputs add_response_datatype"> - <label for="add_response_datatype">response DPT</label> - <input type="text" id="add_response_datatype" /> - </div> - <div class="add_inputs add_min"> - <label for="add_min">mininmal value</label> - <input type="text" id="add_min" /> - </div> - <div class="add_inputs add_max"> - <label for="add_max">maximal value</label> - <input type="text" id="add_max" /> - </div> - <div class="add_inputs add_step"> - <label for="add_step">step size</label> - <input type="text" id="add_step" /> - </div> - - - <div class="add_inputs add_pre"> - <label for="add_pre">pre</label> - <input type="text" id="add_pre" /> - </div> - <div class="add_inputs add_post"> - <label for="add_post">post</label> - <input type="text" id="add_post" /> - </div> - - <div class="add_inputs add_mapping"> - <label for="add_mapping">mapping</label> - <select id="add_mapping"><option>-</option></select> - </div> - <div class="add_inputs add_style"> - <label for="add_style">style</label> - <select id="add_style"><option>-</option></select> - </div> </div> <input type="button" id="add_submit" value="OK"/> Modified: CometVisu/trunk/visu/lib/templateengine.js =================================================================== --- CometVisu/trunk/visu/lib/templateengine.js 2010-11-06 17:01:33 UTC (rev 86) +++ CometVisu/trunk/visu/lib/templateengine.js 2010-11-06 18:08:50 UTC (rev 87) @@ -215,9 +215,26 @@ function create_pages( page, path ) { - if( design.creators[ page.nodeName ] ) - return design.creators[ page.nodeName ]( page, path ); - return design.creators.unknown( page ); + var retval; + retval = design.creators[ page.nodeName ].create( page, path ); + + node = $(page).get(0); + var attributes = {}; + if (typeof node.attributes != "undefined") { + for(var i=0; i<node.attributes.length; i++) { + if(node.attributes.item(i).specified) { + attributes[node.attributes.item(i).nodeName]=node.attributes.item(i).nodeValue + } + } + } else { + $.extend(attributes, node); + } + + retval.data("attributes", attributes) + .data("path", path) + .data("nodeName", page.nodeName) + .data("textContent", page.textContent); + return retval; } function scrollToPage( page_id ) Modified: CometVisu/trunk/visu/lib/visudesign_custom.js =================================================================== --- CometVisu/trunk/visu/lib/visudesign_custom.js 2010-11-06 17:01:33 UTC (rev 86) +++ CometVisu/trunk/visu/lib/visudesign_custom.js 2010-11-06 18:08:50 UTC (rev 87) @@ -24,12 +24,13 @@ /** * Custom changes could go here and look e.g. like **************************************** -VisuDesign_Custom.prototype.creators.text = function( page ) -{ - var ret_val = $('<div class="widget" />'); - ret_val.addClass( 'text' ); - ret_val.append( '<div class="label">[' + page.textContent + ']</div>' ); - return ret_val; -} +VisuDesign_Custom.prototype.addCreator("line", { + create: function( page, path ) { + return $( '<hr />' ); + }, + attributes: { + }, + content: false +}); **************************************** */ Modified: CometVisu/trunk/visu/lib/visudesign_pure.js =================================================================== --- CometVisu/trunk/visu/lib/visudesign_pure.js 2010-11-06 17:01:33 UTC (rev 86) +++ CometVisu/trunk/visu/lib/visudesign_pure.js 2010-11-06 18:08:50 UTC (rev 87) @@ -18,202 +18,300 @@ /** * This class defines all the building blocks for a Visu in the "Pure" design */ -function VisuDesign() -{ - /** - * The creators object contians all widgets creators and their mappin to the - * XML config file tags - */ - this.creators = {}; - this.creators.page = function( page, path ) - { - var ret_val = $('<div class="widget" />'); - var style = ( '0' != path ) ? 'display:none' : ''; - var name = $(page).attr('name'); //path += '_' + name; - var type = $(page).attr('type'); //text, 2d or 3d - ret_val.addClass( 'link' ); - ret_val.append( '<a href="javascript:scrollToPage(\''+path+'\')">' + name + '</a>' ); - var childs = $(page).children(); - var container = $( '<div class="clearfix"/>' ); +function VisuDesign() { + this.creators = {}; - container.append( '<h1>' + name + '</h1>' ); - $( childs ).each( function(i){ - container.append( create_pages(childs[i], path + '_' + i ) ); - } ); - $('#pages').prepend( $( '<div class="page" id="' + path + '" style="'+style+';"/>' ).append(container) ); - return ret_val; - } + this.addCreator = function (name, object) { + this.creators[name] = object; + } - this.creators.line = function() - { - return $( '<hr />' ); - } + this.getCreator = function(name) { + if (typeof this.creators[name] == undefined) { + return this.creators.unknown; + } + return this.creators[name]; + } - this.creators.break = function() - { - return $( '<br />' ); - } + /** + * The creators object contians all widgets creators and their mappin to the + * XML config file tags + */ + this.addCreator("page", { + create: function( page, path ) { + var ret_val = $('<div class="widget" />'); + var style = ( '0' != path ) ? 'display:none' : ''; + var name = $(page).attr('name'); //path += '_' + name; + var type = $(page).attr('type'); //text, 2d or 3d + ret_val.addClass( 'link' ).addClass("pagelink"); + ret_val.append( '<a href="javascript:scrollToPage(\''+path+'\')">' + name + '</a>' ); + var childs = $(page).children(); + var container = $( '<div class="clearfix"/>' ); - this.creators.text = function( page ) - { - var ret_val = $('<div class="widget" />'); - ret_val.addClass( 'text' ); - var style = ''; - if( $(page).attr('align') ) style += 'text-align:' + $(page).attr('align') + ';'; - if( style != '' ) style = 'style="' + style + '"'; - ret_val.append( '<div ' + style + '>' + page.textContent + '</div>' ); - return ret_val; - } + container.append( '<h1>' + name + '</h1>' ); + $( childs ).each( function(i){ + container.append( create_pages(childs[i], path + '_' + i ) ); + } ); + $('#pages').prepend( $( '<div class="page" id="' + path + '" style="'+style+';"/>' ).append(container) ); + return ret_val; + }, + attributes: { + name: {type: "string", required: true} + }, + content: true + }); - this.creators.info = - this.creators.shade = function( page ) - { - var ret_val = $('<div class="widget" />'); - ret_val.addClass( 'info' ); - var label = '<div class="label">' + page.textContent + '</div>'; - ga_list.push( $(page).attr('address') ); - var actor = '<div class="actor GA' + $(page).attr('address').split('/').join('_') + '">'; - if( $(page).attr('pre') ) actor += '<div>' + $(page).attr('pre') + '</div>'; - actor += '<div class="value">-</div>'; - if( $(page).attr('post') ) actor += '<div>' + $(page).attr('post') + '</div>'; - actor += '</div>'; - ret_val.append( label ).append( $(actor).data( { - 'GA': $(page).attr('address'), - 'datatype': $(page).attr('datatype'), - 'mapping' : $(page).attr('mapping'), - 'style' : $(page).attr('style') - } ) ); - return ret_val; - } + this.addCreator("line", { + create: function( page, path ) { + return $( '<hr />' ); + }, + attributes: { + }, + content: false + }); - this.creators.dim = - this.creators.slide = function( page ) - { - var ret_val = $('<div class="widget" />'); - ret_val.addClass( 'dim' ); - var label = '<div class="label">' + page.textContent + '</div>'; - ga_list.push( $(page).attr('address') ); - var actor = $('<div class="actor GA' + $(page).attr('address').split('/').join('_') + '" />'); - ret_val.append( label ).append( actor ); - var min = parseFloat( $(page).attr('min') || 0 ); - var max = parseFloat( $(page).attr('max') || 100 ); - var step = parseFloat( $(page).attr('step') || 0.5 ); - ret_val.find('.actor').data( { - 'events': $(actor).data( 'events' ), - 'GA': $(page).attr('address'), - 'datatype': $(page).attr('datatype'), - 'mapping' : $(page).attr('mapping'), - 'style' : $(page).attr('style'), - 'min' : min, - 'max' : max, - 'step' : step, - 'type' : 'dim' - }).slider({step:step,min:min,max:max, animate: true,start:slideStart,change:slideChange});//slide:slideAction}); + this.addCreator("break", { + create: function( page, path ) { + return $( '<br />' ); + }, + attributes: { + }, + content: false + }); - return ret_val; - } - this.creators.switch = - this.creators.toggle = function( page ) - { - var ret_val = $('<div class="widget" />'); - ret_val.addClass( 'switch' ); - var label = '<div class="label">' + page.textContent + '</div>'; - var response_address = $(page).attr('response_address'); - ga_list.push( response_address ); - var actor = '<div class="actor GA' + response_address.split('/').join('_') + ' switchUnpressed">'; - if( $(page).attr('pre') ) actor += $(page).attr('pre'); - actor += '<div class="value">-</div>'; - if( $(page).attr('post') ) actor += $(page).attr('post'); - actor += '</div>'; - ret_val.append( label ).append( $(actor).data( { - 'GA': $(page).attr('address'), - 'datatype': $(page).attr('datatype'), - 'mapping' : $(page).attr('mapping'), - 'style' : $(page).attr('style'), - 'type' : 'toggle' - } ).bind('click',switchAction) ); - return ret_val; - } + this.addCreator("text", { + create: function( page, path ) { + var ret_val = $('<div class="widget" />'); + ret_val.addClass( 'text' ); + var style = ''; + if( $(page).attr('align') ) style += 'text-align:' + $(page).attr('align') + ';'; + if( style != '' ) style = 'style="' + style + '"'; + ret_val.append( '<div ' + style + '>' + page.textContent + '</div>' ); + return ret_val; + }, + attributes: { + align: {type: "string", required: false} + }, + content: "string" + }); + + this.addCreator("info", { + create: function( page, path ) { + var ret_val = $('<div class="widget" />'); + ret_val.addClass( 'info' ); + var label = '<div class="label">' + page.textContent + '</div>'; + ga_list.push( $(page).attr('address') ); + var actor = '<div class="actor GA' + $(page).attr('address').split('/').join('_') + '">'; + if( $(page).attr('pre') ) actor += '<div>' + $(page).attr('pre') + '</div>'; + actor += '<div class="value">-</div>'; + if( $(page).attr('post') ) actor += '<div>' + $(page).attr('post') + '</div>'; + actor += '</div>'; + ret_val.append( label ).append( $(actor).data( { + 'GA': $(page).attr('address'), + 'datatype': $(page).attr('datatype'), + 'mapping' : $(page).attr('mapping'), + 'style' : $(page).attr('style') + } ) ); + return ret_val; + }, + attributes: { + address: {type: "address", required: true}, + datatype: {type: "numeric", required: true}, + pre: {type: "string", required: false}, + post: {type: "string", required: false}, + mapping: {type: "mapping", required: false}, + style: {type: "style", required: false} + }, + content: "string" + }); - this.creators.trigger = function( page ) - { - var value = $(page).attr('value') ? $(page).attr('value') : 0; - var ret_val = $('<div class="widget" />'); - ret_val.addClass( 'switch' ); - var label = '<div class="label">' + page.textContent + '</div>'; - var address = $(page).attr('address'); - var actor = '<div class="actor switchUnpressed">'; - if( $(page).attr('pre') ) actor += $(page).attr('pre'); - var map = $(page).attr('mapping'); - if( mappings[map] && mappings[map][value] ) - actor += '<div class="value">' + mappings[map][value] + '</div>'; - else - actor += '<div class="value">' + value + '</div>'; - if( $(page).attr('post') ) actor += $(page).attr('post'); - actor += '</div>'; - ret_val.append( label ).append( $(actor).data( { - 'GA': $(page).attr('address'), - 'datatype': $(page).attr('datatype'), - 'mapping' : $(page).attr('mapping'), - 'style' : $(page).attr('style'), - 'type' : 'trigger', - 'sendValue': value - } ).bind('click',triggerAction) ); + this.addCreator("shade", this.getCreator("info")); - return ret_val; - } - this.creators.image = function( page ) - { - var ret_val = $('<div class="widget" />'); - ret_val.addClass( 'image' ); - ret_val.append( '<div class="label">' + page.textContent + '</div>' ); - var style = ''; - if( $(page).attr('width') ) style += 'width:' + $(page).attr('width') + ';'; - if( $(page).attr('height') ) style += 'height:' + $(page).attr('height') + ';'; - if( style != '' ) style = 'style="' + style + '"'; - var actor = '<div class="actor"><img src="' +$(page).attr('src') + '" ' + style + ' /></div>'; - var refresh = $(page).attr('refresh') ? $(page).attr('refresh')*1000 : 0; - ret_val.append( $(actor).data( { - 'refresh': refresh - } ).each(setupRefreshAction) ); // abuse "each" to call in context... - return ret_val; - } + this.addCreator("dim", { + create: function( page, path ) { + var ret_val = $('<div class="widget" />'); + ret_val.addClass( 'dim' ); + var label = '<div class="label">' + page.textContent + '</div>'; + ga_list.push( $(page).attr('address') ); + var actor = $('<div class="actor GA' + $(page).attr('address').split('/').join('_') + '" />'); + ret_val.append( label ).append( actor ); + var min = parseFloat( $(page).attr('min') || 0 ); + var max = parseFloat( $(page).attr('max') || 100 ); + var step = parseFloat( $(page).attr('step') || 0.5 ); + ret_val.find('.actor').data( { + 'events': $(actor).data( 'events' ), + 'GA': $(page).attr('address'), + 'datatype': $(page).attr('datatype'), + 'mapping' : $(page).attr('mapping'), + 'style' : $(page).attr('style'), + 'min' : min, + 'max' : max, + 'step' : step, + 'type' : 'dim' + }).slider({step:step,min:min,max:max, animate: true,start:slideStart,change:slideChange});//slide:slideAction}); - this.creators.video = function( page ) - { - var ret_val = $('<div class="widget" />'); - ret_val.addClass( 'video' ); - ret_val.append( '<div class="label">' + page.textContent + '</div>' ); - var style = ''; - if( $(page).attr('width') ) style += 'width:' + $(page).attr('width') + ';'; - if( $(page).attr('height') ) style += 'height:' + $(page).attr('height') + ';'; - if( style != '' ) style = 'style="' + style + '"'; - var actor = '<div class="actor"><video src="' +$(page).attr('src') + '" ' + style + ' controls="controls" /></div>'; - var refresh = $(page).attr('refresh') ? $(page).attr('refresh')*1000 : 0; - ret_val.append( $(actor).data( { - 'refresh': refresh - } ).each(setupRefreshAction) ); // abuse "each" to call in context... - return ret_val; - } + return ret_val; + }, + attributes: { + address: {type: "address", required: true}, + datatype: {type: "numeric", required: true}, + response_address: {type: "address", required: true}, + response_datatype: {type: "numeric", required: true}, + min: {type: "numeric", required: false}, + max: {type: "numeric", required: false}, + step: {type: "numeric", required: false}, + mapping: {type: "mapping", required: false}, + style: {type: "style", required: false} + }, + content: "string" + }); - this.creators.unknown = function( page ) - { - var ret_val = $('<div class="widget" />'); - ret_val.append( '<pre>' + page.textContent + '</pre>' ); - return ret_val; - } + this.addCreator("slide", this.getCreator("dim")); - this.switchAction = function() - { + this.addCreator("switch", { + create: function( page, path ) { + var ret_val = $('<div class="widget" />'); + ret_val.addClass( 'switch' ); + var label = '<div class="label">' + page.textContent + '</div>'; + var response_address = $(page).attr('response_address'); + ga_list.push( response_address ); + var actor = '<div class="actor GA' + response_address.split('/').join('_') + ' switchUnpressed">'; + if( $(page).attr('pre') ) actor += $(page).attr('pre'); + actor += '<div class="value">-</div>'; + if( $(page).attr('post') ) actor += $(page).attr('post'); + actor += '</div>'; + ret_val.append( label ).append( $(actor).data( { + 'GA': $(page).attr('address'), + 'datatype': $(page).attr('datatype'), + 'mapping' : $(page).attr('mapping'), + 'style' : $(page).attr('style'), + 'type' : 'toggle' + } ).bind('click',switchAction) ); + return ret_val; + }, + attributes: { + address: {type: "address", required: true}, + datatype: {type: "numeric", required: true}, + response_address: {type: "address", required: true}, + response_datatype: {type: "numeric", required: true}, + pre: {type: "string", required: false}, + post: {type: "string", required: false}, + mapping: {type: "mapping", required: false}, + style: {type: "style", required: false} + }, + content: "string" + }); + + this.addCreator("toggle", this.getCreator("switch")); + + this.addCreator("trigger", { + create: function( page, path ) { + var value = $(page).attr('value') ? $(page).attr('value') : 0; + var ret_val = $('<div class="widget" />'); + ret_val.addClass( 'switch' ); + var label = '<div class="label">' + page.textContent + '</div>'; + var address = $(page).attr('address'); + var actor = '<div class="actor switchUnpressed">'; + if( $(page).attr('pre') ) actor += $(page).attr('pre'); + var map = $(page).attr('mapping'); + if( mappings[map] && mappings[map][value] ) + actor += '<div class="value">' + mappings[map][value] + '</div>'; + else + actor += '<div class="value">' + value + '</div>'; + if( $(page).attr('post') ) actor += $(page).attr('post'); + actor += '</div>'; + ret_val.append( label ).append( $(actor).data( { + 'GA': $(page).attr('address'), + 'datatype': $(page).attr('datatype'), + 'mapping' : $(page).attr('mapping'), + 'style' : $(page).attr('style'), + 'type' : 'trigger', + 'sendValue': value + } ).bind('click',triggerAction) ); + + return ret_val; + }, + attributes: { + address: {type: "address", required: true}, + datatype: {type: "numeric", required: true}, + value: {type: "string", required: true}, + pre: {type: "string", required: false}, + post: {type: "string", required: false}, + mapping: {type: "mapping", required: false}, + style: {type: "style", required: false} + }, + content: "string" + }); + + this.addCreator("image", { + create: function( page, path ) { + var ret_val = $('<div class="widget" />'); + ret_val.addClass( 'image' ); + ret_val.append( '<div class="label">' + page.textContent + '</div>' ); + var style = ''; + if( $(page).attr('width') ) style += 'width:' + $(page).attr('width') + ';'; + if( $(page).attr('height') ) style += 'height:' + $(page).attr('height') + ';'; + if( style != '' ) style = 'style="' + style + '"'; + var actor = '<div class="actor"><img src="' +$(page).attr('src') + '" ' + style + ' /></div>'; + var refresh = $(page).attr('refresh') ? $(page).attr('refresh')*1000 : 0; + ret_val.append( $(actor).data( { + 'refresh': refresh + } ).each(setupRefreshAction) ); // abuse "each" to call in context... + return ret_val; + }, + attributes: { + src: {type: "uri", required: true}, + width: {type: "string", required: false}, + height: {type: "string", required: false}, + refresh: {type: "numeric", required: false} + }, + content: "string" + }); + + this.addCreator("video", { + create: function( page, path ) { + var ret_val = $('<div class="widget" />'); + ret_val.addClass( 'video' ); + ret_val.append( '<div class="label">' + page.textContent + '</div>' ); + var style = ''; + if( $(page).attr('width') ) style += 'width:' + $(page).attr('width') + ';'; + if( $(page).attr('height') ) style += 'height:' + $(page).attr('height') + ';'; + if( style != '' ) style = 'style="' + style + '"'; + var actor = '<div class="actor"><video src="' +$(page).attr('src') + '" ' + style + ' controls="controls" /></div>'; + var refresh = $(page).attr('refresh') ? $(page).attr('refresh')*1000 : 0; + ret_val.append( $(actor).data( { + 'refresh': refresh + } ).each(setupRefreshAction) ); // abuse "each" to call in context... + return ret_val; + }, + attributes: { + src: {type: "uri", required: true}, + width: {type: "string", required: false}, + height: {type: "string", required: false}, + refresh: {type: "numeric", required: false} + }, + content: "string" + }); + + this.addCreator("unknown", { + create: function( page, path ) { + var ret_val = $('<div class="widget" />'); + ret_val.append( '<pre>' + page.textContent + '</pre>' ); + return ret_val; + }, + attributes: { + }, + content: "string" + }); + + this.switchAction = function() { var data = $(this).data(); // alert( data.GA + ' = ' + data.value ); visu.write( data.GA, data.value=='1' ? '0' : '1', data.datatype ); } - this.slideAction = function(event,ui) - { + this.slideAction = function(event,ui) { //alert(ui.value); var now = new Date().getTime(); var data = $( '.actor', $(this).parent() ).data(); @@ -229,8 +327,7 @@ * Setup a refresh interval in seconds if the 'refresh' in the .data() * ist bigger than 0 */ - this.refreshAction = function(that) - { + this.refreshAction = function(that) { var data = $(this).data(); alert('this.refreshAction'); } Modified: CometVisu/trunk/visu/visu_config.xsd =================================================================== --- CometVisu/trunk/visu/visu_config.xsd 2010-11-06 17:01:33 UTC (rev 86) +++ CometVisu/trunk/visu/visu_config.xsd 2010-11-06 18:08:50 UTC (rev 87) @@ -178,7 +178,7 @@ <xsd:attribute name="src" type="uri" use="required" /> <xsd:attribute name="width" type="dimension" /> <xsd:attribute name="height" type="dimension" /> - <xsd:attribute name="refresh" type="xsd:decima" /> + <xsd:attribute name="refresh" type="xsd:decimal" /> </xsd:extension> </xsd:simpleContent> </xsd:complexType> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-06 17:01:41
|
Revision: 86 http://openautomation.svn.sourceforge.net/openautomation/?rev=86&view=rev Author: nilss1 Date: 2010-11-06 17:01:33 +0000 (Sat, 06 Nov 2010) Log Message: ----------- Sheduler testing Added Paths: ----------- PyWireGate/trunk/cycler.py Added: PyWireGate/trunk/cycler.py =================================================================== --- PyWireGate/trunk/cycler.py (rev 0) +++ PyWireGate/trunk/cycler.py 2010-11-06 17:01:33 UTC (rev 86) @@ -0,0 +1,203 @@ +# -*- coding: iso8859-1 -*- +## ----------------------------------------------------- +## Cycler +## ----------------------------------------------------- +## Copyright (c) 2010, knx-user-forum e.V, All rights reserved. +## +## This program 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 3 of the License, or (at your option) any later version. +## +## This program 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 this program; +## if not, see <http://www.gnu.de/documents/gpl-3.0.de.html>. + +import threading + +import time + + +class cycler: + def __init__(self,WireGateInstance): + self.WG = WireGateInstance + + self.isrunning = True + ## Dummy Timer + self.waiting = threading.Timer(0,lambda: None) + self.waiting.setDaemon(1) + self.mutex = threading.RLock() + self.getTime = lambda x: x.getTime + self.timerList = [] + self.running = {} + + def debug(self,msg): + print "DEBUG Cycler: %s" % msg + def remove(self, obj): + if not self.isrunning: + ## dont try to get a mutex + return False + try: + self.mutex.acquire() + if obj in self.timerList: + try: + self.timerList.remove(obj) + except: + pass + self.debug("Removed %r" % obj.action) + if len(self.timerList) == 0: + ## kill waiting timer + self.debug("Cancel GLobal wait") + self.waiting.cancel() + if obj in self.running: + try: + if self.running[obj].isAlive(): + self.running[obj].cancel() + self.debug("Canceled %r" % obj.args) + finally: + self.debug("terminated %r" % obj.args) + del self.running[obj] + + finally: + self.mutex.release() + + + def add(self,rtime,function,*args,**kwargs): + if not self.isrunning: + ## dont try to get a mutex + return False + self.debug("adding task: %r (%r / %r)" % (function,args,kwargs)) + self.addShedule(sheduleObject(self,self.WG,rtime,function,args=args,kwargs=kwargs)) + + def cycle(self,rtime,function,*args,**kwargs): + if not self.isrunning: + ## dont try to get a mutex + return False + self.debug("adding cycliv task: %r (%r / %r)" % (function,args,kwargs)) + self.addShedule(sheduleObject(self,self.WG,rtime,function,cycle=True,args=args,kwargs=kwargs)) + + def addShedule(self,shed): + print "ADD _shed %r" % shed + self.mutex.acquire() + self.timerList.append(shed) + ## Try to stop running timer + try: + self.waiting.cancel() + except: + pass + self.timerList.sort(key=self.getTime) + self.mutex.release() + + ## check if any Timer need activation + self._check() + + return shed + + + def _check(self): + self.debug("Cycle") + try: + self.mutex.acquire() + ## all actions that need activation in next 60seconds + for shedobj in filter(lambda x: x.getTime() < 60, self.timerList): + try: + self.running[shedobj] = threading.Timer(shedobj.getTime(),shedobj.run) + self.running[shedobj].start() + #print "run %s" % t.name + except: + print "Failed" + raise + ## remove from List because its now in the past + self.timerList.remove(shedobj) + finally: + if len(self.timerList) >0: + print "Wait for later timer %r" % (self.timerList[0].getTime()-5) + self.waiting = threading.Timer(self.timerList[0].getTime()-5 ,self._check) + self.waiting.start() + self.mutex.release() + + + def shutdown(self): + print "Try killing" + self.isrunning = False + try: + ## stop all new timer + self.mutex.acquire() + print "Have Mutex" + self.waiting.cancel() + try: + self.waiting.join(2) + except: + ## maybe not even running + pass + print "Thread canceld" + self.timerList = [] + for obj in self.running.keys(): + print "cancel task %r" % obj.args + try: + tobecanceled = self.running.pop(obj) + + except: + pass + tobecanceled.cancel() + tobecanceled.is + tobecanceled.join(2) + + + except: + self.debug("SHUTDOWN FAILED") + + +class sheduleObject: + def __init__(self,parent,WireGateInstance,rtime,function,cycle=False,args = [],kwargs={}): + self.Parent = parent + self.WG = WireGateInstance + self.delay = rtime + self.cycle = cycle + self._set() + self.action = function + self.args = args + self.kwargs = kwargs + + def _set(self): + self.timer = time.time() + self.delay + + def run(self): + args = self.args + kwargs = self.kwargs + self.action(*args,**kwargs) + self.Parent.remove(self) + if self.cycle: + self._set() + self.Parent.addShedule(self) + + + def getTime(self): + return self.timer - time.time() + + + +if __name__ == '__main__': + try: + cycle = cycler(False) + import sys + import atexit + atexit.register(cycle.shutdown) + def write_time(text=''): + print "running %s: %f" % (text,time.time()) + write_time('Main') + cycle.cycle(4,write_time,"Cycletask1!") + #longtask=cycle.add(80,write_time,"task2!") + #f=cycle.add(7,write_time,"task3!") + time.sleep(2) + #cycle.remove(f) + #time.sleep(5) + #cycle.remove(longtask) + #cycle.shutdown() + #cycle.add(6,write_time,"task4!") + except KeyboardInterrupt: + #cycle.shutdown() + sys.exit(0) + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2010-11-05 21:55:33
|
Revision: 85 http://openautomation.svn.sourceforge.net/openautomation/?rev=85&view=rev Author: mayerch Date: 2010-11-05 21:55:26 +0000 (Fri, 05 Nov 2010) Log Message: ----------- Created "creators" object in the VisuDesign object to simplify page creation and provide meta information for a future editor version Modified Paths: -------------- CometVisu/trunk/visu/lib/templateengine.js CometVisu/trunk/visu/lib/visudesign_custom.js CometVisu/trunk/visu/lib/visudesign_pure.js Modified: CometVisu/trunk/visu/lib/templateengine.js =================================================================== --- CometVisu/trunk/visu/lib/templateengine.js 2010-11-05 20:29:23 UTC (rev 84) +++ CometVisu/trunk/visu/lib/templateengine.js 2010-11-05 21:55:26 UTC (rev 85) @@ -215,34 +215,9 @@ function create_pages( page, path ) { - switch( page.nodeName ) - { - case 'page': - return design.createPage( page, path ); - case 'line': - return design.createLine(); - case 'break': - return design.createBreak(); - case 'text': - return design.createText( page ); - case 'info': - case 'shade': - return design.createInfo( page ); - case 'dim': - return design.createDim( page ); - case 'slide': - return design.createSlide( page ); - case 'switch': - case 'toggle': - return design.createSwitch( page ); - case 'trigger': - return design.createTrigger( page ); - case 'image': - return design.createImage( page ); - case 'video': - return design.createVideo( page ); - } - return design.createUnknown( page ); + if( design.creators[ page.nodeName ] ) + return design.creators[ page.nodeName ]( page, path ); + return design.creators.unknown( page ); } function scrollToPage( page_id ) Modified: CometVisu/trunk/visu/lib/visudesign_custom.js =================================================================== --- CometVisu/trunk/visu/lib/visudesign_custom.js 2010-11-05 20:29:23 UTC (rev 84) +++ CometVisu/trunk/visu/lib/visudesign_custom.js 2010-11-05 21:55:26 UTC (rev 85) @@ -24,7 +24,7 @@ /** * Custom changes could go here and look e.g. like **************************************** -VisuDesign_Custom.prototype.createText = function( page ) +VisuDesign_Custom.prototype.creators.text = function( page ) { var ret_val = $('<div class="widget" />'); ret_val.addClass( 'text' ); Modified: CometVisu/trunk/visu/lib/visudesign_pure.js =================================================================== --- CometVisu/trunk/visu/lib/visudesign_pure.js 2010-11-05 20:29:23 UTC (rev 84) +++ CometVisu/trunk/visu/lib/visudesign_pure.js 2010-11-05 21:55:26 UTC (rev 85) @@ -20,7 +20,12 @@ */ function VisuDesign() { - this.createPage = function( page, path ) + /** + * The creators object contians all widgets creators and their mappin to the + * XML config file tags + */ + this.creators = {}; + this.creators.page = function( page, path ) { var ret_val = $('<div class="widget" />'); var style = ( '0' != path ) ? 'display:none' : ''; @@ -39,17 +44,17 @@ return ret_val; } - this.createLine = function() + this.creators.line = function() { return $( '<hr />' ); } - this.createBreak = function() + this.creators.break = function() { return $( '<br />' ); } - this.createText = function( page ) + this.creators.text = function( page ) { var ret_val = $('<div class="widget" />'); ret_val.addClass( 'text' ); @@ -60,8 +65,8 @@ return ret_val; } - this.createInfo = - this.createShade = function( page ) + this.creators.info = + this.creators.shade = function( page ) { var ret_val = $('<div class="widget" />'); ret_val.addClass( 'info' ); @@ -81,8 +86,8 @@ return ret_val; } - this.createDim = - this.createSlide = function( page ) + this.creators.dim = + this.creators.slide = function( page ) { var ret_val = $('<div class="widget" />'); ret_val.addClass( 'dim' ); @@ -108,8 +113,8 @@ return ret_val; } - this.createSwitch = - this.createToggle = function( page ) + this.creators.switch = + this.creators.toggle = function( page ) { var ret_val = $('<div class="widget" />'); ret_val.addClass( 'switch' ); @@ -131,7 +136,7 @@ return ret_val; } - this.createTrigger = function( page ) + this.creators.trigger = function( page ) { var value = $(page).attr('value') ? $(page).attr('value') : 0; var ret_val = $('<div class="widget" />'); @@ -159,7 +164,7 @@ return ret_val; } - this.createImage = function( page ) + this.creators.image = function( page ) { var ret_val = $('<div class="widget" />'); ret_val.addClass( 'image' ); @@ -176,7 +181,7 @@ return ret_val; } - this.createVideo = function( page ) + this.creators.video = function( page ) { var ret_val = $('<div class="widget" />'); ret_val.addClass( 'video' ); @@ -193,7 +198,7 @@ return ret_val; } - this.createUnknown = function( page ) + this.creators.unknown = function( page ) { var ret_val = $('<div class="widget" />'); ret_val.append( '<pre>' + page.textContent + '</pre>' ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2010-11-05 20:29:29
|
Revision: 84 http://openautomation.svn.sourceforge.net/openautomation/?rev=84&view=rev Author: mayerch Date: 2010-11-05 20:29:23 +0000 (Fri, 05 Nov 2010) Log Message: ----------- Added refresh@image and video tag to definitions Modified Paths: -------------- CometVisu/trunk/visu/visu_config.xsd Modified: CometVisu/trunk/visu/visu_config.xsd =================================================================== --- CometVisu/trunk/visu/visu_config.xsd 2010-11-05 19:56:15 UTC (rev 83) +++ CometVisu/trunk/visu/visu_config.xsd 2010-11-05 20:29:23 UTC (rev 84) @@ -103,6 +103,7 @@ <xsd:element name="info" type="info" /> <xsd:element name="shade" type="info" /> <xsd:element name="image" type="image" /> + <xsd:element name="video" type="video" /> <xsd:element name="break" type="break" /> <xsd:element ref="page" /> </xsd:choice> @@ -177,10 +178,21 @@ <xsd:attribute name="src" type="uri" use="required" /> <xsd:attribute name="width" type="dimension" /> <xsd:attribute name="height" type="dimension" /> + <xsd:attribute name="refresh" type="xsd:decima" /> </xsd:extension> </xsd:simpleContent> </xsd:complexType> +<xsd:complexType name="video"> + <xsd:simpleContent> + <xsd:extension base="xsd:string"> + <xsd:attribute name="src" type="uri" use="required" /> + <xsd:attribute name="width" type="dimension" /> + <xsd:attribute name="height" type="dimension" /> + </xsd:extension> + </xsd:simpleContent> +</xsd:complexType> + <xsd:complexType name="break" /> <xsd:complexType name="line" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2010-11-05 19:56:21
|
Revision: 83 http://openautomation.svn.sourceforge.net/openautomation/?rev=83&view=rev Author: mayerch Date: 2010-11-05 19:56:15 +0000 (Fri, 05 Nov 2010) Log Message: ----------- - New Feature: tag for videos (HTML5 based) Modified Paths: -------------- CometVisu/trunk/ChangeLog Modified: CometVisu/trunk/ChangeLog =================================================================== --- CometVisu/trunk/ChangeLog 2010-11-05 19:53:53 UTC (rev 82) +++ CometVisu/trunk/ChangeLog 2010-11-05 19:56:15 UTC (rev 83) @@ -9,6 +9,7 @@ - New Feature: tag for images - New Feature: <text> has new optional attribute "align" - Added XML Schema / XSD to validate config-XML +- New Feature: tag for videos (HTML5 based) 0.5.0 ===== This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2010-11-05 19:53:59
|
Revision: 82 http://openautomation.svn.sourceforge.net/openautomation/?rev=82&view=rev Author: mayerch Date: 2010-11-05 19:53:53 +0000 (Fri, 05 Nov 2010) Log Message: ----------- New Feature: tag for videos (HTML5 based) Modified Paths: -------------- CometVisu/trunk/visu/lib/templateengine.js CometVisu/trunk/visu/lib/visudesign_pure.js Modified: CometVisu/trunk/visu/lib/templateengine.js =================================================================== --- CometVisu/trunk/visu/lib/templateengine.js 2010-11-05 18:35:30 UTC (rev 81) +++ CometVisu/trunk/visu/lib/templateengine.js 2010-11-05 19:53:53 UTC (rev 82) @@ -239,6 +239,8 @@ return design.createTrigger( page ); case 'image': return design.createImage( page ); + case 'video': + return design.createVideo( page ); } return design.createUnknown( page ); } Modified: CometVisu/trunk/visu/lib/visudesign_pure.js =================================================================== --- CometVisu/trunk/visu/lib/visudesign_pure.js 2010-11-05 18:35:30 UTC (rev 81) +++ CometVisu/trunk/visu/lib/visudesign_pure.js 2010-11-05 19:53:53 UTC (rev 82) @@ -176,6 +176,23 @@ return ret_val; } + this.createVideo = function( page ) + { + var ret_val = $('<div class="widget" />'); + ret_val.addClass( 'video' ); + ret_val.append( '<div class="label">' + page.textContent + '</div>' ); + var style = ''; + if( $(page).attr('width') ) style += 'width:' + $(page).attr('width') + ';'; + if( $(page).attr('height') ) style += 'height:' + $(page).attr('height') + ';'; + if( style != '' ) style = 'style="' + style + '"'; + var actor = '<div class="actor"><video src="' +$(page).attr('src') + '" ' + style + ' controls="controls" /></div>'; + var refresh = $(page).attr('refresh') ? $(page).attr('refresh')*1000 : 0; + ret_val.append( $(actor).data( { + 'refresh': refresh + } ).each(setupRefreshAction) ); // abuse "each" to call in context... + return ret_val; + } + this.createUnknown = function( page ) { var ret_val = $('<div class="widget" />'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2010-11-05 18:35:36
|
Revision: 81 http://openautomation.svn.sourceforge.net/openautomation/?rev=81&view=rev Author: mayerch Date: 2010-11-05 18:35:30 +0000 (Fri, 05 Nov 2010) Log Message: ----------- New Feature: images allow refresh attribute Modified Paths: -------------- CometVisu/trunk/visu/lib/templateengine.js CometVisu/trunk/visu/lib/visudesign_pure.js CometVisu/trunk/visu/visu_config.xml Modified: CometVisu/trunk/visu/lib/templateengine.js =================================================================== --- CometVisu/trunk/visu/lib/templateengine.js 2010-11-05 10:25:12 UTC (rev 80) +++ CometVisu/trunk/visu/lib/templateengine.js 2010-11-05 18:35:30 UTC (rev 81) @@ -290,6 +290,22 @@ visu.write( data.GA, data.sendValue, data.datatype ); } +function refreshAction( target, src ) +{ + target.src = src + '&' + new Date().getTime(); +} +function setupRefreshAction() +{ + var refresh = $(this).data('refresh'); + if( refresh && refresh > 0 ) + { + var target = $('img', $(this) )[0]; + var src = target.src; + if( src.indexOf('?') < 0 ) src += '?'; + $(this).data('interval', setInterval( function(){refreshAction(target, src);}, refresh ) ); + } +} + /** * The update thread to send the slider position to the bus */ Modified: CometVisu/trunk/visu/lib/visudesign_pure.js =================================================================== --- CometVisu/trunk/visu/lib/visudesign_pure.js 2010-11-05 10:25:12 UTC (rev 80) +++ CometVisu/trunk/visu/lib/visudesign_pure.js 2010-11-05 18:35:30 UTC (rev 81) @@ -168,7 +168,11 @@ if( $(page).attr('width') ) style += 'width:' + $(page).attr('width') + ';'; if( $(page).attr('height') ) style += 'height:' + $(page).attr('height') + ';'; if( style != '' ) style = 'style="' + style + '"'; - ret_val.append( '<div class="actor"><img src="' +$(page).attr('src') + '" ' + style + ' /></div>' ); + var actor = '<div class="actor"><img src="' +$(page).attr('src') + '" ' + style + ' /></div>'; + var refresh = $(page).attr('refresh') ? $(page).attr('refresh')*1000 : 0; + ret_val.append( $(actor).data( { + 'refresh': refresh + } ).each(setupRefreshAction) ); // abuse "each" to call in context... return ret_val; } @@ -198,4 +202,14 @@ //visu.write( data.GA, data.value=='1' ? '0' : '1', data.datatype ); //FIXME eigentlich richtig... visu.write( data.GA, ui.value, data.datatype ); } + + /** + * Setup a refresh interval in seconds if the 'refresh' in the .data() + * ist bigger than 0 + */ + this.refreshAction = function(that) + { + var data = $(this).data(); + alert('this.refreshAction'); + } }; Modified: CometVisu/trunk/visu/visu_config.xml =================================================================== --- CometVisu/trunk/visu/visu_config.xml 2010-11-05 10:25:12 UTC (rev 80) +++ CometVisu/trunk/visu/visu_config.xml 2010-11-05 18:35:30 UTC (rev 81) @@ -48,6 +48,9 @@ <image src="icon/comet_128_ff8000.png" >Ein Bild</image> <image src="icon/comet_128_ff8000.png" /> <image src="icon/comet_128_ff8000.png" width="500px" height="46px" /> + <image src="http://www.e-zeeinternet.com/count.php?page=546016&style=default&nbdigits=9&reloads=1" refresh="10" >Update every 10 sec</image> + <break /> + <image src="http://www.yr.no/place/Germany/Bavaria/Holzkirchen~2899676/meteogram.png" refresh="1800" /> <line /> <info address="1/0/41" datatype="1.000" mapping="OnOff">Treppenlicht</info> <page name="Fenster Kontakte"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-05 10:25:19
|
Revision: 80 http://openautomation.svn.sourceforge.net/openautomation/?rev=80&view=rev Author: nilss1 Date: 2010-11-05 10:25:12 +0000 (Fri, 05 Nov 2010) Log Message: ----------- fix loglevel notice, disable user switching until permissions fixed Modified Paths: -------------- PyWireGate/trunk/WireGate.py PyWireGate/trunk/log/__init__.py Modified: PyWireGate/trunk/WireGate.py =================================================================== --- PyWireGate/trunk/WireGate.py 2010-11-04 22:27:12 UTC (rev 79) +++ PyWireGate/trunk/WireGate.py 2010-11-05 10:25:12 UTC (rev 80) @@ -22,8 +22,9 @@ import signal import traceback import daemon -import log as logging +import log + import ConfigParser import datastore @@ -142,20 +143,23 @@ startuser=pwd.getpwuid(os.getuid()) try: runasuser=pwd.getpwnam(self.config['WireGate']['user']) - - ##Set Permissions + getpath = lambda x: "/".join(x.split("/")[:-1]) + + ##Set Permissions on os.chown(self.config['WireGate']['pidfile'],runasuser[2],runasuser[3]) os.chown(self.config['WireGate']['logfile'],runasuser[2],runasuser[3]) os.chown(self.config['WireGate']['datastore'],runasuser[2],runasuser[3]) - os.setregid(runasuser[3],runasuser[3]) - os.setreuid(runasuser[2],runasuser[2]) + + ##removed until fixing permissions + #os.setregid(runasuser[3],runasuser[3]) + #os.setreuid(runasuser[2],runasuser[2]) - self.log("Change User/Group from %s(%d) to %s(%d)" % (startuser[0],startuser[2],runasuser[0],runasuser[2])) + self.log("Change User/Group from %s(%d) to %s(%d) FIXME: disabled" % (startuser[0],startuser[2],runasuser[0],runasuser[2])) except KeyError: pass - if os.getuid()==0: - self.log("\n### Run as root is not recommend\n### set user in pywiregate.conf\n\n") + if os.getuid() == 0: + self.log("### Run as root is not recommend ### set user in pywiregate.conf",'warn') ## Mainloop only checking for Watchdog while True: @@ -224,16 +228,16 @@ maxlevel = self.config['WireGate']['loglevel'] if not filename: filename = self.config['WireGate']['logfile'] - LEVELS = {'debug': logging.DEBUG,'info': logging.INFO,'notice': logging.NOTICE,'warning': logging.WARNING,'error': logging.ERROR,'critical': logging.CRITICAL} - level = LEVELS.get(maxlevel, logging.NOTSET) + LEVELS = {'debug': log.logging.DEBUG,'info': log.logging.INFO,'notice': log.logging.NOTICE,'warning': log.logging.WARNING,'error': log.logging.ERROR,'critical': log.logging.CRITICAL} + level = LEVELS.get(maxlevel, log.logging.NOTSET) # create logger - formatter = logging.Formatter('%(asctime)s %(name)-12s: %(levelname)-8s %(message)s') - logger = logging.getLogger(instance) + formatter = log.logging.Formatter('%(asctime)s %(name)-12s: %(levelname)-8s %(message)s') + logger = log.logging.getLogger(instance) logger.setLevel(level) if filename: ## python handle logrotating - handler = logging.handlers.TimedRotatingFileHandler(filename,'MIDNIGHT',encoding='utf-8',backupCount=7) + handler = log.logging.handlers.TimedRotatingFileHandler(filename,'MIDNIGHT',encoding='utf-8',backupCount=7) ## Handler if logrotate handles Logfiles #handler = logging.handlers.WatchedFileHandle(filename) @@ -245,7 +249,7 @@ # create console handler and set level to debug if self.REDIRECTIO: #console = logging.StreamHandler() - console = logging.isoStreamHandler() + console = log.isoStreamHandler() console.setFormatter(formatter) logger.addHandler(console) return logger @@ -257,24 +261,31 @@ except KeyError: logger = self.LOGGER[instance] = self.createLog(instance) pass - if severity=="debug": - logger.debug(msg) - elif severity=="info": - logger.info(msg) - elif severity=="notice": - logger.notice(msg) - elif severity=="warning": - logger.warning(msg) - elif severity=="warn": - logger.warning(msg) - elif severity=="error": - logger.error(msg) - elif severity=="critical": - logger.critical(msg) - else: - logger.info(msg) + try: + if severity=="debug": + logger.debug(msg) + elif severity=="info": + logger.info(msg) + elif severity=="notice": + logger.notice(msg) + elif severity=="warning": + logger.warning(msg) + elif severity=="warn": + #print "SEVERITY: %r " % logging._levelNames + logger.warning(msg) + elif severity=="error": + logger.error(msg) + elif severity=="critical": + logger.critical(msg) + else: + logger.info(msg) + except: + ## logging shouldnt break execution + #pass + raise + def debug(self,msg): self.log(msg,"debug") Modified: PyWireGate/trunk/log/__init__.py =================================================================== --- PyWireGate/trunk/log/__init__.py 2010-11-04 22:27:12 UTC (rev 79) +++ PyWireGate/trunk/log/__init__.py 2010-11-05 10:25:12 UTC (rev 80) @@ -1,25 +1,29 @@ # -*- coding: iso8859-1 -*- -from logging import * -import logging.handlers as handlers +## add notice as loglevel +import logging +import logging.handlers +import sys + +logging._acquireLock() ## redefine logging # Change the default levels to include NOTICE in # the proper order of priority -FATAL = CRITICAL = 60 -ERROR = 50 -WARN = WARNING = 40 -NOTICE = 30 +logging.FATAL = logging.CRITICAL = FATAL = CRITICAL = 60 +logging.ERROR = ERROR = 50 +logging.WARN = logging.WARNING = WARN = WARNING = 40 +logging.NOTICE = NOTICE = 30 # insert the levels with all the redefined values # anything below NOTICE we don't have to add back in, its # not getting redefined above with a new value -addLevelName(NOTICE, 'NOTICE') -addLevelName(WARNING, 'WARNING') -addLevelName(WARN, 'WARN') -addLevelName(ERROR, 'ERROR') -addLevelName(FATAL, 'FATAL') -addLevelName(CRITICAL, 'CRITICAL') +logging.addLevelName(NOTICE, 'NOTICE') +logging.addLevelName(WARNING, 'WARNING') +logging.addLevelName(WARN, 'WARN') +logging.addLevelName(ERROR, 'ERROR') +logging.addLevelName(FATAL, 'FATAL') +logging.addLevelName(CRITICAL, 'CRITICAL') # define a new logger function for notice # this is exactly like existing info, critical, debug...etc @@ -39,7 +43,7 @@ apply(self._log, (NOTICE, msg, args), kwargs) # make the notice function known in the system Logger class -Logger.notice = Logger_notice +logging.Logger.notice = Logger_notice # define a new root level notice function # this is exactly like existing info, critical, debug...etc @@ -52,17 +56,18 @@ apply(root.notice, (msg,)+args, kwargs) # make the notice root level function known -notice = root_notice +logging.notice = root_notice # add NOTICE to the priority map of all the levels -handlers.SysLogHandler.priority_map['NOTICE'] = 'notice' +logging.handlers.SysLogHandler.priority_map['NOTICE'] = 'notice' +logging._releaseLock() -class isoStreamHandler(StreamHandler): +class isoStreamHandler(logging.StreamHandler): def emit(self,record): #record.message = record.message.decode('utf-8').encode('iso-8859-15') record.message = record.message.encode(sys.stderr.encoding) - StreamHandler.emit(self,record) + logging.StreamHandler.emit(self,record) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-04 22:27:19
|
Revision: 79 http://openautomation.svn.sourceforge.net/openautomation/?rev=79&view=rev Author: nilss1 Date: 2010-11-04 22:27:12 +0000 (Thu, 04 Nov 2010) Log Message: ----------- put logging to subfolder and include loglevel notice Modified Paths: -------------- PyWireGate/trunk/WireGate.py Added Paths: ----------- PyWireGate/trunk/log/ PyWireGate/trunk/log/__init__.py Modified: PyWireGate/trunk/WireGate.py =================================================================== --- PyWireGate/trunk/WireGate.py 2010-11-04 21:54:13 UTC (rev 78) +++ PyWireGate/trunk/WireGate.py 2010-11-04 22:27:12 UTC (rev 79) @@ -22,12 +22,10 @@ import signal import traceback import daemon -import logging -import logging.handlers +import log as logging import ConfigParser - import datastore class WireGate(daemon.Daemon): @@ -64,11 +62,10 @@ 'loglevel': 'info' } + self.checkconfig("WireGate",defaultconfig) ## Remove this later if "plugins" in self.config['WireGate']: self.log("old Config",'critical') - - self.checkconfig("WireGate",defaultconfig) @@ -227,7 +224,7 @@ maxlevel = self.config['WireGate']['loglevel'] if not filename: filename = self.config['WireGate']['logfile'] - LEVELS = {'debug': logging.DEBUG,'info': logging.INFO,'warning': logging.WARNING,'error': logging.ERROR,'critical': logging.CRITICAL} + LEVELS = {'debug': logging.DEBUG,'info': logging.INFO,'notice': logging.NOTICE,'warning': logging.WARNING,'error': logging.ERROR,'critical': logging.CRITICAL} level = LEVELS.get(maxlevel, logging.NOTSET) # create logger @@ -248,7 +245,7 @@ # create console handler and set level to debug if self.REDIRECTIO: #console = logging.StreamHandler() - console = isoStreamHandler() + console = logging.isoStreamHandler() console.setFormatter(formatter) logger.addHandler(console) return logger @@ -265,7 +262,7 @@ elif severity=="info": logger.info(msg) elif severity=="notice": - logger.info(msg) + logger.notice(msg) elif severity=="warning": logger.warning(msg) elif severity=="warn": @@ -287,13 +284,6 @@ os.umask(0) -class isoStreamHandler(logging.StreamHandler): - def emit(self,record): - #record.message = record.message.decode('utf-8').encode('iso-8859-15') - record.message = record.message.encode(sys.stderr.encoding) - logging.StreamHandler.emit(self,record) - - if __name__ == "__main__": try: import os @@ -340,4 +330,3 @@ - Added: PyWireGate/trunk/log/__init__.py =================================================================== --- PyWireGate/trunk/log/__init__.py (rev 0) +++ PyWireGate/trunk/log/__init__.py 2010-11-04 22:27:12 UTC (rev 79) @@ -0,0 +1,68 @@ +# -*- coding: iso8859-1 -*- +from logging import * +import logging.handlers as handlers + + +## redefine logging +# Change the default levels to include NOTICE in +# the proper order of priority +FATAL = CRITICAL = 60 +ERROR = 50 +WARN = WARNING = 40 +NOTICE = 30 + +# insert the levels with all the redefined values +# anything below NOTICE we don't have to add back in, its +# not getting redefined above with a new value +addLevelName(NOTICE, 'NOTICE') +addLevelName(WARNING, 'WARNING') +addLevelName(WARN, 'WARN') +addLevelName(ERROR, 'ERROR') +addLevelName(FATAL, 'FATAL') +addLevelName(CRITICAL, 'CRITICAL') + +# define a new logger function for notice +# this is exactly like existing info, critical, debug...etc +def Logger_notice(self, msg, *args, **kwargs): + """ + Log 'msg % args' with severity 'NOTICE'. + + To pass exception information, use the keyword argument exc_info +with + a true value, e.g. + + logger.notice("Houston, we have a %s", "major disaster", exc_info=1) + """ + if self.manager.disable >= NOTICE: + return + if NOTICE >= self.getEffectiveLevel(): + apply(self._log, (NOTICE, msg, args), kwargs) + +# make the notice function known in the system Logger class +Logger.notice = Logger_notice + +# define a new root level notice function +# this is exactly like existing info, critical, debug...etc +def root_notice(msg, *args, **kwargs): + """ + Log a message with severity 'NOTICE' on the root logger. + """ + if len(root.handlers) == 0: + basicConfig() + apply(root.notice, (msg,)+args, kwargs) + +# make the notice root level function known +notice = root_notice + +# add NOTICE to the priority map of all the levels +handlers.SysLogHandler.priority_map['NOTICE'] = 'notice' + + +class isoStreamHandler(StreamHandler): + def emit(self,record): + #record.message = record.message.decode('utf-8').encode('iso-8859-15') + record.message = record.message.encode(sys.stderr.encoding) + StreamHandler.emit(self,record) + + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-04 21:54:19
|
Revision: 78 http://openautomation.svn.sourceforge.net/openautomation/?rev=78&view=rev Author: nilss1 Date: 2010-11-04 21:54:13 +0000 (Thu, 04 Nov 2010) Log Message: ----------- added Warning when non Unicode Data ist set by a connector Modified Paths: -------------- PyWireGate/trunk/datastore.py Modified: PyWireGate/trunk/datastore.py =================================================================== --- PyWireGate/trunk/datastore.py 2010-11-04 21:50:46 UTC (rev 77) +++ PyWireGate/trunk/datastore.py 2010-11-04 21:54:13 UTC (rev 78) @@ -208,6 +208,9 @@ self.write_mutex.acquire() ## save the modified time self.lastupdate = time.time() + if type(val) == str: + self.WG.log("Non Unicode Value received for %s" % self.id,'warning') + val = unicode(val,encoding='iso-8859-15',errors='ignore') self.value = val if send: self._setValue(self) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-04 21:50:52
|
Revision: 77 http://openautomation.svn.sourceforge.net/openautomation/?rev=77&view=rev Author: nilss1 Date: 2010-11-04 21:50:46 +0000 (Thu, 04 Nov 2010) Log Message: ----------- Fixed: Date and Time returned str instead pf unicode Modified Paths: -------------- PyWireGate/trunk/knx_connector/DPT_Types.py Modified: PyWireGate/trunk/knx_connector/DPT_Types.py =================================================================== --- PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-04 21:39:18 UTC (rev 76) +++ PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-04 21:50:46 UTC (rev 77) @@ -291,7 +291,7 @@ sec = raw[2] & 0x3f ## Fixme: eigentlich sollte Zeit als Unix Timestamp gespeichert werden, was macht man mit dem Wochentag ## machs erstmal so wie makki - return "%s %d:%d:%d" % (weekdays[weekday], hour,min,sec) + return u"%s %d:%d:%d" % (weekdays[weekday], hour,min,sec) def encodeDPT10(self,val): ## checktype default unix timestamp @@ -345,7 +345,7 @@ year += 2000 else: year += 1900 - return "%02d.%02d.%04d" % (day,mon,year) + return u"%02d.%02d.%04d" % (day,mon,year) def encodeDPT11(self,val): if type(val) in [float, int]: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-04 21:39:25
|
Revision: 76 http://openautomation.svn.sourceforge.net/openautomation/?rev=76&view=rev Author: nilss1 Date: 2010-11-04 21:39:18 +0000 (Thu, 04 Nov 2010) Log Message: ----------- completed DPT encode Modified Paths: -------------- PyWireGate/trunk/knx_connector/DPT_Types.py Modified: PyWireGate/trunk/knx_connector/DPT_Types.py =================================================================== --- PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-04 20:51:46 UTC (rev 75) +++ PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-04 21:39:18 UTC (rev 76) @@ -124,7 +124,8 @@ return msg def errormsg(self,msg=False): - self.WG.errorlog(msg) + if self.WG: + self.WG.errorlog(msg) def debug(self,msg): self.log(msg,'debug') @@ -132,7 +133,8 @@ def log(self,msg,severity='info',instance=False): if not instance: instance = "dpt-types" - self.WG.log(msg,severity,instance) + if self.WG: + self.WG.log(msg,severity,instance) def toByteArray(self,val,length): ## Set ByteArray @@ -160,7 +162,7 @@ return int(raw[0]) & 0x1 def encodeDPT1(self,val): - pass + return int(val) & 0x1 def decodeDPT2(self,raw): ## 2 Bit Control @@ -171,7 +173,7 @@ return int(raw[0]) & 0x3 def encodeDPT2(self,val): - pass + return int(val) & 0x3 def decodeDPT3(self,raw): ## 4 bit Dim (DPT 3.007) @@ -183,29 +185,35 @@ return int(raw[0]) & 0xf def encodeDPT3(self,val): - pass + return int(val) & 0xf def decodeDPT4(self,raw): - ## 1 Byte Character - return chr(raw[0] & 0xff) + ## 1 Byte Character + ## ISO 2 Unicode + return chr(raw[0] & 0xff).decode('iso-8859-15') def encodeDPT4(self,val): - pass + if type(val) == unicode: + ## convert to str + val = val.encode('iso-8859-15') + if type(val) <> str: + val = "%r" % val + return ord(val[0]) & 0xff def decodeDPT5(self,raw): ## 1 Byte unsigned - return (int(raw[0] & 0xff)) + return int(raw[0]) & 0xff def encodeDPT5(self,val): - pass + return int(val) & 0xff def decodeDPT501(self,raw): ## 1 Byte unsigned percent self.debug("DPT5.001 Scaling: value: %d" % raw[0]) - return int(raw[0] & 0xff) * 100 / 255 + return (int(raw[0]) & 0xff) * 100 / 255 def encodeDPT501(self,val): - pass + return (int(val) * 255 / 100 ) & 0xff def decodeDPT6(self,raw): ## 1 Byte signed @@ -213,14 +221,17 @@ return (val > 127 and val - 256 or val) def encodeDPT6(self,val): - pass + if val > 127: + ## Max + val = 127 + return int(val) & 0xff def decodeDPT7(self,raw): ## 2 byte unsigned return int(self.toBigInt(raw) & 0xffff) def encodeDPT7(self,val): - pass + return self.toByteArray(val & 0xffff,2) def decodeDPT8(self,raw): ## 2 Byte signed @@ -228,7 +239,9 @@ return (val > 32767 and val - 32768 or val) def encodeDPT8(self,val): - pass + if val > 32767: + val = 32767 + return self.toByteArray(val & 0xffff,2) def decodeDPT9(self,raw): ## 2 Byte Float @@ -242,7 +255,7 @@ exp = (val & 0x7800) >> 11 mant = val & 0x07ff if sign <> 0: - mant = -(~(mant - 1) & 0x7ff) + mant = -(~(mant - 1) & 0x07ff) self.debug("DPT9: value: %d sign: %d exp: %d mant: %f" % (val, sign,exp,mant)) return (1 << exp) * 0.01 * mant @@ -252,10 +265,11 @@ if val < 0: sign = 0x8000 mant = val * 100 - while mant > 2047: + while mant > 0x07ff: mant = mant >> 1 exp +=1 data = sign | (exp << 11) | (int(mant) & 0x07ff) + self.debug("DPT9: value: %d sign: %d exp: %d mant: %r" % (val, sign,exp,mant)) ## change to 2Byte bytearray return self.toByteArray(data,2) @@ -362,21 +376,22 @@ year -= 1900 else: year -= 2000 - return [ day & 0x1f, mon & 0xf, year & 0x7f ] def decodeDPT12(self,raw): return int(self.toBigInt(raw)) % 0xffffffff def encodeDPT12(self,val): - pass + return self.toByteArray(val & 0xffffffff,4) def decodeDPT13(self,raw): val = int(self.toBigInt(raw)) % 0xffffffff return (val > 2147483647 and val - 2147483648 or val) def encodeDPT13(self,val): - pass + if val > 2147483647: + val = 2147483647 + return self.toByteArray(val & 0xffffffff,4) def decodeDPT14(self,raw): ## 4 Byte Float @@ -394,7 +409,18 @@ return (1 << exp) * 0.01 * mant def encodeDPT14(self,val): - pass + sign = 0 + exp = 0 + if val < 0: + sign = 0x80000000 + mant = val * 100 + while mant > 0x7fffff: + mant = mant >> 1 + exp +=1 + data = sign | (exp << 23) | (int(mant) & 0x07ff) + self.debug("DPT14: value: %d sign: %d exp: %d mant: %r" % (val, sign,exp,mant)) + ## change to 4Byte bytearray + return self.toByteArray(data,4) def decodeDPT16(self,raw): res = "" @@ -405,10 +431,21 @@ res += chr(char) ## Decode ISO 2 Unicode - return res.decode("iso-8859-15") + return res.decode('iso-8859-15') def encodeDPT16(self,val): - pass + if type(val) == unicode: + val = val.encode('iso-8859-15') + ## max 14 + val = val[:14] + data = [] + for cnt in range(14): + if len(val) > cnt: + char = ord(val[cnt]) + else: + char = 0 + data.append(char) + return data def validTypes(self,datalen): ##TODO: @@ -441,8 +478,8 @@ if __name__ == "__main__": - dpttypes = dpt_type() + dpttypes = dpt_type(False) print dpttypes.decode([24,88],dptid=9) print dpttypes.decode([1],dptid=1) print dpttypes.decode([35,76,58],dptid=16) - \ No newline at end of file + print dpttypes.encode("Das ist",dptid=16) \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-04 20:51:52
|
Revision: 75 http://openautomation.svn.sourceforge.net/openautomation/?rev=75&view=rev Author: nilss1 Date: 2010-11-04 20:51:46 +0000 (Thu, 04 Nov 2010) Log Message: ----------- Changed logging to UTF-8 and console logging to default encoding of stderr Modified Paths: -------------- PyWireGate/trunk/WireGate.py Modified: PyWireGate/trunk/WireGate.py =================================================================== --- PyWireGate/trunk/WireGate.py 2010-11-04 20:06:44 UTC (rev 74) +++ PyWireGate/trunk/WireGate.py 2010-11-04 20:51:46 UTC (rev 75) @@ -236,17 +236,19 @@ logger.setLevel(level) if filename: ## python handle logrotating - handler = logging.handlers.TimedRotatingFileHandler(filename,'midnight',backupCount=7) + handler = logging.handlers.TimedRotatingFileHandler(filename,'MIDNIGHT',encoding='utf-8',backupCount=7) ## Handler if logrotate handles Logfiles #handler = logging.handlers.WatchedFileHandle(filename) handler.setFormatter(formatter) + handler.setLevel(level) logger.addHandler(handler) # create console handler and set level to debug if self.REDIRECTIO: - console = logging.StreamHandler() + #console = logging.StreamHandler() + console = isoStreamHandler() console.setFormatter(formatter) logger.addHandler(console) return logger @@ -285,7 +287,13 @@ os.umask(0) +class isoStreamHandler(logging.StreamHandler): + def emit(self,record): + #record.message = record.message.decode('utf-8').encode('iso-8859-15') + record.message = record.message.encode(sys.stderr.encoding) + logging.StreamHandler.emit(self,record) + if __name__ == "__main__": try: import os This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-04 20:06:50
|
Revision: 74 http://openautomation.svn.sourceforge.net/openautomation/?rev=74&view=rev Author: nilss1 Date: 2010-11-04 20:06:44 +0000 (Thu, 04 Nov 2010) Log Message: ----------- added time and date and changed dpt16 to unicode Modified Paths: -------------- PyWireGate/trunk/knx_connector/DPT_Types.py Modified: PyWireGate/trunk/knx_connector/DPT_Types.py =================================================================== --- PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-04 20:05:11 UTC (rev 73) +++ PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-04 20:06:44 UTC (rev 74) @@ -269,6 +269,8 @@ ## M Minutes ## S Seconds weekday = (raw[0] & 0xe0) >> 5 + + ## Fixme: I18N weekdays = ["","Mo","Di","Mi","Do","Fr","Sa","So"] hour = raw[0] & 0x1f min = raw[1] & 0x3f @@ -278,8 +280,43 @@ return "%s %d:%d:%d" % (weekdays[weekday], hour,min,sec) def encodeDPT10(self,val): - pass - + ## checktype default unix timestamp + ## except standard timestring 20:15 or 20:15:34 or Mo 20:14:55 + weekday = 0 + hour = 0 + min = 0 + sec = 0 + if type(val) == str: + ## check for weekday + if val[0].isalpha(): + ## extract Weekday + day,val = val.split(" ",1) + ## Fixme: I18N + day = day.lower() + weekdays = ["","mo","di","mi","do","fr","sa","so"] + if weekday in weekdays: + weekday = weekdays.index(day) + + timeval = val.split(":") + if len(timeval) == 2: + hour = int(timeval[0]) + min = int(timeval[1]) + if len(timeval) == 3: + sec = int(timeval[2]) + elif type(val) in [float, int]: + now = time.localtime(val) + weekday = now[6] + hour = now[3] + min = now[4] + sec = now[5] + + else: + ## can't convert + return False + + weekday = weekday << 5 + return [weekday | hour , min, sec] + def decodeDPT11(self,raw): ## 3 byte Date ## RRRDDDDD RRRRMMMM RYYYYYYY @@ -297,7 +334,36 @@ return "%02d.%02d.%04d" % (day,mon,year) def encodeDPT11(self,val): - pass + if type(val) in [float, int]: + tval = val + else: + tval =0 + ## make time struct accesible + utime = [v for v in time.localtime(tval)] + if type(val) == str: + datestr = val.split(".") + if len(datestr) == 2: + # day + utime[2] = val[0] + # month + utime[1] = val[1] + ##year + if val[2]<90: + utime[2] = 2000 + val[2] + elif val[2]<100: + utime = 1900 + val[2] + else: + utime = val[2] + + day = utime[2] + mon = utime[1] + year = utime[2] + if year < 2000: + year -= 1900 + else: + year -= 2000 + + return [ day & 0x1f, mon & 0xf, year & 0x7f ] def decodeDPT12(self,raw): return int(self.toBigInt(raw)) % 0xffffffff @@ -337,7 +403,9 @@ if char == 0: break res += chr(char) - return res + + ## Decode ISO 2 Unicode + return res.decode("iso-8859-15") def encodeDPT16(self,val): pass This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-04 20:05:18
|
Revision: 73 http://openautomation.svn.sourceforge.net/openautomation/?rev=73&view=rev Author: nilss1 Date: 2010-11-04 20:05:11 +0000 (Thu, 04 Nov 2010) Log Message: ----------- changed datastore.db to UTF-8 and Datastore to unicode Modified Paths: -------------- PyWireGate/trunk/DSupdate.py PyWireGate/trunk/datastore.py Modified: PyWireGate/trunk/DSupdate.py =================================================================== --- PyWireGate/trunk/DSupdate.py 2010-11-04 13:27:57 UTC (rev 72) +++ PyWireGate/trunk/DSupdate.py 2010-11-04 20:05:11 UTC (rev 73) @@ -1,6 +1,7 @@ import getopt import ConfigParser import sys +import codecs import datastore try: @@ -24,7 +25,7 @@ self.save() def readConfig(self,configfile): - cfile = open(configfile,"r") + cfile = codecs.open(configfile,"r") ## fix for missingsectionheaders while True: pos = cfile.tell() @@ -52,7 +53,7 @@ ga = self.readConfig(fname) for key in ga.keys(): id = "%s:%s" % (self.config['namespace'],key) - self.dataobjects[id] = datastore.dataObject(False,id,unicode(ga[key]['name'],errors='ignore')) + self.dataobjects[id] = datastore.dataObject(False,id,ga[key]['name'].decode('iso-8859-15')) self.dataobjects[id].config['dptid'] = ga[key]['dptsubid'] def OWFSloader(self,fname): @@ -61,7 +62,7 @@ id = "%s:%s_temperature" % (self.config['namespace'],key) ## Fixme: Humidity ... not included print "add %s " % id - self.dataobjects[id] = datastore.dataObject(False,id,unicode(ow[key]['name'],errors='ignore')) + self.dataobjects[id] = datastore.dataObject(False,id,ow[key]['name'].decode('iso-8859-15')) if 'resolution' in ow[key]: self.dataobjects[id].config['resolution'] = ow[key]['resolution'] if 'eib_ga_temp' in ow[key]: @@ -78,7 +79,7 @@ def load(self): self.debug("load DATASTORE") try: - db = open(self.config['datastore'],"rb") + db = codecs.open(self.config['datastore'],"rb",encoding='utf-8') loaddict = json.load(db) db.close() for name, obj in loaddict.items(): @@ -106,7 +107,7 @@ 'config' : obj.config, 'connected' : obj.connected } - dbfile = open(self.config['datastore'],"wb") + dbfile = codecs.open(self.config['datastore'],"wb",encoding='utf-8') json.dump(savedict,dbfile,sort_keys=True,indent=3) dbfile.close() for i in savedict.keys(): Modified: PyWireGate/trunk/datastore.py =================================================================== --- PyWireGate/trunk/datastore.py 2010-11-04 13:27:57 UTC (rev 72) +++ PyWireGate/trunk/datastore.py 2010-11-04 20:05:11 UTC (rev 73) @@ -2,6 +2,8 @@ import time import threading +import codecs + try: ## use included json in > Python 2.6 import json @@ -89,7 +91,7 @@ def load(self): self.debug("load DATASTORE") try: - db = open(self.WG.config['WireGate']['datastore'],"rb") + db = codecs.open(self.WG.config['WireGate']['datastore'],"rb",encoding='utf-8') loaddict = json.load(db) db.close() for name, obj in loaddict.items(): @@ -127,8 +129,10 @@ 'config' : obj.config, 'connected' : obj.connected } - dbfile = open(self.WG.config['WireGate']['datastore'],"wb") - json.dump(savedict,dbfile,sort_keys=True,indent=3) + dbfile = codecs.open(self.WG.config['WireGate']['datastore'],"wb",encoding='utf-8') + utfdb = json.dumps(savedict,dbfile,ensure_ascii=False,sort_keys=True,indent=3) + dbfile.write(utfdb) + #json.dump(savedict,dbfile,sort_keys=True,indent=3) dbfile.close() @@ -168,12 +172,15 @@ if not name: ## Initial Name - self.name = "%s:unbekannt-%s" % (namespace, time.strftime("%Y-%m-%d_%H:%M:%S")) + self.name = u"%s:unbekannt-%s" % (namespace, time.strftime("%Y-%m-%d_%H:%M:%S")) else: self.name = name + if type(self.name) <> unicode: + ## guess that non unicode is iso8859 + self.name = name.decode("iso-8859-15") ## some defaults - self.value = "" + self.value = u"" self.lastupdate = 0 self.id = id This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-04 13:28:04
|
Revision: 72 http://openautomation.svn.sourceforge.net/openautomation/?rev=72&view=rev Author: nilss1 Date: 2010-11-04 13:27:57 +0000 (Thu, 04 Nov 2010) Log Message: ----------- encoding of DPT and send to KNX Modified Paths: -------------- PyWireGate/trunk/knx_connector/DPT_Types.py PyWireGate/trunk/knx_connector/KNX_Connector.py Modified: PyWireGate/trunk/knx_connector/DPT_Types.py =================================================================== --- PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-04 10:54:37 UTC (rev 71) +++ PyWireGate/trunk/knx_connector/DPT_Types.py 2010-11-04 13:27:57 UTC (rev 72) @@ -20,6 +20,8 @@ ### Da die EIBConnection Lib den string nicht hexadezimal zurueckgibt, ### sondern als LIST mit den dezimalen Werten ist das decode hier ein bischen angepasst +import struct + class dpt_type: def __init__(self,WireGateInstance): self.WG = WireGateInstance @@ -43,6 +45,26 @@ 14:self.decodeDPT14, # EIS 9 / 4 byte float 16:self.decodeDPT16 # EIS 15 / 14 byte Text } + self.ENCODER = { + 1:self.encodeDPT1, # EIS 1/7 / 1 bit 0=Aus/1=Ein + 2:self.encodeDPT2, # EIS 8 / 2 bit 0,1=Frei/2=Prio_Aus/3=Prio_Ein + 3:self.encodeDPT3, # EIS 2 / 4 bit + 4:self.encodeDPT4, # EIS 13 / 1 byte 1 Zeichen + 5:self.encodeDPT5, # EIS 6/14.001 / 1 byte 0...255 5.001 + 5.001:self.encodeDPT501, # PDT_SCALING + 5.005:self.encodeDPT5, # DPT_DecimalFactor + 5.010:self.encodeDPT5, # DPT_Value_1_Ucount + 6:self.encodeDPT6, # EIS 14.000 / 1 byte -128 ... 127 + 7:self.encodeDPT7, # EIS 10.000 / 2 byte 0....65535 + 8:self.encodeDPT8, # EIS 10.001 / 2 byte -32768 .... 32767 + 9:self.encodeDPT9, # EIS 5 / 2 byte Float + 10:self.encodeDPT10, # EIS 3 / 3 byte WoTag/Stunde/Minute/Sekunde + 11:self.encodeDPT11, # EIS 4 / 3 byte Tag/Monat/Jahr + 12:self.encodeDPT12, # EIS 11.000 / 4 byte unsigned [0...4.294.967.295] + 13:self.encodeDPT13, # EIS 11.001 / 4 byte signed -2.147.483.648 ... 2.147.483.647] + 14:self.encodeDPT14, # EIS 9 / 4 byte float + 16:self.encodeDPT16 # EIS 15 / 14 byte Text + } def decode(self,raw,dptid=0,dsobj=False): @@ -52,8 +74,8 @@ elif dsobj: if "dptid" in dsobj.config: dpt = dsobj.config['dptid'] - else: - return False + #else: + # return False if dpt == -1: dpt = self.guessType(raw) if dsobj: @@ -63,6 +85,18 @@ return raw return self._decode(raw,dpt) + def encode(self,msg,dptid=0,dsobj=False): + dpt=-1 + if dptid > 0: + dpt = dptid + elif dsobj: + if "dptid" in dsobj.config: + dpt = dsobj.config['dptid'] + else: + return False + return self._encode(msg,dpt) + + def _decode(self,raw,dpt): try: try: @@ -75,9 +109,22 @@ except: self.errormsg() return raw + + def _encode(self,msg,dpt): + try: + try: + return self.ENCODER[dpt](msg) + except KeyError: + try: + return self.ENCODER[int(dpt)](msg) + except KeyError: + return msg + except: + self.errormsg() + return msg def errormsg(self,msg=False): - self.WG.errormsg(msg) + self.WG.errorlog(msg) def debug(self,msg): self.log(msg,'debug') @@ -87,6 +134,18 @@ instance = "dpt-types" self.WG.log(msg,severity,instance) + def toByteArray(self,val,length): + ## Set ByteArray + ret = [0 for b in range(length)] + for val in struct.pack("L",val): + ## Fill up from end + length -= 1 + ## if struct larger then len return + if length < 0: + return ret + ## write from end to start + ret[length] = ord(val) + return ret def toBigInt(self,raw): c=0 @@ -99,7 +158,10 @@ def decodeDPT1(self,raw): return int(raw[0]) & 0x1 - + + def encodeDPT1(self,val): + pass + def decodeDPT2(self,raw): ## 2 Bit Control ## RRRRRRCS @@ -108,6 +170,9 @@ ## S Switch 0=off/1=on return int(raw[0]) & 0x3 + def encodeDPT2(self,val): + pass + def decodeDPT3(self,raw): ## 4 bit Dim (DPT 3.007) ## RRRRDSSS @@ -116,34 +181,55 @@ ## S Step (1-7) 0=Break ## FIXME: dont know what a Datastore should accept here return int(raw[0]) & 0xf + + def encodeDPT3(self,val): + pass def decodeDPT4(self,raw): ## 1 Byte Character return chr(raw[0] & 0xff) + def encodeDPT4(self,val): + pass + def decodeDPT5(self,raw): ## 1 Byte unsigned return (int(raw[0] & 0xff)) + def encodeDPT5(self,val): + pass + def decodeDPT501(self,raw): ## 1 Byte unsigned percent self.debug("DPT5.001 Scaling: value: %d" % raw[0]) return int(raw[0] & 0xff) * 100 / 255 + + def encodeDPT501(self,val): + pass def decodeDPT6(self,raw): ## 1 Byte signed val = int(raw[0] & 0xff) return (val > 127 and val - 256 or val) + + def encodeDPT6(self,val): + pass def decodeDPT7(self,raw): ## 2 byte unsigned return int(self.toBigInt(raw) & 0xffff) + + def encodeDPT7(self,val): + pass def decodeDPT8(self,raw): ## 2 Byte signed val = int(self.toBigInt(raw) & 0xffff) return (val > 32767 and val - 32768 or val) + def encodeDPT8(self,val): + pass + def decodeDPT9(self,raw): ## 2 Byte Float ## SEEEEMMM MMMMMMMM @@ -160,6 +246,19 @@ self.debug("DPT9: value: %d sign: %d exp: %d mant: %f" % (val, sign,exp,mant)) return (1 << exp) * 0.01 * mant + def encodeDPT9(self,val): + sign = 0 + exp = 0 + if val < 0: + sign = 0x8000 + mant = val * 100 + while mant > 2047: + mant = mant >> 1 + exp +=1 + data = sign | (exp << 11) | (int(mant) & 0x07ff) + ## change to 2Byte bytearray + return self.toByteArray(data,2) + def decodeDPT10(self,raw): ## 3 Byte Time @@ -177,6 +276,9 @@ ## Fixme: eigentlich sollte Zeit als Unix Timestamp gespeichert werden, was macht man mit dem Wochentag ## machs erstmal so wie makki return "%s %d:%d:%d" % (weekdays[weekday], hour,min,sec) + + def encodeDPT10(self,val): + pass def decodeDPT11(self,raw): ## 3 byte Date @@ -194,12 +296,22 @@ year += 1900 return "%02d.%02d.%04d" % (day,mon,year) + def encodeDPT11(self,val): + pass + def decodeDPT12(self,raw): return int(self.toBigInt(raw)) % 0xffffffff + + def encodeDPT12(self,val): + pass + def decodeDPT13(self,raw): val = int(self.toBigInt(raw)) % 0xffffffff return (val > 2147483647 and val - 2147483648 or val) + def encodeDPT13(self,val): + pass + def decodeDPT14(self,raw): ## 4 Byte Float ## SEEEEEEE EFFFFFFF FFFFFFFF FFFFFFFF @@ -215,6 +327,9 @@ self.debug("DPT14: value: %d sign: %d exp: %d mant: %f" % (val, sign,exp,mant)) return (1 << exp) * 0.01 * mant + def encodeDPT14(self,val): + pass + def decodeDPT16(self,raw): res = "" for char in raw: @@ -224,6 +339,9 @@ res += chr(char) return res + def encodeDPT16(self,val): + pass + def validTypes(self,datalen): ##TODO: ret = [] Modified: PyWireGate/trunk/knx_connector/KNX_Connector.py =================================================================== --- PyWireGate/trunk/knx_connector/KNX_Connector.py 2010-11-04 10:54:37 UTC (rev 71) +++ PyWireGate/trunk/knx_connector/KNX_Connector.py 2010-11-04 13:27:57 UTC (rev 72) @@ -18,11 +18,17 @@ from connector import Connector +import re import EIBConnection import select import BusMonitor import GroupSocket +import DPT_Types +KNXREADFLAG = 0x00 +KNXRESPONSEFLAG = 0x40 +KNXWRITEFLAG = 0x80 + class knx_connector(Connector): CONNECTOR_NAME = 'KNX Connector' CONNECTOR_VERSION = 0.2 @@ -37,7 +43,10 @@ self.KNXDst = EIBConnection.EIBAddr() self.busmon = BusMonitor.busmonitor(WireGateInstance,self) self.groupsocket = GroupSocket.groupsocket(WireGateInstance,self) + self.dpt = DPT_Types.dpt_type(WireGateInstance) + self.GrpAddrRegex = re.compile(r"(?:|(\d+)\x2F)(\d+)\x2F(\d+)$",re.MULTILINE) + ## Deafaultconfig defaultconfig = { 'url':'ip:127.0.0.1', @@ -115,6 +124,33 @@ self.busmon.decode(self.KNXBuffer.buffer) + def str2grpaddr(self,addrstr): + grpaddr = self.GrpAddrRegex.findall(addrstr) + if not grpaddr: + return False + ## regex result 1 + grpaddr = grpaddr[0] + addr = 0 + ## if GROUP3 Addr + if grpaddr[0]: + addr = int(grpaddr[0]) << 11 + addr = addr | (int(grpaddr[1]) << 8) + addr = addr | int(grpaddr[2]) + return addr + - def send(self,dsobj): - print "SEND to %s" % dsobj.name \ No newline at end of file + def send(self,msg,dstaddr): + try: + addr = self.str2grpaddr(dstaddr) + if addr: + msg = [0,KNXWRITEFLAG] +msg + self.KNX.EIBSendGroup(addr,msg) + except: + self.errormsg("Failed send %r to %r" % (msg,dstaddr)) + + def setValue(self,dsobj,msg=False): + if not msg: + msg = dsobj.getValue() + self.debug("SEND %r to %s (%s)" % (msg,dsobj.name,dsobj.id)) + self.send(self.dpt.encode(msg,dsobj=dsobj),dsobj.id) + \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-04 10:54:43
|
Revision: 71 http://openautomation.svn.sourceforge.net/openautomation/?rev=71&view=rev Author: nilss1 Date: 2010-11-04 10:54:37 +0000 (Thu, 04 Nov 2010) Log Message: ----------- don't write the db if the datastore.db is corrupt (missing commata....) Modified Paths: -------------- PyWireGate/trunk/datastore.py Modified: PyWireGate/trunk/datastore.py =================================================================== --- PyWireGate/trunk/datastore.py 2010-11-04 08:12:36 UTC (rev 70) +++ PyWireGate/trunk/datastore.py 2010-11-04 10:54:37 UTC (rev 71) @@ -24,6 +24,7 @@ #################################################### self.WG = WireGateInstance self.log("DATASTORE starting up") + self.DBLOADED = False self.dataobjects = {} self.locked = threading.RLock() self.locked.acquire() @@ -98,6 +99,7 @@ self.dataobjects[name].connected = obj['connected'] self.debug("%d entries loaded in DATASTORE" % len(self.dataobjects)) self.locked.release() + self.DBLOADED = True except IOError: ## no DB File pass @@ -110,6 +112,9 @@ def save(self): self.debug("save DATASTORE") + if not self.DBLOADED: + self.debug("No valid config, not saving") + return False self.locked.acquire() savedict = {} ## FIXME: user create a __reduce__ method for the Datastoreitem object This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-04 08:12:42
|
Revision: 70 http://openautomation.svn.sourceforge.net/openautomation/?rev=70&view=rev Author: nilss1 Date: 2010-11-04 08:12:36 +0000 (Thu, 04 Nov 2010) Log Message: ----------- Add .db and .log to ignorelist Property Changed: ---------------- PyWireGate/trunk/ Property changes on: PyWireGate/trunk ___________________________________________________________________ Modified: svn:ignore - wiregated.pid + *.db *.log wiregated.pid This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-04 08:09:47
|
Revision: 69 http://openautomation.svn.sourceforge.net/openautomation/?rev=69&view=rev Author: nilss1 Date: 2010-11-04 08:09:41 +0000 (Thu, 04 Nov 2010) Log Message: ----------- remove UTF32 stuff Removed Paths: ------------- PyWireGate/trunk/simplejson/.___init__.py PyWireGate/trunk/simplejson/._decoder.py PyWireGate/trunk/simplejson/._scanner.py PyWireGate/trunk/simplejson/tests/.___init__.py PyWireGate/trunk/simplejson/tests/._test_dump.py PyWireGate/trunk/simplejson/tests/._test_errors.py PyWireGate/trunk/simplejson/tests/._test_fail.py Deleted: PyWireGate/trunk/simplejson/.___init__.py =================================================================== (Binary files differ) Deleted: PyWireGate/trunk/simplejson/._decoder.py =================================================================== (Binary files differ) Deleted: PyWireGate/trunk/simplejson/._scanner.py =================================================================== (Binary files differ) Deleted: PyWireGate/trunk/simplejson/tests/.___init__.py =================================================================== (Binary files differ) Deleted: PyWireGate/trunk/simplejson/tests/._test_dump.py =================================================================== (Binary files differ) Deleted: PyWireGate/trunk/simplejson/tests/._test_errors.py =================================================================== (Binary files differ) Deleted: PyWireGate/trunk/simplejson/tests/._test_fail.py =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-04 08:05:42
|
Revision: 68 http://openautomation.svn.sourceforge.net/openautomation/?rev=68&view=rev Author: nilss1 Date: 2010-11-04 08:05:36 +0000 (Thu, 04 Nov 2010) Log Message: ----------- cleanup, removed pickle and XML Modified Paths: -------------- PyWireGate/trunk/DSupdate.py Modified: PyWireGate/trunk/DSupdate.py =================================================================== --- PyWireGate/trunk/DSupdate.py 2010-11-04 08:01:58 UTC (rev 67) +++ PyWireGate/trunk/DSupdate.py 2010-11-04 08:05:36 UTC (rev 68) @@ -1,20 +1,16 @@ import getopt import ConfigParser -try: - import cPickle as pickle -except ImportError: - import pickle +import sys +import datastore try: + ## try Python 2.6 json lib import json except ImportError: import simplejson as json -import datastore -import sys - class dbloader: def __init__(self,config,fname): self.config = config @@ -63,6 +59,7 @@ ow = self.readConfig(fname) for key in ow.keys(): id = "%s:%s_temperature" % (self.config['namespace'],key) + ## Fixme: Humidity ... not included print "add %s " % id self.dataobjects[id] = datastore.dataObject(False,id,unicode(ow[key]['name'],errors='ignore')) if 'resolution' in ow[key]: @@ -72,18 +69,16 @@ knxid = "KNX:%s" % ow[key]['eib_ga_temp'] print "Try to attach to %s " % knxid self.dataobjects[id].connected.append(knxid) - print "attaached" + print "attached" def debug(self,msg=''): print msg def load(self): - ## TODO: self.debug("load DATASTORE") try: db = open(self.config['datastore'],"rb") - #loaddict = pickle.Unpickler(db).load() loaddict = json.load(db) db.close() for name, obj in loaddict.items(): @@ -95,13 +90,10 @@ except: ## no DB File print "DB not found" - pass - ## Fixme: should belong to conncetor def save(self): - ## TODO: self.debug("save DATASTORE") savedict = {} ## FIXME: user create a __reduce__ method for the Datastoreitem object @@ -115,8 +107,6 @@ 'connected' : obj.connected } dbfile = open(self.config['datastore'],"wb") - #db = pickle.Pickler(dbfile,-1) - #db.dump(savedict) json.dump(savedict,dbfile,sort_keys=True,indent=3) dbfile.close() for i in savedict.keys(): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ni...@us...> - 2010-11-04 08:02:04
|
Revision: 67 http://openautomation.svn.sourceforge.net/openautomation/?rev=67&view=rev Author: nilss1 Date: 2010-11-04 08:01:58 +0000 (Thu, 04 Nov 2010) Log Message: ----------- cleanup, removed pickle and XML in favor of json Modified Paths: -------------- PyWireGate/trunk/datastore.py Modified: PyWireGate/trunk/datastore.py =================================================================== --- PyWireGate/trunk/datastore.py 2010-11-04 07:49:34 UTC (rev 66) +++ PyWireGate/trunk/datastore.py 2010-11-04 08:01:58 UTC (rev 67) @@ -1,3 +1,4 @@ +import sys import time import threading @@ -2,13 +3,7 @@ try: - import cPickle as pickle -except ImportError: - import pickle - -try: + ## use included json in > Python 2.6 import json except ImportError: import simplejson as json -import sys -import xml.dom.minidom @@ -32,8 +27,7 @@ self.dataobjects = {} self.locked = threading.RLock() self.locked.acquire() - self.xmltag = lambda x,y,z='': len(z)>0 and "<%s %s>%s</%s>" % (x,z,y,x) or "<%s>%s</%s>" % (x,y,x) - ## Load XML Database + ## Load JSON Database self.load() @@ -91,23 +85,10 @@ return self.dataobjects[id] - ## FIXME: that should belong to the Connector - def readgaconf(self): - print "SHOULD NOT BE CALLED" - ga = self.WG.readConfig("/etc/wiregate/eibga.conf") - for key in ga.keys(): - obj = self.get("KNX:%s" % key) - obj.config['dptid'] = ga[key]['dptsubid'] - obj.name = ga[key]['name'] - obj._send = self.WG.connectors['KNX'].send - - def load(self): - ## TODO: self.debug("load DATASTORE") try: db = open(self.WG.config['WireGate']['datastore'],"rb") - #loaddict = pickle.Unpickler(db).load() loaddict = json.load(db) db.close() for name, obj in loaddict.items(): @@ -120,17 +101,14 @@ except IOError: ## no DB File pass - ## Fixme: should belong to conncetor - self.locked.release() - self.readgaconf() except: + self.WG.errorlog() ## error pass def save(self): - ## TODO: self.debug("save DATASTORE") self.locked.acquire() savedict = {} @@ -145,31 +123,11 @@ 'connected' : obj.connected } dbfile = open(self.WG.config['WireGate']['datastore'],"wb") - #db = pickle.Pickler(dbfile,-1) - #db.dump(savedict) json.dump(savedict,dbfile,sort_keys=True,indent=3) dbfile.close() - def savetoXML(self): - objitemxml = "" - for name,obj in self.dataobjects.items(): - configxml = "" - for cname,cval in obj.config.items(): - configxml += self.xmltag(cname,cval) - objitemxml += self.xmltag( - "DSitem", - self.xmltag("id",name) + - self.xmltag("value",obj.getValue(),'type=%r' % type(obj.value).__name__) + - self.xmltag("config",configxml) - ) - self.locked.release() - xmlout = xml.dom.minidom.parseString(self.xmltag("Datastore",objitemxml)) - #xmlout = xmlout.toprettyxml(indent=" ") - xmlout = xmlout.toxml() - ## write binary to preserve UTF8 - open(self.WG.config['WireGate']['datastore'],"wb").write(xmlout) - + def debug(self,msg): #################################################### ## Function: debug @@ -225,12 +183,10 @@ def _setValue(self,refered_self): ## self override - print "Ovveride now" + ## override with connector send function if self.namespace: self._setValue = self.WG.connectors[self.namespace].setValue self.WG.connectors[self.namespace].setValue(refered_self) - ## override with connector send function - pass def setValue(self,val,send=False): try: @@ -259,40 +215,3 @@ self.read_mutex.release() - -#import json - -def JSON2DataStore(text): - obj = {} - return obj - - -def DataStore2JSON(obj): - text = "" - return text - -class testtwo: - def __init__(self): - self.i=10 - def _send(self,val): - """Hallo""" - print str(dir(self)) +str(val+self.i) - -class testthree: - def __init__(self): - self.u=1 - def send(self,val): - """its me""" - print str(dir(self)) +str(self.u) - - - -if __name__ == "__main__": - two = testtwo() - two._send(20) - three = testthree() - two._send = three.send - two._send(20) - print two._send - print dir(two) - \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |