コード例 #1
0
ファイル: gaitSensor.py プロジェクト: docmartini/gaitSensor
 def __init__(self):
     QObject.__init__(self)
     
     self.dataBuffer = SensorData()
     self.sensorReceiver = SensorReceiver(self.dataBuffer, DEFAULT_PORT)
     self.window = AppWindowImpl(self.dataBuffer)
     
     self.eventSetup()
     
     self.window.show()
コード例 #2
0
ファイル: gaitSensor.py プロジェクト: docmartini/gaitSensor
class Controller(QObject):
    
    dataBuffer=None
    sensorReceiver=None
    window=None
    
    def __init__(self):
        QObject.__init__(self)
        
        self.dataBuffer = SensorData()
        self.sensorReceiver = SensorReceiver(self.dataBuffer, DEFAULT_PORT)
        self.window = AppWindowImpl(self.dataBuffer)
        
        self.eventSetup()
        
        self.window.show()
    
    def eventSetup(self):
        # Open a listener
        self.connect(self.window.actionListen, 
                     QtCore.SIGNAL('triggered(bool)'),
                     self.listen)
        
        # Secondary packet/signal processing
        self.connect(self.sensorReceiver,
                     QtCore.SIGNAL('dataReceived()'),
                     self.received)
    
    @QtCore.pyqtSlot()
    def received(self):
        pass
    
    @QtCore.pyqtSlot('bool')  
    def listen(self, isActive):
        if (isActive):
            self.sensorReceiver.openSocket()
        else:
            self.sensorReceiver.closeSocket()