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, 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 __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 _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 __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 __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, 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 __init__(self): super().__init__() self.setupUi(self) # self.setStyleSheet(open('./style.css').read()) self.settings = Settings() self.user_settings = self.settings.get_settings() self.username_input.setText(self.user_settings['login']) self.password_input.setText(self.user_settings['password']) self.email_input.setText(self.user_settings['email']) if self.user_settings['app_theme'] == 'light': self.text_color = 'color:#000000' else: self.text_color = 'color:#ffffff' self.theme = f"./{self.user_settings['app_theme']}_theme.css" self.setStyleSheet(open(self.theme).read()) self.ip = None self.port = None self.running = False self.s_list_model = QtGui.QStandardItemModel() self.server_list.setModel(self.s_list_model) self.save_user_button.clicked.connect(self.save_user) self.servers: dict = self.user_settings['servers'] for k, v in self.servers.items(): row = f'{k} {v["ip"]}:{v["port"]}' row = QtGui.QStandardItem(row) self.s_list_model.appendRow(row) self.message_input.window = self self.paste_bind = QShortcut(QtGui.QKeySequence(Qt.CTRL + Qt.Key_V), self.tab_chat) self.paste_bind.activated.connect(self.paste) self.paste_bind.setEnabled(True) self.color_input.setText(self.user_settings['color']) self.server_list.clicked.connect(self.make_buttons_active) self.send_message_button.clicked.connect(self.send_button_handler) self.connect_server_button.clicked.connect(self.connect_button_handler) self.connect_server_button.setEnabled(False) self.disconnect_server_button.clicked.connect( self.disconnect_button_handler) self.delete_server_button.clicked.connect(self.delete_server) self.delete_server_button.setEnabled(False) self.add_server_button.clicked.connect(self.add_server) self.reconnect_server_button.clicked.connect(self.reconnect) self.clean_chat_button.clicked.connect(self.clean_chat) self.theme_button.clicked.connect(self.theme_changer) self.send_file_button.clicked.connect(self.send_file) self.message_box.anchorClicked.connect(self.file_onAnchorClicked) self.open_cache_button.clicked.connect( lambda: wb.open(f'{os.getcwd()}/cache/')) self.clear_cache_button.clicked.connect(clear_cache) self.show()
def __init__(self, qmp): QMainWindow.__init__(self) self.qmp = qmp self.fancy_list = [] self.yellow = [] self.blue = [] self.fancy = True self.registers = None self.init_ui() self.create_fancy() self.timer = QTimer(self) self.timer.timeout.connect(lambda: self.fancy_update() if self.fancy else self.ugly_update()) self.timer.start(100) self.prev = [] self.menu_bar() self.show() self.shortcut = QShortcut(QKeySequence('Ctrl+r'), self, activated=self.init_ui) # refresh registers
def __init__(self, btn_to_disable: QPushButton): """ Widget proposing an add button, with a text entry that will appear only when the add button is pressed. A new click on the add button will cancel the action, and a press on <Enter> will validate. :param btn_to_disable: button to disable when the creation field is shown """ QWidget.__init__(self) self.setFixedSize(QSize(150, 50)) self.add_btn = QPushButton() self.add_btn.setIcon(get_icon("add")) self.add_btn.setIconSize(QSize(35, 35)) self.add_btn.setToolTip(tr("crs_create_btn_tooltip")) self.field = QLineEdit() self.field.setVisible(False) # Current state self.is_creating = False self.btn_to_disable = btn_to_disable # Signals self.add_btn.clicked.connect(self.__on_add_pressed) self.sig_new_element = None # Signal emitted when a new element is created self.field.returnPressed.connect(self.__on_field_enter) QShortcut(QKeySequence("Escape"), self.field).activated.connect( lambda: self.__on_add_pressed()) # Cancel # Layout self.__init_layout() self.__init_style()
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, db, parent=None): scq = QShortcut(QKeySequence("Ctrl+Q"), self) scq.activated.connect(self.onexit) header = self.ui.resTable.horizontalHeader() header.setSortIndicatorShown(True) header.setSortIndicator(-1, QtCore.Qt.AscendingOrder) self.ui.resTable.setSortingEnabled(True)
def __init__(self, qmp): QMainWindow.__init__(self) self.qmp = qmp os.system('rm /tmp/errors.log 2>/dev/null') shortcut = QShortcut(QKeySequence('Ctrl+r'), self, activated=self.disp_output) self.timer = QTimer(self) self.timer.timeout.connect(self.disp_output) self.timer.start(100) self.activated = 0 self.length = 100 self.text_digest = '' self.qmp.hmp_command('logfile /tmp/errors.log') self.qmp.hmp_command('log guest_error') self.setWindowTitle('Error Log') self.setGeometry(100, 100, 600, 400) self.menu_bar() self.init_ui()
def __init__(self, qmp): QMainWindow.__init__(self) self.qmp = qmp shortcut = QShortcut(QKeySequence('Ctrl+r'), self, activated=self.disp_output) self.timer = QTimer(self) self.timer.timeout.connect(self.disp_output) # self.timer.start(100) self.activated = 0 open('/tmp/errors.log', 'w').close() self.qmp.hmp_command('logfile /tmp/errors.log') self.qmp.hmp_command('log guest_error') self.setWindowTitle('Error Log') self.setGeometry(100, 100, 600, 400) self.menu_bar() self.init_ui()
def __init__(self, parent): super(CodeEditor_Dialog, self).__init__(parent) self.code_src_file_path = None self.code_initial = None self.text_edit = CodeEditor_TextEdit() self.text_edit.set_code(self.code_initial) # shortcuts save_shortcut = QShortcut(QKeySequence.Save, self) save_shortcut.activated.connect(self.close) # UI layout = QVBoxLayout() buttons_layout = QHBoxLayout() reset_push_button = QPushButton('reset') reset_push_button.clicked.connect(self.reset_clicked) ok_push_button = QPushButton('OK') ok_push_button.clicked.connect(self.close) buttons_layout.addStretch() buttons_layout.addWidget(reset_push_button) buttons_layout.addWidget(ok_push_button) layout.addWidget(self.text_edit) layout.addLayout(buttons_layout) self.setLayout(layout) self.resize(900, 500) self.setWindowTitle('edit metacode')
def __init__(self, listview): UIObject.__init__(self) self.parent = listview delete_shortcut = QShortcut(QKeySequence(Qt.Key_Delete), self.parent) delete_shortcut.activated.connect(self.delete_current)
def __init__(self, parent, var): super(EditVarVal_Dialog, self).__init__(parent) # shortcut save_shortcut = QShortcut(QKeySequence.Save, self) save_shortcut.activated.connect(self.save_triggered) main_layout = QVBoxLayout() self.val_text_edit = QPlainTextEdit() var_val_str = '' try: var_val_str = str(var.val) except Exception as e: var_val_str = 'couldn\'nt stringify value' self.val_text_edit.setPlainText(var_val_str) main_layout.addWidget(self.val_text_edit) button_box = QDialogButtonBox() button_box.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) button_box.accepted.connect(self.accept) button_box.rejected.connect(self.reject) main_layout.addWidget(button_box) self.setLayout(main_layout) self.resize(450, 300) self.setWindowTitle('edit var val \'' + var.name + '\'')
def __init__(self, is_person=False, parent=None): super().__init__(parent) self.is_person = is_person self.module: TableModule = locator.get_scoped("ModuleService").get_module("Characters") self.proxy_model = QSortFilterProxyModel() self.proxy_model.setFilterCaseSensitivity(QtCore.Qt.CaseInsensitive) self.proxy_model.setSourceModel(self.module.entries_model) self.characters_list_view.setModel(self.proxy_model) self.selection: Optional[PropertyContainer] = None self.character_details_form_1 = PropertyForm(self.module.element_template, category="character_description_1") self.character_details_form_contents_1.setLayout(self.character_details_form_1) self.character_details_form_2 = PropertyForm(self.module.element_template, category="character_description_2") self.character_details_form_contents_2.setLayout(self.character_details_form_2) self.character_details_form_2.fix_editor_width(100) self.stats_editor = MergedStatsEditor(["Bases", "Growths", "Modifiers", "Penalties", "Bonuses"]) self.stats_form = PropertyForm(self.module.element_template, category="stats") self.stats_layout.addWidget(self.stats_editor) self.stats_layout.addLayout(self.stats_form) self.skills_form = PropertyForm(self.module.element_template, category="skills", sort_editors=True) self.skills_contents.setLayout(self.skills_form) self.flags_editor = MergedFlagsEditor( ["Bitflags (1)", "Bitflags (2)", "Bitflags (3)", "Bitflags (4)"], self.module.element_template ) self.flags_editor_2 = MergedFlagsEditor( ["Bitflags (5)", "Bitflags (6)", "Bitflags (7)", "Bitflags (8)"], self.module.element_template ) self.misc_form = PropertyForm(self.module.element_template, category="misc") self.misc_layout.addWidget(self.flags_editor) self.misc_layout.addWidget(self.flags_editor_2) self.misc_layout.addLayout(self.misc_form) self.ids_form = PropertyForm(self.module.element_template, category="ids") self.ids_tab.setLayout(self.ids_form) self.classes_form = PropertyForm(self.module.element_template, category="classes", sort_editors=True) self.classes_tab.setLayout(self.classes_form) if not self.is_person: self.dialogue_tab = DialogueEditor() self.supports_tab = QWidget() self.supports_layout = QHBoxLayout() self.supports_widget = FE14SupportWidget() self.supports_scroll = QScrollArea() self.supports_scroll_contents = QWidget() self.supports_scroll.setWidget(self.supports_scroll_contents) self.supports_scroll.setWidgetResizable(True) self.supports_layout.addWidget(self.supports_widget) self.supports_layout.addWidget(self.supports_scroll) self.supports_tab.setLayout(self.supports_layout) self.supports_form = PropertyForm(self.module.element_template, category="supports") self.supports_scroll_contents.setLayout(self.supports_form) self.tab_widget.addTab(self.supports_tab, "Supports") self.tab_widget.addTab(self.dialogue_tab, "Dialogue") self.context_menu = QMenu(self) self.context_menu.addActions([self.action_add, self.action_remove, self.action_copy_to]) self.clear_selection_shortcut = QShortcut(QKeySequence.Cancel, self) self._install_signals() self._clear()
def __init__(self, config): super(MainWindow, self).__init__() QFontDatabase.addApplicationFont('fonts/poppins/Poppins-Medium.ttf') QFontDatabase.addApplicationFont('fonts/source code pro/SourceCodePro-Regular.ttf') self.ui = Ui_MainWindow() self.ui.setupUi(self) self.ui.splitter.setSizes([120, 800]) self.setWindowTitle('pyScript') self.setWindowIcon(QIcon('stuff/pics/program_icon.png')) self.load_stylesheet('dark') self.ui.scripts_tab_widget.removeTab(0) self.ui.actionImport_Nodes.triggered.connect(self.on_import_nodes_triggered) self.ui.actionSave_Project.triggered.connect(self.on_save_project_triggered) self.ui.actionDesignDark_Std.triggered.connect(self.on_dark_std_design_triggered) self.ui.actionDesignDark_Tron.triggered.connect(self.on_dark_tron_design_triggered) self.ui.actionEnableDebugging.triggered.connect(self.on_enable_debugging_triggered) self.ui.actionDisableDebugging.triggered.connect(self.on_disable_debugging_triggered) self.ui.actionSave_Pic_Viewport.triggered.connect(self.on_save_scene_pic_viewport_triggered) self.ui.actionSave_Pic_Whole_Scene_scaled.triggered.connect(self.on_save_scene_pic_whole_triggered) # Shortcuts save_shortcut = QShortcut(QKeySequence.Save, self) save_shortcut.activated.connect(self.on_save_project_triggered) self.custom_nodes = [] self.all_nodes = [SetVariable_Node(), GetVariable_Node()] # holds NI subCLASSES for imported nodes: self.all_node_instance_classes = { self.all_nodes[0]: SetVar_NodeInstance, self.all_nodes[1]: GetVar_NodeInstance } # (key: node obj, val: NI subclass) (used in Flow) # {node : {str: PortInstanceWidget-subclass}} (used in PortInstance) self.custom_node_input_widget_classes = {} # clear temp folder for f in os.listdir('temp'): os.remove('temp/'+f) self.scripts = [] self.scripts_list_widget = ScriptsListWidget(self, self.scripts) self.ui.scripts_scrollArea.setWidget(self.scripts_list_widget) self.ui.add_new_script_pushButton.clicked.connect(self.create_new_script_button_pressed) self.ui.new_script_name_lineEdit.returnPressed.connect(self.create_new_script_le_return_pressed) self.design_style = 'dark std' if config['config'] == 'create plain new project': self.try_to_create_new_script() elif config['config'] == 'open project': self.import_required_packages(config['required packages']) self.parse_project(config['content']) self.resize(1500, 800)
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+C"), self, self.workspace.instance.interrupt_current_job) # Raise the DisassemblyView after everything has initialized center_dockable_views[0].raise_()
def __init__(self, parent: QWidget = None, maxTabCount=250): super().__init__(parent) self.closeTabShortcut = QShortcut(QKeySequence("Ctrl+W"), self, self.closeCurrentTab) self.maxTabCount = maxTabCount self.setTabsClosable(True) self.tabCloseRequested.connect(self.onTabClosed) self.log = logging.getLogger(LOGGER_NAMES.PLAYER)
def setup_connections(self): self.search_box.textChanged.connect(self.search_food) self.add_to_fridge_btn.clicked.connect(self.add_to_fridge) QApplication.instance().focusChanged.connect(self.focus_changed) add_shortcut = QShortcut(QKeySequence(Qt.Key_Return), self.search_view) add_shortcut.activated.connect(self.add_to_fridge)
def shortcut_init(self): sc = G.config.SHORTCUT for name, sho in sc.items(): if sho == '--': continue temp = QShortcut(QKeySequence(self.tr(sho)), self) temp.activated.connect(getattr(self, f"{name}_handle")) setattr(self, f"{name}_sc", temp)
def __init__(self): """ Widget proposing an add button, with a text entry that will appear only when the add button is pressed. The attribute type selection combo will also appear next to it. We also display a remove button, that will be shown only when the other fields are not. A new click on the add button (or an <Escape> press) will cancel the action, and a press on <Enter> will validate. """ QWidget.__init__(self) self.setFixedSize(QSize(290, 50)) self.attr_types_dico = {} for attr_type in [t.value for t in EAttributesTypes]: self.attr_types_dico[tr(attr_type)] = attr_type self.add_btn = QPushButton() self.add_btn.setIcon(get_icon("add")) self.add_btn.setIconSize(QSize(35, 35)) self.add_btn.setToolTip(tr("crs_create_btn_tooltip")) self.field = QLineEdit() self.field.setVisible(False) self.combo = QComboBox() self.combo.setFixedWidth(105) self.combo.addItems(list(self.attr_types_dico.keys())) self.combo.setVisible(False) self.ok_btn = QPushButton() self.ok_btn.setIcon(get_icon("valid")) self.ok_btn.setIconSize(QSize(35, 35)) self.ok_btn.setToolTip(tr("crs_create_btn_tooltip")) self.ok_btn.setVisible(False) self.delete_btn = QPushButton() self.delete_btn.setIcon(get_icon("del")) self.delete_btn.setIconSize(QSize(35, 35)) self.delete_btn.setToolTip(tr("btn_suppr")) self.delete_btn.setEnabled(False) # Current state self.is_creating = False # Signals self.ok_btn.clicked.connect(self.__on_field_enter) self.add_btn.clicked.connect(self.__on_add_pressed) self.sig_new_element = None # Signal emitted when a new element is created self.sig_delete = None # Signal emitted when the delete button is clicked self.field.returnPressed.connect(self.__on_field_enter) QShortcut(QKeySequence("Escape"), self.field).activated.connect( lambda: self.__on_add_pressed()) # Cancel self.delete_btn.clicked.connect(lambda: self.sig_delete.emit()) # Layout self.__init_layout() self.__init_style()
def initUI(self): """ Initialize the user interface. """ # Main window self.win = QWidget() self.win.setWindowTitle(self.path) layout = QGridLayout(self.win) # ImageView self.ImageView = ImageView(parent=self.win) layout.addWidget(self.ImageView, 0, 0, 2, 2) # Frame slider self.frame_slider = IntSlider(minimum=0, interval=1, maximum=self.ImageReader.n_frames - 1, init_value=1, name='Frame', parent=self.win) layout.addWidget(self.frame_slider, 2, 0, 1, 1, alignment=Qt.AlignTop) self.frame_slider.assign_callback(self.frame_slider_callback) # Buttons to make projections self.B_max_int = QPushButton("Make projection", self.win) layout.addWidget(self.B_max_int, 3, 0, 1, 1, alignment=Qt.AlignLeft) self.B_max_int.clicked.connect(self.B_max_int_callback) # Use the right/left keys to tab through frames self.left_shortcut = QShortcut(QKeySequence(QtGui_Qt.Key_Left), self.win) self.right_shortcut = QShortcut(QKeySequence(QtGui_Qt.Key_Right), self.win) self.left_shortcut.activated.connect(self.prev_frame) self.right_shortcut.activated.connect(self.next_frame) # Update the frame self.load_frame(0, reset=True) # Resize main window self.win.resize(600, 600) # Show the main window self.win.show()
def __init__(self, config, parent=None): """ Code editor widget :param config: configuration file :param parent: """ QPlainTextEdit.__init__(self, parent) self.config = config self.line_number_area = LineNumberArea(self) self.line_number_area.on_click = self.process_breakpoint self.highlight = AssembleHighlighter(self.document(), config) self.setLineWrapMode(QPlainTextEdit.NoWrap) # default widget Signals binding self.blockCountChanged.connect(self.update_line_number_area_width) self.updateRequest.connect(self.update_line_number_area) self.cursorPositionChanged.connect(self.highlight_current_line) # Shortcuts shortcut_save = QShortcut(QKeySequence("Ctrl+S"), self) shortcut_save.activated.connect(self.on_ctrl_s_activated) shortcut_open = QShortcut(QKeySequence("Ctrl+O"), self) shortcut_open.activated.connect(self.on_ctrl_o_activated) shortcut_indent_all = QShortcut(QKeySequence("Ctrl+T"), self) shortcut_indent_all.activated.connect(self.indent_file) shortcut_search = QShortcut(QKeySequence("Ctrl+F"), self) shortcut_search.activated.connect(self.on_ctrl_f_activated) # Change the font to get a fix size for characters doc = self.document() f = doc.defaultFont() f.setFamily(get_font(config)) doc.setDefaultFont(f) # initialization self.breakpoints = [] self.blockCountChanged.emit(0) self.cursorPositionChanged.emit()
def __init__(self, selector, parent=None): super(CollectionStaticSelectionWidget, self).__init__(parent=parent) self._selector = selector self.setAcceptDrops(True) self.setDropIndicatorShown(True) self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(self.rightClicked) self.contextMenu = QMenu(self) self.selectAction = QAction( maya.stringTable['y_collectionStaticSelectionWidget.kSelect'], self.contextMenu) self.selectAction.triggered.connect(self.selectEntry) self.removeAction = QAction( maya.stringTable['y_collectionStaticSelectionWidget.kRemove'], self.contextMenu) self.removeAction.triggered.connect(self.removeEntry) self.removeMissingAction = QAction( maya. stringTable['y_collectionStaticSelectionWidget.kRemoveMissing'], self.contextMenu) self.removeMissingAction.triggered.connect(self.removeMissingObjects) self.selectMissingAction = QAction( maya. stringTable['y_collectionStaticSelectionWidget.kSelectMissing'], self.contextMenu) self.selectMissingAction.triggered.connect(self.selectMissingObjects) self.removeFilteredAction = QAction( maya. stringTable['y_collectionStaticSelectionWidget.kRemoveFiltered'], self.contextMenu) self.removeFilteredAction.triggered.connect(self.removeFilteredObjects) self.selectFilteredAction = QAction( maya. stringTable['y_collectionStaticSelectionWidget.kSelectFiltered'], self.contextMenu) self.selectFilteredAction.triggered.connect(self.selectFilteredObjects) self.itemDoubleClicked.connect(self.onDoubleClick) # The static selection widget was handling deletion even when it's # parent did not have focus, thus preventing collections from being # deleted with the delete key, thus the need for the: # Qt.WidgetWithChildrenShortcut removeShortcut = QShortcut(QKeySequence(Qt.Key_Delete), self, None, None, Qt.WidgetWithChildrenShortcut) removeShortcut.activated.connect(self.removeEntry) self.setSelectionMode(QAbstractItemView.ExtendedSelection) self.setItemDelegate(HTMLDelegate(self._selector)) # The initial size of the collection static selection widget is # large enough to fit 4 entries. The widget can be grown to # accommodate 10 entries (with scroll bars for additional entries). self.INITIAL_HEIGHT = self.sizeHintForRow( 0) * self.MIN_VISIBLE_ENTRIES + 2 * self.frameWidth() self.MAX_HEIGHT = self.sizeHintForRow( 0) * self.MAX_VISIBLE_ENTRIES + 2 * self.frameWidth()
def __init__(self, module: TableModule): super().__init__() self.setupUi(self) self.module = module self.selection = None self.model = self.module.entries_model self.proxy_model = QtCore.QSortFilterProxyModel() self.proxy_model.setFilterCaseSensitivity(QtCore.Qt.CaseInsensitive) self.proxy_model.setSourceModel(self.model) self.list_view.setModel(self.proxy_model) self.clear_selection_shortcut = QShortcut(QKeySequence.Cancel, self) self.list_view.selectionModel().currentRowChanged.connect( self._update_selection) self.clear_selection_shortcut.activated.connect( lambda: self._update_selection(QModelIndex())) self.search_field.textChanged.connect(self._update_filter) self.add_button.clicked.connect(self._on_add_pressed) self.remove_button.clicked.connect(self._on_remove_pressed) self.copy_to_button.clicked.connect(self._on_copy_to_pressed) self.property_form = PropertyForm(module.element_template) self.form_layout.setLayout(self.property_form) self.setWindowTitle(self.module.name) self.setWindowIcon(QIcon("paragon.ico")) self.copy_to_button.setEnabled(False) self.remove_button.setEnabled(False) self.splitter.setSizes([300, 680]) self.splitter.setStretchFactor(0, 0) self.splitter.setStretchFactor(1, 1) self.list_context_menu = QMenu(self) self.add_action = QAction("Add Element") self.add_action.triggered.connect(self._on_add_pressed) self.remove_action = QAction("Remove Element") self.remove_action.triggered.connect(self._on_remove_pressed) self.copy_to_action = QAction("Copy To") self.copy_to_action.triggered.connect(self._on_copy_to_pressed) self.list_context_menu.addActions( [self.add_action, self.remove_action, self.copy_to_action]) self.list_view.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.list_view.customContextMenuRequested.connect( self._on_list_context_menu_requested) if self.module.disable_add_remove: self.add_action.setEnabled(False) self.remove_action.setEnabled(False) self.add_button.setVisible(False) self.remove_button.setVisible(False) self._update_selection(QModelIndex()) logging.info("Generated SimpleEditor for " + self.module.name)
def createRightSide(self): self.topRightGroupBox = QGroupBox() self.totalLength = 0 self.elems = 0 self.elems_list = [] self.overall_layout = QVBoxLayout() grad = QPalette() gradient = QConicalGradient(QPointF(1100, 150), -190) gradient.setColorAt(0.0, QColor(30, 30, 30)) gradient.setColorAt(0.5, QColor(50, 50, 50)) gradient.setColorAt(0.97, QColor(50, 13, 150)) gradient.setColorAt(1.0, QColor(106, 13, 173)) gradient.setSpread(QGradient.RepeatSpread) grad.setBrush(QPalette.Window, QBrush(gradient)) self.setPalette(grad) self.scrollarea = QScrollArea() self.scrollarea.setWidgetResizable(True) self.widget = QWidget() self.scrollarea.setWidget(self.widget) self.layout = QVBoxLayout(self.widget) self.add_elem = QPushButton("Add Element") if PLATFORM == "darwin": self.add_elem.setToolTip("Shortcut: ⌘E") else: self.add_elem.setToolTip("Shortcut: Ctrl+E") self.add_elem.setStyleSheet( "QToolTip { border: 0px; border-radius: 3px }") self.add_elem.clicked.connect(lambda: ElementPopup()) self.add_elem.setFixedWidth(300) shortcut = QShortcut(QKeySequence("Ctrl+E"), self.add_elem) shortcut.activated.connect(lambda: ElementPopup()) shortcut.setEnabled(True) self.layout.addWidget(self.add_elem) self.layout.setAlignment(self.add_elem, Qt.AlignCenter | Qt.AlignTop) self.overall_layout.addWidget(self.scrollarea) self.topRightGroupBox.setLayout(self.overall_layout)