Python PyQt5.QtWidgets.QShortcut() Examples
The following are 30
code examples of PyQt5.QtWidgets.QShortcut().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtWidgets
, or try the search function
.
Example #1
Source File: base.py From spinalcordtoolbox with MIT License | 7 votes |
def _init_ui(self): self.resize(1200, 800) self.setAttribute(QtCore.Qt.WA_DeleteOnClose) layout = QtWidgets.QVBoxLayout(self) self._init_header(layout) self._init_canvas(layout) self._init_controls(layout) self._init_footer(layout) events = ( (QtGui.QKeySequence.Undo, self.on_undo), (QtGui.QKeySequence.Save, self.on_save_quit), (QtGui.QKeySequence.Quit, self.close), (QtGui.QKeySequence.MoveToNextChar, self.increment_vertical_nav), (QtGui.QKeySequence.MoveToPreviousChar, self.decrement_vertical_nav), (QtGui.QKeySequence.MoveToNextLine, self.increment_horizontal_nav), (QtGui.QKeySequence.MoveToPreviousLine, self.decrement_horizontal_nav) ) for event, action in events: QtWidgets.QShortcut(event, self, action) self.setWindowTitle(self.params.dialog_title)
Example #2
Source File: objectinspector.py From IDASkins with MIT License | 7 votes |
def __init__(self, *args, **kwargs): super(ObjectInspector, self).__init__(*args, **kwargs) self._selected_widget = None self._ui = Ui_ObjectInspector() self._ui.setupUi(self) # Make everything monospace. font = QFont('Monospace') font.setStyleHint(QFont.TypeWriter) self._ui.teInspectionResults.setFont(font) # Register signals. self._update_key = QShortcut(QKeySequence(Qt.Key_F7), self) self._ui.btnSelectParent.released.connect(self.select_parent) self._update_key.activated.connect(self.update_inspection)
Example #3
Source File: Area.py From Python-Application with GNU General Public License v3.0 | 6 votes |
def init_action(self): zoom_minus = QShortcut(QKeySequence("Ctrl+-"), self) zoom_minus.activated.connect(self.minus) zoom_plus = QShortcut(QKeySequence("Ctrl+="), self) zoom_plus.activated.connect(self.plus) switch_left = QShortcut(QKeySequence(Qt.Key_Left), self) switch_left.activated.connect(self.left) switch_right = QShortcut(QKeySequence(Qt.Key_Right), self) switch_right.activated.connect(self.right) ''' a1 = QAction(self) a1.setShortcut('Ctrl++') self.addAction(a1) a1.triggered.connect(self.plus) a2 = QAction(self) a2.setShortcut('Ctrl+-') self.addAction(a2) a2.triggered.connect(self.minus) '''
Example #4
Source File: gui.py From code-jam-5 with MIT License | 6 votes |
def set_shortcuts(self): year_move_right = QtWidgets.QShortcut( QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.Key_Right), self) year_move_right.activated.connect(lambda: self.move_slider(self.year_step)) year_move_left = QtWidgets.QShortcut( QtGui.QKeySequence(QtCore.Qt.CTRL + QtCore.Qt.Key_Left), self) year_move_left.activated.connect(lambda: self.move_slider(-self.year_step)) month_move_right = QtWidgets.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Right), self) month_move_right.activated.connect(lambda: self.move_slider(1)) month_move_left = QtWidgets.QShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Left), self) month_move_left.activated.connect(lambda: self.move_slider(-1))
Example #5
Source File: main_window.py From parsec-cloud with GNU Affero General Public License v3.0 | 6 votes |
def _define_shortcuts(self): self.shortcut_close = QShortcut(QKeySequence(QKeySequence.Close), self) self.shortcut_close.activated.connect(self._shortcut_proxy(self.close_current_tab)) self.shortcut_new_tab = QShortcut(QKeySequence(QKeySequence.AddTab), self) self.shortcut_new_tab.activated.connect(self._shortcut_proxy(self._on_add_instance_clicked)) self.shortcut_settings = QShortcut(QKeySequence(_("Ctrl+K")), self) self.shortcut_settings.activated.connect(self._shortcut_proxy(self._show_settings)) self.shortcut_menu = QShortcut(QKeySequence(_("Alt+E")), self) self.shortcut_menu.activated.connect(self._shortcut_proxy(self._show_menu)) self.shortcut_help = QShortcut(QKeySequence(QKeySequence.HelpContents), self) self.shortcut_help.activated.connect(self._shortcut_proxy(self._on_show_doc_clicked)) self.shortcut_quit = QShortcut(QKeySequence(QKeySequence.Quit), self) self.shortcut_quit.activated.connect(self._shortcut_proxy(self.close_app)) self.shortcut_create_org = QShortcut(QKeySequence(QKeySequence.New), self) self.shortcut_create_org.activated.connect( self._shortcut_proxy(self._on_create_org_clicked) ) self.shortcut_join_org = QShortcut(QKeySequence(QKeySequence.Open), self) self.shortcut_join_org.activated.connect(self._shortcut_proxy(self._on_join_org_clicked)) shortcut = QShortcut(QKeySequence(QKeySequence.NextChild), self) shortcut.activated.connect(self._shortcut_proxy(self._cycle_tabs(1))) shortcut = QShortcut(QKeySequence(QKeySequence.PreviousChild), self) shortcut.activated.connect(self._shortcut_proxy(self._cycle_tabs(-1)))
Example #6
Source File: universal_tool_template_2010.py From universal_tool_template.py with MIT License | 5 votes |
def qui_key(self, key_name, key_combo, func): self.hotkey[key_name] = QtWidgets.QShortcut(QtGui.QKeySequence(key_combo), self) self.hotkey[key_name].activated.connect( func )
Example #7
Source File: universal_tool_template_1020.py From universal_tool_template.py with MIT License | 5 votes |
def qui_key(self, key_name, key_combo, func): self.hotkey[key_name] = QtWidgets.QShortcut(QtGui.QKeySequence(key_combo), self) self.hotkey[key_name].activated.connect( func )
Example #8
Source File: GearBox_template_1010.py From universal_tool_template.py with MIT License | 5 votes |
def Establish_Connections(self): super(self.__class__,self).Establish_Connections() # custom ui response # shortcut connection self.hotkey = {} # self.hotkey['my_key'] = QtWidgets.QShortcut(QtGui.QKeySequence( "Ctrl+1" ), self) # self.hotkey['my_key'].activated.connect(self.my_key_func) # ---- user response list ----
Example #9
Source File: universal_tool_template_1115.py From universal_tool_template.py with MIT License | 5 votes |
def qui_key(self, key_name, key_combo, func): self.hotkey[key_name] = QtWidgets.QShortcut(QtGui.QKeySequence(key_combo), self) self.hotkey[key_name].activated.connect( func )
Example #10
Source File: universal_tool_template_1115.py From universal_tool_template.py with MIT License | 5 votes |
def Establish_Connections(self): super(self.__class__,self).Establish_Connections() # custom ui response # shortcut connection self.hotkey = {} # self.hotkey['my_key'] = QtWidgets.QShortcut(QtGui.QKeySequence( "Ctrl+1" ), self) # self.hotkey['my_key'].activated.connect(self.my_key_func) # ---- user response list ----
Example #11
Source File: universal_tool_template_1112.py From universal_tool_template.py with MIT License | 5 votes |
def qui_key(self, key_name, key_combo, func): self.hotkey[key_name] = QtWidgets.QShortcut(QtGui.QKeySequence(key_combo), self) self.hotkey[key_name].activated.connect( func )
Example #12
Source File: universal_tool_template_1112.py From universal_tool_template.py with MIT License | 5 votes |
def Establish_Connections(self): super(self.__class__,self).Establish_Connections() # custom ui response # shortcut connection self.hotkey = {} # self.hotkey['my_key'] = QtWidgets.QShortcut(QtGui.QKeySequence( "Ctrl+1" ), self) # self.hotkey['my_key'].activated.connect(self.my_key_func) # ---- user response list ----
Example #13
Source File: universal_tool_template_1100.py From universal_tool_template.py with MIT License | 5 votes |
def Establish_Connections(self): super(self.__class__,self).Establish_Connections() # custom ui response # shortcut connection self.hotkey = {} # self.hotkey['my_key'] = QtWidgets.QShortcut(QtGui.QKeySequence( "Ctrl+1" ), self) # self.hotkey['my_key'].activated.connect(self.my_key_func) # ---- user response list ----
Example #14
Source File: universal_tool_template_1110.py From universal_tool_template.py with MIT License | 5 votes |
def qui_key(self, key_name, key_combo, func): self.hotkey[key_name] = QtWidgets.QShortcut(QtGui.QKeySequence(key_combo), self) self.hotkey[key_name].activated.connect( func )
Example #15
Source File: universal_tool_template_1110.py From universal_tool_template.py with MIT License | 5 votes |
def Establish_Connections(self): super(self.__class__,self).Establish_Connections() # custom ui response # shortcut connection self.hotkey = {} # self.hotkey['my_key'] = QtWidgets.QShortcut(QtGui.QKeySequence( "Ctrl+1" ), self) # self.hotkey['my_key'].activated.connect(self.my_key_func) # ---- user response list ----
Example #16
Source File: universal_tool_template_0904.py From universal_tool_template.py with MIT License | 5 votes |
def Establish_Connections(self): super(self.__class__,self).Establish_Connections() # custom ui response # shortcut connection self.hotkey = {} # self.hotkey['my_key'] = QtWidgets.QShortcut(QtGui.QKeySequence( "Ctrl+1" ), self) # self.hotkey['my_key'].activated.connect(self.my_key_func) # ---- user response list ----
Example #17
Source File: universal_tool_template_1000.py From universal_tool_template.py with MIT License | 5 votes |
def Establish_Connections(self): super(self.__class__,self).Establish_Connections() # custom ui response # shortcut connection self.hotkey = {} # self.hotkey['my_key'] = QtWidgets.QShortcut(QtGui.QKeySequence( "Ctrl+1" ), self) # self.hotkey['my_key'].activated.connect(self.my_key_func) # ---- user response list ----
Example #18
Source File: mainwidget.py From spimagine with BSD 3-Clause "New" or "Revised" License | 5 votes |
def initActions(self): QtWidgets.QShortcut(QtGui.QKeySequence("Ctrl+W"), self, self.closeMe) # self.exitAction = QtWidgets.QAction('Quit', self) # self.exitAction.setShortcut('Ctrl+Q') # self.exitAction.setStatusTip('Exit application') # self.exitAction.triggered.connect(self.foo)
Example #19
Source File: HexViewMode.py From MARA_Framework with GNU Lesser General Public License v3.0 | 5 votes |
def initUI(self): self.setWindowTitle('Annotations') self.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) shortcut = QtWidgets.QShortcut(QtGui.QKeySequence("Shift+/"), self, self.close, self.close)
Example #20
Source File: binwindow.py From MARA_Framework with GNU Lesser General Public License v3.0 | 5 votes |
def initUI(self): self.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) shortcut = QtWidgets.QShortcut(QtGui.QKeySequence("/"), self, self.close, self.close) self.ui.pushButton.clicked.connect(self.onClicked) width = self.ui.size().width()+15 height = self.ui.size().height()+15 self.setFixedSize(width, height)
Example #21
Source File: shortcuts.py From guppy-proxy with MIT License | 5 votes |
def add_shortcut(self, action, desc, func, key=None): sc = QShortcut(self.guppy_window) self.combos[action] = (sc, desc) sc.activated.connect(func) if key: sc.setKey(key)
Example #22
Source File: polygon.py From CvStudio with MIT License | 5 votes |
def __init__(self, parent=None): super(AnnotationView, self).__init__(parent) self.setRenderHints(QtGui.QPainter.Antialiasing | QtGui.QPainter.SmoothPixmapTransform) self.setMouseTracking(True) QtWidgets.QShortcut(QtGui.QKeySequence.ZoomIn, self, activated=self.zoomIn) QtWidgets.QShortcut(QtGui.QKeySequence.ZoomOut, self, activated=self.zoomOut)
Example #23
Source File: polygon.py From CvStudio with MIT License | 5 votes |
def __init__(self, parent=None): super(AnnotationWindow, self).__init__(parent) self.m_view = AnnotationView() self.m_scene = AnnotationScene(self) self.m_view.setScene(self.m_scene) self.setCentralWidget(self.m_view) self.create_menus() QtWidgets.QShortcut(QtCore.Qt.Key_Escape, self, activated=partial(self.m_scene.setCurrentInstruction, Instructions.No_Instruction))
Example #24
Source File: text_manager.py From Grabber with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent=None): """Handles text files for batch downloads from a list of links.""" super().__init__(parent=parent) # Denotes if the textfile is saved. self.SAVED = True self.textedit = QTextEdit() self.textedit.setObjectName('TextFileEdit') self.textedit.setFont(FONT_CONSOLAS) self.textedit.setAcceptRichText(False) self.textedit.verticalScrollBar().setObjectName('main') # Create load button and label. self.label = QLabel('Add videos to textfile:') self.loadButton = QPushButton('Load file') self.saveButton = QPushButton('Save file') self.saveButton.setDisabled(True) self.textedit.textChanged.connect(self.enable_saving) # Other functionality. self.shortcut = QShortcut(QKeySequence("Ctrl+S"), self.textedit) self.shortcut.activated.connect(self.saveButton.click) # Layout # Create horizontal layout. self.QH = QHBoxLayout() # Filling horizontal layout self.QH.addWidget(self.label) self.QH.addStretch(1) self.QH.addWidget(self.loadButton) self.QH.addWidget(self.saveButton) # Horizontal layout with a textedit and a button. self.VB = QVBoxLayout() self.VB.addLayout(self.QH) self.VB.addWidget(self.textedit) self.setLayout(self.VB)
Example #25
Source File: spectra.py From pySPM with Apache License 2.0 | 5 votes |
def __init__(self, filename=None, parent=None): super(SpectraViewer, self).__init__(parent) self.ui = Ui_SpectraViewer() self.ui.setupUi(self) self.sf = 7200 self.k0 = 0 self.dsf = 0 self.dk0 = 0 self.ita = None self.fig = self.ui.mpl.canvas.fig self.canvas = self.ui.mpl.canvas self.ax = self.fig.add_subplot(111) self.nextMass = QShortcut(Qt.Key_Plus, self) self.prevMass = QShortcut(Qt.Key_Minus, self) self.nextMass.activated.connect(self.next_mass) self.prevMass.activated.connect(self.prev_mass) self.ui.pushButton_2.clicked.connect(self.toggleMassCal) self.ui.pushButton.clicked.connect(self.removeMassCalItem) self.ui.show_mass.clicked.connect(self.yAxisScaleChanged) self.canvas.mpl_connect('motion_notify_event', self.on_motion) self.canvas.mpl_connect('button_press_event', self.onMousePress) self.canvas.mpl_connect('button_release_event', self.onMouseRelease) self.canvas.mpl_connect("scroll_event", self.scrolling) self.labels = [] self.action = None self.lab_lines = [] self.MassCal = [] self.open(filename)
Example #26
Source File: widgets.py From corrscope with BSD 2-Clause "Simplified" License | 5 votes |
def new_shortcut(shortcut: str, scope: qw.QWidget, slot: Callable) -> qw.QShortcut: parsed_keys = QKeySequence(shortcut, QKeySequence.PortableText) scoped_shortcut = qw.QShortcut(parsed_keys, scope) scoped_shortcut.setContext(Qt.WidgetWithChildrenShortcut) scoped_shortcut.activated.connect(slot) return scoped_shortcut
Example #27
Source File: Viewer.py From PyRAT with Mozilla Public License 2.0 | 5 votes |
def __init__(self): QtWidgets.QMainWindow.__init__(self) self.setWindowTitle("PyRAT - Radar Tools") self.box = [0, 100, 0, 100] # current display image coordinates self.rubberbox = [0, 1, 0, 1] # coordinates of a rubberbox selection self.size = [100, 100] self.factor = 1.0 self.sarscale = 2.5 self.type = 'A' self.data = [] # link to preview data self.current = None # currently displayed layer self.display = {} # dictionary of display configs self.config = {} # current config self.block_redraw = False self.picture_redraw = False self.show_rubberband = False self.undolist = [] self.makeActions() self.makeToolbar() self.makeStatusBar() self.makeMenu() self.makeView() self.initPlugins() self.resize(1000, 800) self.central.setSizes([150, 800]) self.updateDisplayList() self.dragX = 0 self.dragY = 0 self.imgwidth = 0 self.imgheight = 0 self.show() self.rubberband = QtWidgets.QRubberBand(QtWidgets.QRubberBand.Rectangle, self.imageLabel) self.palette = 0 QtWidgets.QShortcut(QtGui.QKeySequence("Ctrl+T"), self, self.easterEgg) self.central.setMinimumSize(100, 100)
Example #28
Source File: binary.py From qiew with GNU General Public License v2.0 | 5 votes |
def registerShortcuts(self, parent): self._parent = parent self.w = DialogGoto(parent, self) self._Shortcuts += [QtWidgets.QShortcut(QtGui.QKeySequence("Alt+G"), parent, self._showit, self._showit)] self._Shortcuts += [QtWidgets.QShortcut(QtGui.QKeySequence("s"), parent, self.skip_chars, self.skip_chars)] self._Shortcuts += [QtWidgets.QShortcut(QtGui.QKeySequence("e"), parent, self.skip_block, self.skip_block)]
Example #29
Source File: binwindow.py From dcc with Apache License 2.0 | 5 votes |
def initUI(self): self.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) shortcut = QtWidgets.QShortcut(QtGui.QKeySequence("/"), self, self.close, self.close) self.ui.pushButton.clicked.connect(self.onClicked) width = self.ui.size().width() + 15 height = self.ui.size().height() + 15 self.setFixedSize(width, height)
Example #30
Source File: widgets.py From Lector with GNU General Public License v3.0 | 5 votes |
def generate_keyboard_shortcuts(self): ksNextChapter = QtWidgets.QShortcut( QtGui.QKeySequence('Right'), self.contentView) ksNextChapter.setObjectName('nextChapter') ksNextChapter.activated.connect(self.sneaky_change) ksPrevChapter = QtWidgets.QShortcut( QtGui.QKeySequence('Left'), self.contentView) ksPrevChapter.setObjectName('prevChapter') ksPrevChapter.activated.connect(self.sneaky_change) ksGoFullscreen = QtWidgets.QShortcut( QtGui.QKeySequence('F'), self.contentView) ksGoFullscreen.activated.connect(self.go_fullscreen) ksExitFullscreen = QtWidgets.QShortcut( QtGui.QKeySequence('Escape'), self.contentView) ksExitFullscreen.setContext(QtCore.Qt.ApplicationShortcut) ksExitFullscreen.activated.connect(self.exit_fullscreen) ksToggleBookmarks = QtWidgets.QShortcut( QtGui.QKeySequence('Ctrl+B'), self.contentView) ksToggleBookmarks.activated.connect( lambda: self.toggle_side_dock(0)) # Shortcuts not required for comic view functionality if not self.are_we_doing_images_only: ksToggleAnnotations = QtWidgets.QShortcut( QtGui.QKeySequence('Ctrl+N'), self.contentView) ksToggleAnnotations.activated.connect( lambda: self.toggle_side_dock(1)) ksToggleSearch = QtWidgets.QShortcut( QtGui.QKeySequence('Ctrl+F'), self.contentView) ksToggleSearch.activated.connect( lambda: self.toggle_side_dock(2))