Python PyQt5.QtCore.Qt.Key_Escape() Examples

The following are 30 code examples of PyQt5.QtCore.Qt.Key_Escape(). 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.QtCore.Qt , or try the search function .
Example #1
Source File: keyutils.py    From qutebrowser with GNU General Public License v3.0 9 votes vote down vote up
def text(self) -> str:
        """Get the text which would be displayed when pressing this key."""
        control = {
            Qt.Key_Space: ' ',
            Qt.Key_Tab: '\t',
            Qt.Key_Backspace: '\b',
            Qt.Key_Return: '\r',
            Qt.Key_Enter: '\r',
            Qt.Key_Escape: '\x1b',
        }

        if self.key in control:
            return control[self.key]
        elif not _is_printable(self.key):
            return ''

        text = QKeySequence(self.key).toString()
        if not self.modifiers & Qt.ShiftModifier:  # type: ignore[operator]
            text = text.lower()
        return text 
Example #2
Source File: main_window.py    From gridsync with GNU General Public License v3.0 8 votes vote down vote up
def keyPressEvent(self, event):
        key = event.key()
        if key in (Qt.Key_Backspace, Qt.Key_Delete):
            view = self.current_view()
            selected = view.selectedIndexes() if view else None
            if selected:
                view.confirm_stop_syncing(view.get_selected_folders())
        if key == Qt.Key_Escape:
            view = self.current_view()
            selected = view.selectedIndexes() if view else None
            if selected:
                for index in selected:
                    view.selectionModel().select(
                        index, QItemSelectionModel.Deselect
                    )
            elif self.gui.systray.isSystemTrayAvailable():
                self.hide() 
Example #3
Source File: settingswindow.py    From bluesky with GNU General Public License v3.0 5 votes vote down vote up
def keyPressEvent(self, event):
        if event.key() == Qt.Key_Escape:
            self.close() 
Example #4
Source File: 猜数游戏.py    From Python-Application with GNU General Public License v3.0 5 votes vote down vote up
def keyPressEvent(self, e):
        # 设置快捷键
        if e.key() == Qt.Key_Return:
            self.guess()
        elif e.key() == Qt.Key_Escape:
            qApp.quit()
        elif e.key() == Qt.Key_R:
            self.reset() 
Example #5
Source File: mainwindow.py    From bluesky with GNU General Public License v3.0 5 votes vote down vote up
def keyPressEvent(self, event):
        if event.modifiers() & Qt.ShiftModifier \
                and event.key() in [Qt.Key_Up, Qt.Key_Down, Qt.Key_Left, Qt.Key_Right]:
            dlat = 1.0 / (self.radarwidget.zoom * self.radarwidget.ar)
            dlon = 1.0 / (self.radarwidget.zoom * self.radarwidget.flat_earth)
            if event.key() == Qt.Key_Up:
                self.radarwidget.panzoom(pan=(dlat, 0.0))
            elif event.key() == Qt.Key_Down:
                self.radarwidget.panzoom(pan=(-dlat, 0.0))
            elif event.key() == Qt.Key_Left:
                self.radarwidget.panzoom(pan=(0.0, -dlon))
            elif event.key() == Qt.Key_Right:
                self.radarwidget.panzoom(pan=(0.0, dlon))

        elif event.key() == Qt.Key_Escape:
            self.closeEvent()

        elif event.key() == Qt.Key_F11:  # F11 = Toggle Full Screen mode
            if not self.isFullScreen():
                self.showFullScreen()
            else:
                self.showNormal()

        else:
            # All other events go to the BlueSky console
            self.console.keyPressEvent(event)
        event.accept() 
Example #6
Source File: infowindow.py    From bluesky with GNU General Public License v3.0 5 votes vote down vote up
def keyPressEvent(self, event):
        if event.key() == Qt.Key_Escape:
            self.close() 
Example #7
Source File: panel_java_explorer.py    From Dwarf with GNU General Public License v3.0 5 votes vote down vote up
def keyPressEvent(self, event): # pylint: disable=invalid-name
        key = event.key()
        if key == Qt.Key_Backspace or key == Qt.Key_Escape:
            self._back()

        return super().keyPressEvent(event) 
Example #8
Source File: kalkulator06a.py    From python101 with MIT License 5 votes vote down vote up
def keyPressEvent(self, e):
        if e.key() == Qt.Key_Escape:
            self.close() 
Example #9
Source File: kalkulator06.py    From python101 with MIT License 5 votes vote down vote up
def keyPressEvent(self, e):
        if e.key() == Qt.Key_Escape:
            self.close() 
Example #10
Source File: kalkulator05.py    From python101 with MIT License 5 votes vote down vote up
def keyPressEvent(self, e):
        if e.key() == Qt.Key_Escape:
            self.close() 
Example #11
Source File: kalkulator04.py    From python101 with MIT License 5 votes vote down vote up
def keyPressEvent(self, e):
        if e.key() == Qt.Key_Escape:
            self.close() 
Example #12
Source File: ocrwidget.py    From lector with GNU General Public License v2.0 5 votes vote down vote up
def keyReleaseEvent(self, event):
        if event.key() == Qt.Key_Delete:
            item = self.scene().focusItem()
            self.scene().removeArea(item)
        #elif event.key() == Qt.Key_Escape:
        #    self.first = True

        QGraphicsView.keyReleaseEvent(self, event) 
Example #13
Source File: share.py    From gridsync with GNU General Public License v3.0 5 votes vote down vote up
def keyPressEvent(self, event):
        if event.key() == Qt.Key_Escape:
            self.close() 
Example #14
Source File: share.py    From gridsync with GNU General Public License v3.0 5 votes vote down vote up
def keyPressEvent(self, event):
        if event.key() == Qt.Key_Escape:
            self.close() 
Example #15
Source File: preferences.py    From gridsync with GNU General Public License v3.0 5 votes vote down vote up
def keyPressEvent(self, event):
        if event.key() == Qt.Key_Escape:
            self.close() 
Example #16
Source File: password.py    From gridsync with GNU General Public License v3.0 5 votes vote down vote up
def keyPressEvent(self, event):
        if event.key() == Qt.Key_Escape:
            self.reject() 
Example #17
Source File: qt5_app.py    From pyopenvr with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def keyPressEvent(self, event):
        "press ESCAPE to quit the application"
        key = event.key()
        if key == Qt.Key_Escape:
            self.app.quit() 
Example #18
Source File: crashdialog.py    From qutebrowser with GNU General Public License v3.0 5 votes vote down vote up
def keyPressEvent(self, e):
        """Prevent closing :report dialogs when pressing <Escape>."""
        if config.val.input.escape_quits_reporter or e.key() != Qt.Key_Escape:
            super().keyPressEvent(e) 
Example #19
Source File: mpvwidget.py    From vidcutter with GNU General Public License v3.0 5 votes vote down vote up
def keyPressEvent(self, event: QKeyEvent) -> None:
        if event.key() in {Qt.Key_F, Qt.Key_Escape}:
            event.accept()
            if self.parent is None:
                self.originalParent.toggleFullscreen()
            else:
                self.parent.toggleFullscreen()
        elif self.isFullScreen():
            self.originalParent.keyPressEvent(event)
        else:
            super(mpvWidget, self).keyPressEvent(event) 
Example #20
Source File: update.py    From persepolis with GNU General Public License v3.0 5 votes vote down vote up
def keyPressEvent(self, event):
        if event.key() == Qt.Key_Escape:
            self.close() 
Example #21
Source File: error_window.py    From persepolis with GNU General Public License v3.0 5 votes vote down vote up
def keyPressEvent(self, event):
        if event.key() == Qt.Key_Escape:
            self.close() 
Example #22
Source File: properties.py    From persepolis with GNU General Public License v3.0 5 votes vote down vote up
def keyPressEvent(self, event):
        if event.key() == Qt.Key_Escape:
            self.close() 
Example #23
Source File: browser_plugin_queue.py    From persepolis with GNU General Public License v3.0 5 votes vote down vote up
def keyPressEvent(self, event):
        if event.key() == Qt.Key_Escape:
            self.close() 
Example #24
Source File: progress.py    From persepolis with GNU General Public License v3.0 5 votes vote down vote up
def keyPressEvent(self, event):
        if event.key() == Qt.Key_Escape:
            self.close() 
Example #25
Source File: addlink.py    From persepolis with GNU General Public License v3.0 5 votes vote down vote up
def keyPressEvent(self, event):
        if event.key() == Qt.Key_Escape:
            self.close()


    # save size and position of window, when user closes the window. 
Example #26
Source File: about.py    From persepolis with GNU General Public License v3.0 5 votes vote down vote up
def keyPressEvent(self, event):
        if event.key() == Qt.Key_Escape:
            self.close() 
Example #27
Source File: log_window.py    From persepolis with GNU General Public License v3.0 5 votes vote down vote up
def keyPressEvent(self, event):
        if event.key() == Qt.Key_Escape:
            self.close() 
Example #28
Source File: video_finder_progress.py    From persepolis with GNU General Public License v3.0 5 votes vote down vote up
def keyPressEvent(self, event):
        if event.key() == Qt.Key_Escape:
            self.close() 
Example #29
Source File: setting.py    From persepolis with GNU General Public License v3.0 5 votes vote down vote up
def keyPressEvent(self, event):
        if event.key() == Qt.Key_Escape:
            self.close() 
Example #30
Source File: text_queue.py    From persepolis with GNU General Public License v3.0 5 votes vote down vote up
def keyPressEvent(self, event):
        if event.key() == Qt.Key_Escape:
            self.close()