Example #1
0
    def onExit(self, event):
        print "debug1" 
        log.write('Exiting application')

        # let twisted reactor shut down first ...
        reactor.addSystemEventTrigger('after', 'shutdown', self.Close, True)
        reactor.stop()
Example #2
0
    def _getDeviceMapSuccess(self, devicemap, connector):
        log.write("TwistedBridge Connector(%s,%s) received devicemap: %s" % (connector.host, connector.port, devicemap))
        for devicetype, devicelist in devicemap.items():
            for device in devicelist:
                log.write("\tPosting WXEvent adding  '%s' (%s)" % (device, devicetype))

                event = self.eventregistry.createEvent("addDevice")
                event.devicetype = devicetype
                event.device = device
                PostEvent(self.wxbridge, event)
                self.devicetypemap[device] = devicetype
                self.deviceconnectormap[device] = connector
Example #3
0
    def __init__(self, parent, id, title):

        # baseclass constructor
        WXBridge.__init__( self, parent, id, title)

        # configure menu bar (also sets the local onExit callback)
        self.SetMenuBar( MenuBar(self) )
        self.CreateStatusBar()

        # notebook with one tab per device type, e.g., 'Cameras', 'Projectors'
        log.write('Creating TabbedNotebook')
        self.notebook = DeviceNotebook(self, -1, self)

        self.Layout()

        # super-duper important ....
        reactor.interleave(wx.CallAfter)
Example #4
0
 def onAbout(self, event):
     log.write("About dialog activated")
     d = wx.MessageDialog(self, MenuBar._about, "AGDeviceControl client %s" % version.version, wx.OK)
     d.ShowModal()
     log.write("About dialog closed")
     d.Destroy()
Example #5
0
 def _addConnectorFailure(self, failure, connector):
     log.write(
         "TwistedBridge Connector(%s,%d) failed to connect, redetectHeartbeat" % (connector.host, connector.port)
     )
     self.monitor.redetectHeartbeat(connector.host)
Example #6
0
    def _addConnectorSuccess(self, connector):
        log.write("TwistedBridge Connector(%s,%d) connected successfully" % (connector.host, connector.port))

        connector.notifyOnDisconnect(self._onConnectionDropped)
        connector.getDeviceMap(self._getDeviceMapSuccess)
Example #7
0
 def addConnector(self, host, port, passwd):
     """Attempt connection to Aggregator, notification via callback"""
     log.write("TwistedBridge attempting Connector(%s,%d)" % (host, port))
     connector = Connector(host, port)
     connector.connect(self._addConnectorSuccess, errback=self._addConnectorFailure, password=passwd)
Example #8
0
    def commandResult(self, event):
        log.write("WXBridge: %s.%s(%s) = %s" % (event.device, event.command, event.parameters, event.returnvalue))

        cb = self.callables[(event.device, event.command, event.parameters)].pop(0)
        if cb:
            cb(event.returnvalue)
Example #9
0
 def removeDevice(self, event):
     log.write("WXBridge.removeDevice: %s" % event.device)
     self.notebook.removeDevice(event.device, event.devicetype)
Example #10
0
 def addDevice(self, event):
     log.write("WXBridge.addDevice: %s %s" % (event.device, event.devicetype))
     self.notebook.addDevice(event.device, event.devicetype)