def setupUi(self, *args): # called in MainWindowBase.__init__() # put the log widget at the bottom self.addDockWidget(Qt.BottomDockWidgetArea, self._setupLogWidget()) # file widget at the top self.toolbox = ToolBox(self) self._addToolboxItem(self._setupFileWidget()) self._addToolboxItem(self._setupDataWidget()) self._addToolboxItem(self._setupOptimWidget()) self._addToolboxItem(self._setupModelWidget()) self._addToolboxItem(self._setupStatsWidget()) # set up central widget of the main window self.centralLayout = QVBoxLayout() # put buttons in central widget self.centralLayout.addWidget(self.toolbox) self.centralLayout.addWidget(self._setupStartButton()) centralWidget = QWidget(self) centralWidget.setLayout(self.centralLayout) centralWidget.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum) self.setCentralWidget(centralWidget) self.onStartupSignal.connect(self.initUi) # set program icon, same for Win+Lin icopath = "resources/icon/mcsas.ico" if isMac(): icopath = "resources/icon/mcsas.icns" icopath = QFileInfo(makeAbsolutePath(icopath)).absoluteFilePath() self.setWindowIcon(QIcon(icopath))
def _setupStartButton(self): """Set up "Start/Stop" - button.""" self.startStopBtn = QPushButton() self.startStopBtn.setCheckable(True) self.startStopBtn.clicked[bool].connect(self.onStartStopClick) btnLayout = QHBoxLayout() btnLayout.setContentsMargins(0, 0, 0, 0) self.startStopBtn.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) btnLayout.addWidget(self.startStopBtn) btnWidget = QWidget(self) btnWidget.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum) btnWidget.setLayout(btnLayout) return btnWidget