def buildUi(self): self.xVariableFeedbackFormWidget = LXVariableFeedbackFormWidget(self) self.conditionTableWidget = LConditionTableWidget(self) self.statusTextWidget = LStatusTextWidget(self) self.setLWidgets(self.getLWidgets(mode=Lt.AutoDiscoveryMode)) for widget in self.getLWidgets(): debug(self, "LWidget includes %s/%s/%s" % (widget.getName(), widget.getClassName(), widget.getVersion()),4) self.connect(self.xVariableFeedbackFormWidget, SIGNAL("dataChanged()"), self.on_xVariableFeedbackFormWidget_dataChanged) self.toolBox = QToolBox(self) self.toolBox.addItem(self.xVariableFeedbackFormWidget,"XVF Form") self.toolBox.addItem(self.conditionTableWidget,"XVF Condition Table") self.toolBox.addItem(self.statusTextWidget,"XVF Status") self.toolBox.setCurrentIndex(0) layout = QVBoxLayout(self) layout.addWidget(self.toolBox) self.setLayout(layout)
class LXVariableFeedbackComposite(LExecutableComposite): processStarted = pyqtSignal() processPaused = pyqtSignal() processResumed = pyqtSignal() processFinished = pyqtSignal() dataChanged = pyqtSignal() def __init__(self, parent=None): super(LXVariableFeedbackComposite, self).__init__(parent) self.dataContainer = LMyDataContainer(self) self.actions = LMyActions(self.dataContainer, self) self.buildUi() self.updateUi() self.setDebugLevel(DEBUG_LEVEL) @LInAndOut(DEBUG & COMPOSITES) def buildUi(self): self.xVariableFeedbackFormWidget = LXVariableFeedbackFormWidget(self) self.conditionTableWidget = LConditionTableWidget(self) self.statusTextWidget = LStatusTextWidget(self) self.setLWidgets(self.getLWidgets(mode=Lt.AutoDiscoveryMode)) for widget in self.getLWidgets(): debug(self, "LWidget includes %s/%s/%s" % (widget.getName(), widget.getClassName(), widget.getVersion()),4) self.connect(self.xVariableFeedbackFormWidget, SIGNAL("dataChanged()"), self.on_xVariableFeedbackFormWidget_dataChanged) self.toolBox = QToolBox(self) self.toolBox.addItem(self.xVariableFeedbackFormWidget,"XVF Form") self.toolBox.addItem(self.conditionTableWidget,"XVF Condition Table") self.toolBox.addItem(self.statusTextWidget,"XVF Status") self.toolBox.setCurrentIndex(0) layout = QVBoxLayout(self) layout.addWidget(self.toolBox) self.setLayout(layout) @LInAndOut(DEBUG & COMPOSITES) def updateUi(self): ''' Updates displayed values with object attributes ''' super(LXVariableFeedbackComposite, self).updateUi() #---------------------------------------------------------------------- # Interface (get) @LInAndOut(DEBUG & COMPOSITES) def getDescription(self): return self.xVariableFeedbackFormWidget.getDescription() #---------------------------------------------------------------------- # Widget actions @LInAndOut(DEBUG & COMPOSITES) def on_xVariableFeedbackFormWidget_dataChanged(self): self.dataContainer.menuTitle = self.getDescription() self.emit_dataChanged() @LInAndOut(DEBUG & COMPOSITES) def on_process_readyReadStandardOutput(self): byteArray = self.process.readAllStandardOutput() stdout_message = "%s" % QString(byteArray) message = stdout_message.strip('\n') if len(message) > 0 : debug(self, "%s" % message) self.statusTextWidget.append("%s" % message) @LInAndOut(DEBUG & COMPOSITES) def on_process_readyReadStandardError(self): byteArray = self.process.readAllStandardError() stderr_message = "%s" % QString(byteArray) # <-- QByteArray to ... message = stderr_message.strip('\n') if len(message) > 0 : debug(self, "%s" % message) self.statusTextWidget.append("%s" % message) @LInAndOut(DEBUG & WIDGETS_) def on_process_started(self): self.statusTextWidget.clear() commandLine = self.getCommandLine() message = "[process %d] %s" % (self.process.pid(), commandLine) debug(self, message) self.statusTextWidget.append("%s" % message) self.toolBox.setCurrentIndex(2) self.emit_processStarted() @LInAndOut(DEBUG & COMPOSITES) def on_process_finished(self, exitCode, exitStatus = 0): ''' If killed throught the OS ''' debug(self, "[process %d] finished with exitCode %s, exitStatus %s" % (self.process.pid(), exitCode, exitStatus)) self.emit_processFinished()