def __init__(self, title=_('Encodings'), parent=None, selected_encoding=locale.getpreferredencoding()): super(EncodingsMenu, self).__init__(parent) self.setTitle(title) self._group = QtWidgets.QActionGroup(self) self._edit_action = None self._current_encoding = '' self.current_encoding = selected_encoding
def terminalMenu(self): m = QtWidgets.QMenu(self) g = QtWidgets.QActionGroup(m) g.triggered.connect(lambda a: self.setPort(a.text())) for s in termWidget.serial_ports(): a = m.addAction(s) g.addAction(a) a.setCheckable(True) if g.actions(): g.actions()[0].setChecked(True) self.setPort(g.actions()[0].text()) return m
def setup_mnu_style(self, editor): """ setup the style menu for an editor tab """ menu = QtWidgets.QMenu('Styles', self.menuEdit) group = QtWidgets.QActionGroup(self) self.styles_group = group current_style = editor.syntax_highlighter.color_scheme.name group.triggered.connect(self.on_style_changed) for s in sorted(modes.PYGMENTS_STYLES): a = QtWidgets.QAction(menu) a.setText(s) a.setCheckable(True) if s == current_style: a.setChecked(True) group.addAction(a) menu.addAction(a) self.menuEdit.addMenu(menu)
def __init__(self, app): super().__init__(app) self._compilation_thread = None group = QtWidgets.QActionGroup(self.main_window) group.addAction(self.ui.actionProgram) group.addAction(self.ui.actionSubprogram) self.compile_buttons = [] self.run_buttons = [] self.create_bt_compile() self.ui.toolBarCode.insertWidget(self.ui.actionRun, self.compile_buttons[0]) group.triggered.connect(self._on_program_type_changed) self.ui.actionCompile.triggered.connect(self.compile) self.ui.errorsTable.msg_activated.connect(self._goto_error_msg) self.ui.actionRun.triggered.connect(self.run) self._run_requested = False self.ui.consoleOutput.process_finished.connect(self._on_run_finished) self.ui.actionCancel.triggered.connect(self.cancel)
def __init__(self): super(MainWindow, self).__init__() # Load our UI (made in Qt Designer) self.setupUi(self) self.tabWidget.register_code_edit(PyCodeEdit) self.dockWidget.hide() self.setup_recent_files_menu() self.setup_actions() self.setup_status_bar_widgets() self.on_current_tab_changed() self.intepreter_group = QtWidgets.QActionGroup( self.menuPython_interpreter) for interpreter in get_interpreters(): a = self.menuPython_interpreter.addAction(interpreter) a.setCheckable(True) a.setChecked(interpreter in Settings().interpreter) self.intepreter_group.addAction(a) self.intepreter_group.triggered.connect(self.on_interpreter_toggled) self.interactiveConsole.open_file_requested.connect(self.open_file) self.styles_group = None