def __init__(self): QtGui.QMainWindow.__init__(self) Ui_MainWindow.__init__(self) self.setupUi(self) #just sets the theme of the UI, in this case cleanlooks QtGui.QApplication.setStyle(QtGui.QStyleFactory.create('cleanlooks')) #menu options self.actionExit.triggered.connect(self.closeApplication) self.actionSave.triggered.connect(self.saveOutput) #buttons #all other button actions are handled via the UI directly self.execute_btn.clicked.connect(self.decoderSelect) self.save_btn.clicked.connect(self.saveOutput) #turn on statusBar below self.statusBar = QStatusBar() self.setStatusBar(self.statusBar) self.updateStatus() #initially set the hash and length options to disabled, unless #if the proper function is chosen, then enable the options #there are two things here, both of which serve fine #one hides the entire group, the other disables it self.hash_options_group.hide() #self.hash_options_group.setEnabled(False) #this just deactivates, but doesn't hide self.length_group.hide() #if the user changes the combo box, run the function to #update the show/hide or enable/disabled status of the #hash options and/or length options self.func_select.currentIndexChanged.connect(self.enableOptions)
def __init__(self, default_status_msg=_('Welcome to') + ' ' + __appname__+' console', parent=None): QDialog.__init__(self, parent) self.restart_requested = False self.l = QVBoxLayout() self.setLayout(self.l) self.resize(800, 600) geom = dynamic.get('console_window_geometry', None) if geom is not None: self.restoreGeometry(geom) # Setup tool bar {{{ self.tool_bar = QToolBar(self) self.tool_bar.setToolButtonStyle(Qt.ToolButtonTextOnly) self.l.addWidget(self.tool_bar) # }}} # Setup status bar {{{ self.status_bar = QStatusBar(self) self.status_bar.defmsg = QLabel(__appname__ + _(' console ') + __version__) self.status_bar._font = QFont() self.status_bar._font.setBold(True) self.status_bar.defmsg.setFont(self.status_bar._font) self.status_bar.addWidget(self.status_bar.defmsg) # }}} self.console = Console(parent=self) self.console.running.connect(partial(self.status_bar.showMessage, _('Code is running'))) self.console.running_done.connect(self.status_bar.clearMessage) self.l.addWidget(self.console) self.l.addWidget(self.status_bar) self.setWindowTitle(__appname__ + ' console') self.setWindowIcon(QIcon(I('console.png'))) self.restart_action = QAction(_('Restart console'), self) self.restart_action.setShortcut(_('Ctrl+R')) self.addAction(self.restart_action) self.restart_action.triggered.connect(self.restart) self.console.context_menu.addAction(self.restart_action)