def __init__(self, widget): QMainWindow.__init__(self) # self.setWindowTitle(self.tr('KidsMath')) self.widget = widget # Menu self.menu = QMenuBar() self.font_menu = self.menu.addMenu(self.tr('Tools')) # pass status bar to Test Tab self.widget.test_widget.status_bar = self.statusBar() # QAction font_action = QAction(self.tr('Font'), self) font_action.setShortcut('Ctrl+F') font_action.triggered.connect(self.font_app) self.font_menu.addAction(font_action) # Shortcuts start_shortcut = QShortcut(QKeySequence('Ctrl+S'), self) start_shortcut.activated.connect(self.start_app) stop_shortcut = QShortcut(QKeySequence('Ctrl+T'), self) stop_shortcut.activated.connect(self.stop_app) next_shortcut = QShortcut(QKeySequence('Ctrl+N'), self) next_shortcut.activated.connect(self.next_app) option_shortcut = QShortcut(QKeySequence('Ctrl+O'), self) option_shortcut.activated.connect(self.option_app) math_shortcut = QShortcut(QKeySequence('Ctrl+M'), self) math_shortcut.activated.connect(self.math_app) self.setCentralWidget(self.widget)
def __init__(self, configurationManager: ConfigurationManager): super(ToolBar, self).__init__() self.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) self.configurationManager = configurationManager self.setStyleSheet( "background-color: #2D2D30; color: white; font-weight: 500") self.setMovable(False) self.setWindowTitle("Toolbar") self.compile = QAction( QIcon(main.resource_path("resources/compile.png")), "Compile", self) self.compile.setShortcut(QKeySequence("Ctrl+Shift+B")) self.debug = QAction(QIcon(main.resource_path("resources/debug.png")), "Debug", self) self.debug.setShortcut(QKeySequence("Ctrl+F5")) self.run = QAction(QIcon(main.resource_path("resources/run.png")), "Run", self) self.label = QLabel("Select current project") self.label.setStyleSheet("padding-left: 5px;") icon = QIcon(main.resource_path("resources/current_folder.png")) self.currentIcon = QLabel() self.currentIcon.setPixmap(icon.pixmap(QSize(20, 20))) self.projectComboBox = ProjectComboBox(self.configurationManager) self.projectComboBox.setMinimumWidth(250) self.run.setShortcut(QKeySequence("F5")) self.addAction(self.compile) self.addAction(self.debug) self.addAction(self.run) self.addSeparator() self.addWidget(self.currentIcon) self.addWidget(self.label) self.addWidget(self.projectComboBox)
def _init_menus(self): menu = self.menuBar() file_menu = menu.addMenu('&File') input_file_action = QAction("Select Input File", self) input_file_action.triggered.connect(self._set_input_file) input_file_action.setShortcut(QKeySequence.Open) output_folder_action = QAction("Select Output Folder", self) output_folder_action.triggered.connect(self._set_output_folder) output_folder_action.setShortcut(QKeySequence("Ctrl+Shift+O")) reload_contest_action = QAction("Reload Contest Details", self) reload_contest_action.triggered.connect(self._reload_contest) reload_contest_action.setShortcut(QKeySequence("Ctrl+R")) file_menu.addAction(input_file_action) file_menu.addAction(output_folder_action) file_menu.addAction(reload_contest_action) help_menu = self.menuBar().addMenu("&Help") about_action = QAction("&About", self) about_action.triggered.connect(self._show_about_dialog) help_menu.addAction(about_action)
def add_commands(plugin): DbgAction = namedtuple('DbgAction', 'name, key_seq, handler') plugin_actions = (DbgAction("SyncEnable", QKeySequence(Qt.ALT + Qt.Key_S), UIAction(plugin.cmd_sync)), DbgAction("SyncDisable", QKeySequence(Qt.ALT + Qt.SHIFT + Qt.Key_S), UIAction(plugin.cmd_syncoff)), DbgAction("SyncGo", QKeySequence(Qt.ALT + Qt.Key_F5), UIAction(plugin.cmd_go)), DbgAction("SyncStepOver", QKeySequence(Qt.Key_F10), UIAction(plugin.cmd_so)), DbgAction("SyncStepInto", QKeySequence(Qt.Key_F11), UIAction(plugin.cmd_si)), DbgAction("SyncTranslate", QKeySequence(Qt.ALT + Qt.Key_F2), UIAction(plugin.cmd_translate)), DbgAction("SyncBp", QKeySequence(Qt.Key_F2), UIAction(plugin.cmd_bp)), DbgAction("SyncHwBp", QKeySequence(Qt.CTRL + Qt.Key_F2), UIAction(plugin.cmd_hwbp)), DbgAction("SyncBpOneShot", QKeySequence(Qt.ALT + Qt.Key_F3), UIAction(plugin.cmd_bp1)), DbgAction("SyncHwBpOneShot", QKeySequence(Qt.CTRL + Qt.Key_F3), UIAction(plugin.cmd_hwbp1))) for action in plugin_actions: UIAction.registerAction(action.name, action.key_seq) UIActionHandler.globalActions().bindAction(action.name, action.handler) rs_log('commands added')
def __init__(self, core): """Constructor""" self.parent_frame = core.main self.core = core self.parent_frame.pushButton_stop_preview.hide() shortcut_docs = QShortcut(QKeySequence('F5'), self.parent_frame) shortcut_docs.activated.connect(self.start_preview) shortcut_docs = QShortcut(QKeySequence('Ctrl+F5'), self.parent_frame) shortcut_docs.activated.connect(self.stop_preview) shortcut_docs = QShortcut(QKeySequence('Ctrl+S'), self.parent_frame) shortcut_docs.activated.connect(self.save_all_files) self.log_timer = QTimer() self.log_timer.timeout.connect(self.update_log) self.log_timer.setInterval(10) self.timer_autosave = QTimer() self.timer_autosave.timeout.connect(self.save_all_files) self.timer_autosave.setInterval(5000) self.timer_autosave.start() self.connect() self.hide_preview() self.build_linenumber()
def setup_shortcuts(self): self.move_chapter_up_shortcut = QShortcut(QKeySequence("Ctrl+Up"), self.chapter_tab) self.move_chapter_up_shortcut.activated.connect( self.move_chapter_up_button.clicked_button) self.move_chapter_down_shortcut = QShortcut(QKeySequence("Ctrl+Down"), self.chapter_tab) self.move_chapter_down_shortcut.activated.connect( self.move_chapter_down_button.clicked_button) self.move_chapter_top_shortcut = QShortcut(QKeySequence("Ctrl+PgUp"), self.chapter_tab) self.move_chapter_top_shortcut.activated.connect( self.move_chapter_top_button.clicked_button) self.move_chapter_bottom_shortcut = QShortcut( QKeySequence("Ctrl+PgDown"), self.chapter_tab) self.move_chapter_bottom_shortcut.activated.connect( self.move_chapter_bottom_button.clicked_button) self.move_chapter_to_shortcut = QShortcut(QKeySequence("Ctrl+M"), self.chapter_tab) self.move_chapter_to_shortcut.activated.connect( self.move_chapter_to_button.clicked_button)
def _set_up_menus(self, MainWindow: QObject): self.menu_bar = QMenuBar() self.menu_bar.setGeometry(QRect(0, 0, 1280, 720)) self.file_menu = QMenu(self.menu_bar) MainWindow.setMenuBar(self.menu_bar) self.status_bar = QStatusBar(MainWindow) MainWindow.setStatusBar(self.status_bar) self.open_json_file_action = QAction(MainWindow) self.open_json_file_action.setShortcut(QKeySequence("Ctrl+O")) self.export_to_filewriter_JSON_action = QAction(MainWindow) self.export_to_filewriter_JSON_action.setShortcut(QKeySequence("Ctrl+S")) self.file_menu.addAction(self.open_json_file_action) self.file_menu.addAction(self.export_to_filewriter_JSON_action) self.view_menu = QMenu(self.menu_bar) self.show_action_labels = QAction(MainWindow) self.show_action_labels.setCheckable(True) self.show_action_labels.setChecked(True) self.simple_tree_view = QAction(MainWindow) self.simple_tree_view.setCheckable(True) self.about_window = QAction(MainWindow) self.view_menu.addAction(self.about_window) self.view_menu.addAction(self.show_action_labels) self.view_menu.addAction(self.simple_tree_view) self.menu_bar.addAction(self.file_menu.menuAction()) self.menu_bar.addAction(self.view_menu.menuAction()) self._set_up_titles(MainWindow)
def _init_shortcuts(self): """ Initialize shortcuts :return: None """ center_dockable_views = self.workspace.view_manager.get_center_views() for i in range(1, len(center_dockable_views) + 1): QShortcut(QKeySequence('Ctrl+' + str(i)), self, center_dockable_views[i - 1].raise_) QShortcut(QKeySequence("Ctrl+I"), self, self.interrupt_current_job) # Raise the DisassemblyView after everything has initialized center_dockable_views[0].raise_() # Toggle exec breakpoint QShortcut(QKeySequence(Qt.Key_F2), self, self.workspace.toggle_exec_breakpoint) # Single step QShortcut(QKeySequence(Qt.Key_F7), self, self.workspace.step_forward) # Run QShortcut(QKeySequence(Qt.Key_F9), self, self.workspace.continue_forward)
def controls(self): if QKeySequence(Qt.CTRL + Qt.Key_A): self.showAll() elif QKeySequence(Qt.CTRL + Qt.Key_B): self.showOne() elif QKeySequence(Qt.CTRL + Qt.Key_C): self.changeAttributes()
def __create_menu(self) -> None: menu_bar = self.menuBar() file_menu = menu_bar.addMenu("File") import_action = file_menu.addAction("Import Audio...") import_action.setShortcut(QKeySequence("Ctrl+I")) import_action.triggered.connect(self.__import_audio) open_file_action = file_menu.addAction("Open...") open_file_action.setShortcut(QKeySequence("Ctrl+O")) open_file_action.triggered.connect(self.__open_file) file_menu.addSeparator() save_action = file_menu.addAction("Save") save_action.setShortcut(QKeySequence("Ctrl+S")) save_action.triggered.connect(self.__save_current_file) save_as_action = file_menu.addAction("Save As...") save_as_action.setShortcut(QKeySequence("Ctrl+Shift+S")) save_as_action.triggered.connect(self.__save_current_file_as) file_menu.addSeparator() exit_action = file_menu.addAction("Exit") exit_action.setShortcut(QKeySequence("Alt+f4")) exit_action.triggered.connect(QCoreApplication.quit) help_menu = menu_bar.addMenu("Help") documentation_action = help_menu.addAction("Open Documentation...") documentation_action.triggered.connect( lambda: QDesktopServices.openUrl(libchapters.DOCUMENTATION)) help_menu.addSeparator() about_action = help_menu.addAction("About...") about_action.triggered.connect(self.__show_about_dialog)
def __init__(self, exp, parent): super(DataTable, self).__init__() self.parent = parent self.ui = Ui_DataTable() self.ui.setupUi(self) self.setWindowTitle('Data Table ({})'.format(exp.name)) self.exp = exp self.col_header = list(self.exp.df.columns) self.backend_writing = False self.populate_tabel(self.exp.df) # TODO: USE get_df self.ui.tb_DataFrame.cellChanged.connect(self.OnCellChanged) self.ui.tb_DataFrame.cellActivated.connect(self.OnCellSelected) self.ui.tb_DataFrame.horizontalHeader().setContextMenuPolicy( Qt.CustomContextMenu) self.ui.tb_DataFrame.horizontalHeader( ).customContextMenuRequested.connect(self.hoizontalMenu) self.shortcut_copy = QShortcut(QKeySequence('Ctrl+C'), self) self.shortcut_copy.activated.connect(self.OnCopy) self.shortcut_paste = QShortcut(QKeySequence('Ctrl+V'), self) self.shortcut_paste.activated.connect(self.OnPaste) stylesheet = "::section{border-radius:14px;}" self.ui.tb_DataFrame.horizontalHeader().setStyleSheet(stylesheet) self.ui.tb_DataFrame.verticalHeader().setStyleSheet(stylesheet) self.signals = PlotSignal( ) # Signal to tell main GUI to update figures.
def __init__(self): super().__init__() self.chapter_data = None self.dispos_model = None self.dispos = None self.terrain = None self.tiles_model = None self.terrain_mode = False self.initialized_selection_signal = False self.selected_faction = None left_panel_container = QWidget() left_panel_layout = QVBoxLayout() self.toggle_editor_type_checkbox = QCheckBox() self.toggle_editor_type_checkbox.setText("Spawns/Terrain") self.toggle_editor_type_checkbox.setChecked(True) self.toggle_editor_type_checkbox.stateChanged.connect( self._on_mode_change_requested) self.toggle_coordinate_type_checkbox = QCheckBox() self.toggle_coordinate_type_checkbox.setText( "Coordinate (1)/Coordinate (2)") self.toggle_coordinate_type_checkbox.setChecked(True) self.toggle_coordinate_type_checkbox.stateChanged.connect( self._on_coordinate_change_requested) self.tree_view = QTreeView() left_panel_layout.addWidget(self.toggle_editor_type_checkbox) left_panel_layout.addWidget(self.toggle_coordinate_type_checkbox) left_panel_layout.addWidget(self.tree_view) left_panel_container.setLayout(left_panel_layout) self.grid = FE14MapGrid() self.dispos_scroll, self.dispos_form = PropertyForm.create_with_scroll( dispo.SPAWN_TEMPLATE) self.terrain_form, self.terrain_persistent_editors, self.tile_form = _create_terrain_form( ) self.organizer = QSplitter() self.organizer.addWidget(left_panel_container) self.organizer.addWidget(self.grid) self.organizer.addWidget(self.dispos_scroll) main_layout = QVBoxLayout(self) main_layout.addWidget(self.organizer) self.setLayout(main_layout) self.add_faction_shortcut = QShortcut(QKeySequence("Ctrl+F"), self) self.add_item_shortcut = QShortcut(QKeySequence("Ctrl+N"), self) self.grid.focused_spawn_changed.connect(self._on_focused_spawn_changed) self.add_faction_shortcut.activated.connect( self._on_add_faction_requested) self.add_item_shortcut.activated.connect(self._on_add_item_requested) self.dispos_form.editors["PID"].editingFinished.connect( self._on_pid_field_changed) self.dispos_form.editors["Team"].currentIndexChanged.connect( self._on_team_field_changed) self.dispos_form.editors["Coordinate (1)"].textChanged.connect( self._on_coordinate_1_field_changed) self.dispos_form.editors["Coordinate (2)"].textChanged.connect( self._on_coordinate_2_field_changed)
def test_shortcuts(): shortcuts = Shortcuts() assert shortcuts["new"] == shortcuts[0] assert shortcuts["new"] == QKeySequence.fromString("Ctrl+N") shortcuts["new"] = QKeySequence.fromString("Ctrl+Shift+N") assert shortcuts["new"] == QKeySequence.fromString("Ctrl+Shift+N") assert list(shortcuts[0:2].keys()) == ["new", "open"]
def event(self, event): if event.type() == QEvent.Shortcut: # 复制粘贴的快捷键设置 if event.key() == QKeySequence("ctrl+c"): self.copy() if event.key() == QKeySequence("ctrl+v"): self.paste() return super().event(event) # 必须用return
def invert_table_key(tab_key): if len(tab_key) == 1: return QKeySequence(tab_key) if tab_key in (KeyShortcuts.MOUSE_RIGHT[2], KeyShortcuts.MOUSE_LEFT[2]): return tab_key for modifier in ('Ctrl', 'Shift', 'Alt'): if modifier in tab_key: return QKeySequence(tab_key) return [QKeySequence(minor_key) for minor_key in tab_key]
def __init__(self, starList, imageData, width): QMainWindow.__init__(self) self.starData = starList self.idx = -1 self.imageData = imageData self.plotWidth = width # the layout of this will be as follows: There will be an image of the star # shown, with it's data on the left side. Below that will be two buttons: # yes and no vBoxMain = QVBoxLayout() # The first thing will be the data and image, which are laid out horizontally hBoxImageData = QHBoxLayout() self.image = QLabel() self.starDataText = QLabel("Image data here\nAttr 1\nAttr2") hBoxImageData.addWidget(self.image) hBoxImageData.addWidget(self.starDataText) hBoxImageData.setAlignment(Qt.AlignTop) vBoxMain.addLayout(hBoxImageData) # then the buttons at the bottom, which will also be laid our horizontally hBoxInput = QHBoxLayout() self.acceptButton = QPushButton("Accept") self.rejectButton = QPushButton("Reject") self.exitButton = QPushButton("Done Selecting Stars") # set the tasks that each button will do self.acceptButton.clicked.connect(self.accept) self.rejectButton.clicked.connect(self.reject) self.exitButton.clicked.connect(self.exit) # and make keyboard shortcuts acceptShortcut = QShortcut(QKeySequence("right"), self.acceptButton) rejectShortcut = QShortcut(QKeySequence("left"), self.rejectButton) exitShortcut = QShortcut(QKeySequence("d"), self.exitButton) acceptShortcut.activated.connect(self.accept) rejectShortcut.activated.connect(self.reject) exitShortcut.activated.connect(self.exit) hBoxInput.addWidget(self.rejectButton) hBoxInput.addWidget(self.acceptButton) hBoxInput.addWidget(self.exitButton) vBoxMain.addLayout(hBoxInput) # have to set a dummy widget to act as the central widget container = QWidget() container.setLayout(vBoxMain) self.setCentralWidget(container) # self.resize(1000, 1000) # add the first star self.nextStar() # then we can show the widget self.show()
def set_keyboard_shortcuts(self): """Creates keyboard shortcuts for the 'Root', 'Home', etc. buttons.""" self.go_root_action.setShortcut(QKeySequence(Qt.Key_F1)) self.addAction(self.go_root_action) self.go_home_action.setShortcut(QKeySequence(Qt.Key_F2)) self.addAction(self.go_home_action) self.go_documents_action.setShortcut(QKeySequence(Qt.Key_F3)) self.addAction(self.go_documents_action) self.go_desktop_action.setShortcut(QKeySequence(Qt.Key_F4)) self.addAction(self.go_desktop_action)
def __init__(self, main_window): super().__init__("&Analyze", parent=main_window) self.entries.extend([ MenuEntry('&Decompile', main_window.decompile_current_function, shortcut=QKeySequence(Qt.Key_F5)), MenuEntry('&Interact', main_window.interact, shortcut=QKeySequence(Qt.Key_F6)), ])
def __init__(self, pos_app): """ :param modules.main_app.SchnuffiApp pos_app: """ super(SchnuffiWindow, self).__init__() self.pos_app = pos_app LOGGER.setLevel(logging.ERROR) SetupWidget.from_ui_file(self, Resource.ui_paths.get(UI_MAIN_WINDOW)) LOGGER.setLevel(logging.DEBUG) self.file_win = None # -- Comparision thread -- self.cmp_thread = QtCore.QThread(self) self.cmp_queue = Queue(-1) # -- Timer -- self.intro_timer = QtCore.QTimer() self.intro_timer.setSingleShot(True) self.intro_timer.setInterval(500) # -- Add item worker -- self.item_worker = QtCore.QTimer() self.item_worker.setInterval(15) self.remaining_items = 0 self.item_chunk_size = 35 self.export = ExportActionList(self, self) self.info_overlay = InfoOverlay(self) self.undo_grp = QUndoGroup(self) self.widget_list = [self.AddedWidget, self.ModifiedWidget, self.RemovedWidget, self.switchesWidget, self.looksWidget, self.posOldWidget, self.posNewWidget] self.setup_widgets() # --- Create undo menu --- self.undo_menu = QMenu(_('Undo'), self) # Create undo/redo actions from undo_grp self.redo = self.undo_grp.createRedoAction(self, _('Wiederherstellen')) self.redo.setShortcut(QKeySequence('Ctrl+Y')) self.undo = self.undo_grp.createUndoAction(self, _('Rückgängig')) self.undo.setShortcut(QKeySequence('Ctrl+Z')) # add menu self.undo_menu.addActions((self.undo, self.redo)) self.menuBar().addMenu(self.undo_menu) self.non_exportable_widgets = (self.switchesWidget, self.looksWidget, self.errorTextWidget, self.AddedWidget, self.RemovedWidget) self.show()
def set_context_menu(self): stmenu = QMenu() action_freeze_new = QAction(self.freeze_icon, "Freeze New", self) action_freeze_new.setShortcut( QKeySequence(self.prefs["hotkeys"]["value"]["freeze_new"].replace( '<', '').replace('>', ''))) action_freeze_new.triggered.connect(self.freeze_layout) stmenu.addAction(action_freeze_new) action_freeze_all = QAction("Freeze All", self) action_freeze_all.setShortcut( QKeySequence(self.prefs["hotkeys"]["value"]["freeze_all"].replace( '<', '').replace('>', ''))) action_freeze_all.triggered.connect(self.freeze_layout_all) stmenu.addAction(action_freeze_all) action_restore = QAction(self.restore_icon, "Restore Layout", self) action_restore.setShortcut( QKeySequence(self.prefs["hotkeys"]["value"]["restore"].replace( '<', '').replace('>', ''))) action_restore.triggered.connect(self.restore_layout) stmenu.addAction(action_restore) stmenu.addSeparator() clear_db_submenu = QMenu("Clear Database", stmenu) action_clear_db_curr_display_layout = clear_db_submenu.addAction( "Current Display Layout") action_clear_db_curr_display_layout.triggered.connect( self.clear_database_curr_display_layout) action_clear_db_all = QAction(self.caution_icon, "Clear Everything", self) action_clear_db_all.triggered.connect(self.clear_database_all) clear_db_submenu.addAction(action_clear_db_all) stmenu.addMenu(clear_db_submenu) action_prefs = stmenu.addAction("Preferences") action_prefs.triggered.connect(self.open_preferences) action_prefs = stmenu.addAction("About") action_prefs.triggered.connect(self.open_about) stmenu.addSeparator() action_exit = stmenu.addAction("Exit") action_exit.triggered.connect(self.app.exit) self.setContextMenu(stmenu)
def loadSnippetFromFile(snippetPath): try: snippetText = open(snippetPath, 'r').readlines() except: return ("", "", "") if (len(snippetText) < 3): return ("", "", "") else: qKeySequence = QKeySequence(snippetText[1].strip()[1:]) if qKeySequence.isEmpty(): qKeySequence = None return (snippetText[0].strip()[1:], qKeySequence, ''.join(snippetText[2:]))
def home(self): """ Add the GUI elements to the window that represent the home state of the application. """ toolbar = self.addToolBar("File") save = QAction(QIcon("res/icon_save.png"), "Save", self) save.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_S)) toolbar.addAction(save) load = QAction(QIcon("res/icon_load.png"), "Load", self) load.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_O)) toolbar.addAction(load) toolbar.addSeparator() undo = QAction(QIcon("res/icon_undo.png"), "Undo", self) undo.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_Z)) toolbar.addAction(undo) redo = QAction(QIcon("res/icon_redo.png"), "Redo", self) redo.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_Y)) toolbar.addAction(redo) toolbar.addSeparator() zoom_in = QAction(QIcon("res/icon_zoom_in.png"), "Zoom In", self) toolbar.addAction(zoom_in) zoom_out = QAction(QIcon("res/icon_zoom_out.png"), "Zoom Out", self) toolbar.addAction(zoom_out) toolbar.addSeparator() clear = QAction(QIcon("res/icon_clear.png"), "Clear", self) toolbar.addAction(clear) toolbar.addSeparator() grid = QAction(QIcon("res/icon_grid.png"), "Grid", self) toolbar.addAction(grid) toolbar.actionTriggered[QAction].connect(self.toolbar_pressed) splitter = QSplitter(self) splitter.setOrientation(Qt.Vertical) splitter.setHandleWidth(16) self.tile_ed = TileEd(self.size, self.tile_size, self.pixmap, self) scroll_area_tile_ed = QScrollArea() scroll_area_tile_ed.setBackgroundRole(QPalette.Dark) scroll_area_tile_ed.setWidgetResizable(True) scroll_area_tile_ed.setWidget(self.tile_ed) splitter.addWidget(scroll_area_tile_ed) self.tile_sel = TileSelector(self.tile_size, self.pixmap, self) scroll_area_tile_sel = QScrollArea() scroll_area_tile_sel.setBackgroundRole(QPalette.Dark) scroll_area_tile_sel.setWidgetResizable(True) scroll_area_tile_sel.setWidget(self.tile_sel) splitter.addWidget(scroll_area_tile_sel) self.setCentralWidget(splitter)
def __init__(self, main_window): super().__init__("&Analyze", parent=main_window) self.entries.extend([ MenuEntry('&Decompile', main_window.decompile_current_function, shortcut=QKeySequence(Qt.Key_F5)), MenuEntry('View in Proximity &Browser', main_window.view_proximity_for_current_function, shortcut=QKeySequence(Qt.CTRL + Qt.Key_B)), MenuEntry('&Interact', main_window.interact, shortcut=QKeySequence(Qt.Key_F6)), ],)
def _create_ui(self): self._path_line_edit = QLineEdit() self._path_line_edit.setReadOnly(True) self._browse_button = QPushButton('Browse') self._browse_button.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_B)) self._browse_button.setMaximumWidth(150) self._browse_button.clicked.connect(self._on_browse_button_clicked) browse_layout = QHBoxLayout() browse_layout.addWidget(self._path_line_edit) browse_layout.addWidget(self._browse_button) self._file_label = QLabel('') self._labeling_widget = LabelingWidget() self._previous_button = QPushButton('Previous') self._previous_button.setMaximumWidth(150) self._previous_button.setShortcut(QKeySequence(Qt.Key_A)) self._previous_button.clicked.connect(self._on_previous_button_clicked) self._next_button = QPushButton('Next') self._next_button.setMaximumWidth(150) self._next_button.setShortcut(QKeySequence(Qt.Key_D)) self._next_button.clicked.connect(self._on_next_button_clicked) self._clear_button = QPushButton('Clear') self._clear_button.setMaximumWidth(150) self._clear_button.setShortcut(QKeySequence(Qt.Key_Delete)) self._clear_button.clicked.connect(self._on_clear_button_clicked) self._save_button = QPushButton('Save') self._save_button.setMaximumWidth(150) self._save_button.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_S)) self._save_button.clicked.connect(self._on_save_button_clicked) action_layout = QHBoxLayout() action_layout.addWidget(self._previous_button) action_layout.addWidget(self._next_button) action_layout.addSpacing(100) action_layout.addWidget(self._clear_button) action_layout.addSpacing(100) action_layout.addWidget(self._save_button) layout = QVBoxLayout() layout.addLayout(browse_layout) layout.addWidget(self._file_label) layout.addWidget(self._labeling_widget) layout.addLayout(action_layout) self.setLayout(layout)
def initUI(self): menu = self.menuBar() files = menu.addMenu("Datei") open_action = QAction("Öffnen", self) save_action = QAction("Speichern", self) exit_action = QAction("Schließen", self) open_action.triggered.connect(self.open) save_action.triggered.connect(self.save) exit_action.triggered.connect(self.close) open_action.setShortcut(QKeySequence("Ctrl+O")) save_action.setShortcut(QKeySequence("Ctrl+S")) exit_action.setShortcut(QKeySequence("Ctrl+X")) files.addAction(open_action) files.addAction(save_action) files.addAction(exit_action)
def clearSelection(self): self.keySequenceEdit.clear() self.currentHotkey = QKeySequence() self.currentHotkeyLabel.setText("") self.currentFileLabel.setText("") self.snippetDescription.setText("") self.edit.setPlainText("")
def __init__(self): super(FindToolBar, self).__init__() self._line_edit = QLineEdit() self._line_edit.setClearButtonEnabled(True) self._line_edit.setPlaceholderText("Find...") self._line_edit.setMaximumWidth(300) self._line_edit.returnPressed.connect(self._find_next) self.addWidget(self._line_edit) self._previous_button = QToolButton() self._previous_button.setIcon( QIcon(':/qt-project.org/styles/commonstyle/images/up-32.png')) self._previous_button.clicked.connect(self._find_previous) self.addWidget(self._previous_button) self._next_button = QToolButton() self._next_button.setIcon( QIcon(':/qt-project.org/styles/commonstyle/images/down-32.png')) self._next_button.clicked.connect(self._find_next) self.addWidget(self._next_button) self._case_sensitive_checkbox = QCheckBox('Case Sensitive') self.addWidget(self._case_sensitive_checkbox) self._hideButton = QToolButton() self._hideButton.setShortcut(QKeySequence(Qt.Key_Escape)) self._hideButton.setIcon( QIcon(':/qt-project.org/styles/macstyle/images/closedock-16.png')) self._hideButton.clicked.connect(self.hide) self.addWidget(self._hideButton)
def __init__(self, subject, delegate=None, viewTip=True): self.delegate = delegate self.viewTip = viewTip Observation.__init__(self, subject) QWebEngineView.__init__(self) self.settings = Settings(subject) self.settings.open() page = Ace(delegate, subject, self) self.setPage(page) self.setMinimumSize(500, 300) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.setContextMenuPolicy(Qt.NoContextMenu) self.setWindowModality(Qt.ApplicationModal) self.page().loadFinished.connect(self.onLoadFinished) self.setWindowFlags(Qt.Tool | Qt.WindowTitleHint | Qt.CustomizeWindowHint | Qt.WindowCloseButtonHint | Qt.WindowMaximizeButtonHint) self.setWindowFlag(Qt.WindowMinimizeButtonHint, False) self.closeShortcut = QShortcut(QKeySequence(self.tr("Ctrl+w")), self, self.close) self.add_responder(events.settings.Save, self.settingsSaveResponder)
def __init__(self): super(MainWindow, self).__init__() self.ui = Ui_MainWindow() self.ui.setupUi(self) QFontDatabase.addApplicationFont('../resources/fonts/source code pro/SourceCodePro-Regular.ttf') self.nodes = [] self.nodes_list_widget = NodesListWidget(self) self.ui.nodes_scrollArea.setWidget(self.nodes_list_widget) # shortcuts save_shortcut = QShortcut(QKeySequence.Save, self) save_shortcut.activated.connect(self.save_triggered) import_nodes_shortcut = QShortcut(QKeySequence('Ctrl+i'), self) import_nodes_shortcut.activated.connect(self.import_nodes_triggered) # UI self.ui.splitter.setSizes([200, 850]) self.setWindowTitle('Ryven NodeManager') self.setWindowIcon(QIcon('resources/pics/program_icon2.png')) self.load_stylesheet('dark') self.ui.add_new_node_pushButton.clicked.connect(self.add_new_node_pushButton_clicked) self.ui.import_nodes_pushButton.clicked.connect(self.import_nodes_triggered) self.ui.clear_nodes_pushButton.clicked.connect(self.clear_button_clicked) self.ui.save_pushButton.clicked.connect(self.save_triggered)
def createTurnTableVoltageControlGroup(self): self.motorVoltageSlider = DoubleSlider(orientation=Qt.Orientation.Horizontal) self.motorVoltageSlider.setTickPosition(QSlider.TickPosition.TicksBothSides) self.motorVoltageSlider.setTickInterval(200) self.motorVoltageSlider.setEnabled(False) self.motorVoltageSliderValueSpinBox = createDoubleSpinBox() self.motorVoltageSliderValueSpinBox.setEnabled(False) self.motorVoltageSliderValueSpinBox.valueChanged.connect(self.motorVoltageSlider.setValue) self.motorVoltageSlider.doubleValueChanged.connect(self.motorVoltageSliderValueSpinBox.setValue) self.resetVoltageButton = QPushButton("Reset") self.resetVoltageButton.setEnabled(False) self.resetVoltageButton.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_R)) self.resetVoltageButton.pressed.connect(lambda: self.motorVoltageSlider.setValue(0.000)) sliderGridLayout = QGridLayout() sliderGridLayout.addWidget(QLabel("Min Voltage"), 0, 0, 1, 1) sliderGridLayout.addWidget(QLabel("Max Voltage"), 0, 4, 1, 1) sliderGridLayout.addWidget(self.motorVoltageSlider, 1, 0, 1, 5) sliderGridLayout.addWidget(self.motorVoltageSliderValueSpinBox, 2, 1, 1, 1) sliderGridLayout.addWidget(self.resetVoltageButton, 2, 4, 1, 1) voltageControlGroupBox = QGroupBox() voltageControlGroupBox.setLayout(sliderGridLayout) return voltageControlGroupBox