mirror of
https://github.com/ankitects/anki.git
synced 2025-11-12 07:37:11 -05:00
add cmd+w shortcut to add cards window & stats window
This commit is contained in:
parent
551c1cf662
commit
b84681c2fe
3 changed files with 11 additions and 2 deletions
|
|
@ -9,7 +9,7 @@ import anki
|
||||||
from anki.errors import *
|
from anki.errors import *
|
||||||
from anki.utils import stripHTML
|
from anki.utils import stripHTML
|
||||||
from aqt.utils import saveGeom, restoreGeom, showWarning, askUser, shortcut, \
|
from aqt.utils import saveGeom, restoreGeom, showWarning, askUser, shortcut, \
|
||||||
tooltip, openHelp
|
tooltip, openHelp, addCloseShortcut
|
||||||
from anki.sound import clearAudioQueue
|
from anki.sound import clearAudioQueue
|
||||||
from anki.hooks import addHook, remHook
|
from anki.hooks import addHook, remHook
|
||||||
from anki.utils import stripHTMLMedia, isMac
|
from anki.utils import stripHTMLMedia, isMac
|
||||||
|
|
@ -34,6 +34,7 @@ class AddCards(QDialog):
|
||||||
restoreGeom(self, "add")
|
restoreGeom(self, "add")
|
||||||
addHook('reset', self.onReset)
|
addHook('reset', self.onReset)
|
||||||
addHook('currentModelChanged', self.onReset)
|
addHook('currentModelChanged', self.onReset)
|
||||||
|
addCloseShortcut(self)
|
||||||
self.show()
|
self.show()
|
||||||
self.setupNewNote()
|
self.setupNewNote()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from aqt.qt import *
|
||||||
import os, time
|
import os, time
|
||||||
from aqt.webview import AnkiWebView
|
from aqt.webview import AnkiWebView
|
||||||
from aqt.utils import saveGeom, restoreGeom, maybeHideClose, openFolder, \
|
from aqt.utils import saveGeom, restoreGeom, maybeHideClose, openFolder, \
|
||||||
showInfo
|
showInfo, addCloseShortcut
|
||||||
from anki.utils import namedtmp
|
from anki.utils import namedtmp
|
||||||
from anki.hooks import addHook
|
from anki.hooks import addHook
|
||||||
import aqt
|
import aqt
|
||||||
|
|
@ -42,6 +42,7 @@ class DeckStats(QDialog):
|
||||||
c(f.life, s, lambda: self.changePeriod(2))
|
c(f.life, s, lambda: self.changePeriod(2))
|
||||||
c(f.web, SIGNAL("loadFinished(bool)"), self.loadFin)
|
c(f.web, SIGNAL("loadFinished(bool)"), self.loadFin)
|
||||||
maybeHideClose(self.form.buttonBox)
|
maybeHideClose(self.form.buttonBox)
|
||||||
|
addCloseShortcut(self)
|
||||||
self.refresh()
|
self.refresh()
|
||||||
self.exec_()
|
self.exec_()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -358,6 +358,13 @@ def maybeHideClose(bbox):
|
||||||
if b:
|
if b:
|
||||||
bbox.removeButton(b)
|
bbox.removeButton(b)
|
||||||
|
|
||||||
|
def addCloseShortcut(widg):
|
||||||
|
if not isMac:
|
||||||
|
return
|
||||||
|
widg._closeShortcut = QShortcut(QKeySequence("Ctrl+W"), widg)
|
||||||
|
widg.connect(widg._closeShortcut, SIGNAL("activated()"),
|
||||||
|
widg, SLOT("reject()"))
|
||||||
|
|
||||||
# Tooltips
|
# Tooltips
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue