def __init__(self, parent=None): super(LFeedbackApplication, self).__init__(parent) self.dataContainer = LMyDataContainer(self) self.actions = LMyActions(self.dataContainer, self) self.buildUi() self.updateUi()
class LFeedbackApplication(LApplication): def __init__(self, parent=None): super(LFeedbackApplication, self).__init__(parent) self.dataContainer = LMyDataContainer(self) self.actions = LMyActions(self.dataContainer, self) self.buildUi() self.updateUi() @LInAndOut(DEBUG & APPLICATIONS) def buildUi(self): self.setStyleSheet(styleSheet) self.tabWidget = QTabWidget() self.setCentralWidget(self.tabWidget) statusBar = self.statusBar() statusBar.setSizeGripEnabled(False) statusBar.showMessage("Ready", 5000) self.setMenuBar(self.actions.getMenuBar()) @LInAndOut(DEBUG & APPLICATIONS) def updateUi(self): """ Beware order is important """ self.updateTabWidget() @LInAndOut(DEBUG & APPLICATIONS) def updateMenuBar(self): self.setMenuBar(self.actions.getMenuBar()) @LInAndOut(DEBUG & APPLICATIONS) def updateTabWidget(self): self.updateTabContent() self.updateTabBar() @LInAndOut(DEBUG & APPLICATIONS) def updateTabContent(self): self.tabWidget.clear() for feedback in self.dataContainer.feedbacks: composite = feedback.getComposite() self.tabWidget.addTab(composite, "No Description") composite.dataChanged.connect(self.updateTabBar) composite.processStarted.connect(self.updateTabBar) composite.processFinished.connect(self.updateTabBar) composite.processResumed.connect(self.updateTabBar) composite.processPaused.connect(self.updateTabBar) @LInAndOut(DEBUG & APPLICATIONS) def updateTabBar(self): """ Update all the tabs at once! """ for index in range(self.tabWidget.count()): composite = self.tabWidget.widget(index) if composite.getState() == QProcess.NotRunning: icon = QIcon(":/qrc/images/process-stop.png") else: icon = QIcon(":/qrc/images/process-start.png") self.tabWidget.setTabIcon(index, icon) description = composite.getDescription() debug(self, "description %s" % description, 5) self.tabWidget.setTabText(index, description) # ---------------------------------------------------------------------- # Interface (set) @LInAndOut(DEBUG & APPLICATIONS) def setOptions(self, options): super(LFeedbackApplication, self).setOptions(options) for feedbackCsv in options.feedbacks: self.dataContainer.feedbacks.append(LMyItem().fromCsv(feedbackCsv))