mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
add shortcut to close addcards window (#2031)
This commit is contained in:
parent
e4f1d9952b
commit
65601196ee
2 changed files with 9 additions and 0 deletions
|
@ -21,6 +21,7 @@ from aqt.qt import *
|
|||
from aqt.sound import av_player
|
||||
from aqt.utils import (
|
||||
HelpPage,
|
||||
add_close_shortcut,
|
||||
askUser,
|
||||
downArrow,
|
||||
openHelp,
|
||||
|
@ -48,6 +49,7 @@ class AddCards(QMainWindow):
|
|||
self.setup_choosers()
|
||||
self.setupEditor()
|
||||
self.setupButtons()
|
||||
add_close_shortcut(self)
|
||||
self._load_new_note()
|
||||
self.history: list[NoteId] = []
|
||||
self._last_added_note: Optional[Note] = None
|
||||
|
|
|
@ -848,6 +848,13 @@ def addCloseShortcut(widg: QDialog) -> None:
|
|||
setattr(widg, "_closeShortcut", shortcut)
|
||||
|
||||
|
||||
def add_close_shortcut(widg: QWidget) -> None:
|
||||
if not is_mac:
|
||||
return
|
||||
shortcut = QShortcut(QKeySequence("Ctrl+W"), widg)
|
||||
qconnect(shortcut.activated, widg.close)
|
||||
|
||||
|
||||
def downArrow() -> str:
|
||||
if is_win:
|
||||
return "▼"
|
||||
|
|
Loading…
Reference in a new issue