def buildUi(self): self.oneVariableFeedbackFormWidget = LOneVariableFeedbackFormWidget(self) self.conditionTableWidget = LConditionTableWidget(self) self.statusTextWidget = LStatusTextWidget(self) self.setLWidgets(self.getLWidgets(mode=Lt.AutoDiscoveryMode)) self.connect(self.oneVariableFeedbackFormWidget, SIGNAL("dataChanged()"), self.on_oneVariableFeedbackFormWidget_dataChanged) self.toolBox = QToolBox(self) self.toolBox.addItem(self.oneVariableFeedbackFormWidget,"OVF Form") self.toolBox.addItem(self.conditionTableWidget,"OVF Condition Table") self.toolBox.addItem(self.statusTextWidget,"OVF Status") self.toolBox.setCurrentIndex(0) layout = QVBoxLayout(self) layout.addWidget(self.toolBox) self.setLayout(layout)
class LOneVariableFeedbackComposite(LExecutableComposite): processStarted = pyqtSignal() processStopped = pyqtSignal() processPaused = pyqtSignal() processResumed = pyqtSignal() processFinished = pyqtSignal() dataChanged = pyqtSignal() # Used when description changes def __init__(self, parent=None): super(LOneVariableFeedbackComposite, self).__init__(parent) self.dataContainer = LMyDataContainer(self) self.actions = LMyActions(self.dataContainer, self) self.setName(COMPOSITE_NAME) self.buildUi() self.updateUi() @LInAndOut(DEBUG & COMPOSITES) def buildUi(self): self.oneVariableFeedbackFormWidget = LOneVariableFeedbackFormWidget(self) self.conditionTableWidget = LConditionTableWidget(self) self.statusTextWidget = LStatusTextWidget(self) self.setLWidgets(self.getLWidgets(mode=Lt.AutoDiscoveryMode)) self.connect(self.oneVariableFeedbackFormWidget, SIGNAL("dataChanged()"), self.on_oneVariableFeedbackFormWidget_dataChanged) self.toolBox = QToolBox(self) self.toolBox.addItem(self.oneVariableFeedbackFormWidget,"OVF Form") self.toolBox.addItem(self.conditionTableWidget,"OVF Condition Table") self.toolBox.addItem(self.statusTextWidget,"OVF 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(LOneVariableFeedbackComposite, self).updateUi() #---------------------------------------------------------------------- # Interface (geT) @LInAndOut(DEBUG & COMPOSITES) def getDescription(self): return self.oneVariableFeedbackFormWidget.getDescription() #---------------------------------------------------------------------- # Widget actions @LInAndOut(DEBUG & COMPOSITES) def on_oneVariableFeedbackFormWidget_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): ''' If killed through OS ''' debug(self, "[process %d] finished with exitCode %s" % (self.process.pid(), exitCode)) self.emit_processFinished()