mirror of
https://github.com/ankitects/anki.git
synced 2025-11-07 05:07:10 -05:00
option to edit current card's config
This commit is contained in:
parent
c1a16452d6
commit
05684b5575
3 changed files with 17 additions and 6 deletions
|
|
@ -9,10 +9,10 @@ from aqt.utils import showInfo, showWarning, openHelp, getOnlyText
|
|||
from operator import itemgetter
|
||||
|
||||
class DeckConf(QDialog):
|
||||
def __init__(self, mw):
|
||||
def __init__(self, mw, deck):
|
||||
QDialog.__init__(self, mw)
|
||||
self.mw = mw
|
||||
self.deck = self.mw.col.decks.current()
|
||||
self.deck = deck
|
||||
self.form = aqt.forms.dconf.Ui_Dialog()
|
||||
self.form.setupUi(self)
|
||||
self.mw.checkpoint(_("Options"))
|
||||
|
|
|
|||
|
|
@ -672,13 +672,15 @@ Debug info:\n%s""") % traceback.format_exc(), help="DeckErrors")
|
|||
import aqt.stats
|
||||
self.cardStats = aqt.stats.CardStats(self)
|
||||
|
||||
def onDeckConf(self):
|
||||
if self.col.decks.current()['dyn']:
|
||||
def onDeckConf(self, deck=None):
|
||||
if not deck:
|
||||
deck = self.col.decks.current()
|
||||
if deck['dyn']:
|
||||
import aqt.dyndeckconf
|
||||
aqt.dyndeckconf.DeckConf(self)
|
||||
else:
|
||||
import aqt.deckconf
|
||||
aqt.deckconf.DeckConf(self)
|
||||
aqt.deckconf.DeckConf(self, deck)
|
||||
|
||||
def onOverview(self):
|
||||
self.col.reset()
|
||||
|
|
|
|||
|
|
@ -220,6 +220,8 @@ function _typeAnsPress() {
|
|||
self.mw.onBuryNote()
|
||||
elif key == "=":
|
||||
self.mw.onSuspend()
|
||||
elif key == "o":
|
||||
self.onOptions()
|
||||
elif key in ("1", "2", "3", "4"):
|
||||
self._answerCard(int(key))
|
||||
elif evt.key() == Qt.Key_Delete:
|
||||
|
|
@ -566,13 +568,15 @@ Card was a <a href="%s">leech</a>.""") % link)
|
|||
# Context menu
|
||||
##########################################################################
|
||||
|
||||
# note the shortcuts listed here also need to be defined above
|
||||
def showContextMenu(self):
|
||||
opts = [
|
||||
[_("Replay Audio"), "r", self.replayAudio],
|
||||
[_("Mark Note"), "*", self.mw.onMark],
|
||||
[_("Bury Note"), "-", self.mw.onBuryNote],
|
||||
[_("Suspend Note"), "=", self.mw.onSuspend],
|
||||
[_("Delete Note"), "Delete", self.mw.onDelete]
|
||||
[_("Delete Note"), "Delete", self.mw.onDelete],
|
||||
[_("Card Options"), "o", self.onOptions]
|
||||
]
|
||||
m = QMenu(self.mw)
|
||||
for label, scut, func in opts:
|
||||
|
|
@ -580,3 +584,8 @@ Card was a <a href="%s">leech</a>.""") % link)
|
|||
a.setShortcut(QKeySequence(scut))
|
||||
a.connect(a, SIGNAL("triggered()"), func)
|
||||
m.exec_(QCursor.pos())
|
||||
|
||||
def onOptions(self):
|
||||
self.mw.onDeckConf(self.mw.col.decks.get(
|
||||
self.card.odid or self.card.did))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue