mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
NF: currentDeckID factorize odid or did
This commit is contained in:
parent
986efeed19
commit
3b6802530d
4 changed files with 10 additions and 7 deletions
|
@ -163,21 +163,24 @@ class Card:
|
||||||
def startTimer(self) -> None:
|
def startTimer(self) -> None:
|
||||||
self.timerStarted = time.time()
|
self.timerStarted = time.time()
|
||||||
|
|
||||||
|
def currentDeckID(self) -> int:
|
||||||
|
return anki.decks.DeckID(self.odid or self.did)
|
||||||
|
|
||||||
def timeLimit(self) -> int:
|
def timeLimit(self) -> int:
|
||||||
"Time limit for answering in milliseconds."
|
"Time limit for answering in milliseconds."
|
||||||
conf = self.col.decks.confForDid(self.odid or self.did)
|
conf = self.col.decks.confForDid(self.currentDeckID())
|
||||||
return conf["maxTaken"] * 1000
|
return conf["maxTaken"] * 1000
|
||||||
|
|
||||||
def shouldShowTimer(self) -> bool:
|
def shouldShowTimer(self) -> bool:
|
||||||
conf = self.col.decks.confForDid(self.odid or self.did)
|
conf = self.col.decks.confForDid(self.currentDeckID())
|
||||||
return conf["timer"]
|
return conf["timer"]
|
||||||
|
|
||||||
def replay_question_audio_on_answer_side(self) -> bool:
|
def replay_question_audio_on_answer_side(self) -> bool:
|
||||||
conf = self.col.decks.confForDid(self.odid or self.did)
|
conf = self.col.decks.confForDid(self.currentDeckID())
|
||||||
return conf.get("replayq", True)
|
return conf.get("replayq", True)
|
||||||
|
|
||||||
def autoplay(self) -> bool:
|
def autoplay(self) -> bool:
|
||||||
return self.col.decks.confForDid(self.odid or self.did)["autoplay"]
|
return self.col.decks.confForDid(self.currentDeckID())["autoplay"]
|
||||||
|
|
||||||
def timeTaken(self) -> int:
|
def timeTaken(self) -> int:
|
||||||
"Time taken to answer card, in integer MS."
|
"Time taken to answer card, in integer MS."
|
||||||
|
|
|
@ -398,7 +398,7 @@ class Collection:
|
||||||
or current notetype.
|
or current notetype.
|
||||||
"""
|
"""
|
||||||
if card := current_review_card:
|
if card := current_review_card:
|
||||||
home_deck = card.odid or card.did
|
home_deck = card.currentDeckID()
|
||||||
else:
|
else:
|
||||||
home_deck = 0
|
home_deck = 0
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,7 @@ class TemplateRenderContext:
|
||||||
# add (most) special fields
|
# add (most) special fields
|
||||||
fields["Tags"] = self._note.stringTags().strip()
|
fields["Tags"] = self._note.stringTags().strip()
|
||||||
fields["Type"] = self._note_type["name"]
|
fields["Type"] = self._note_type["name"]
|
||||||
fields["Deck"] = self._col.decks.name(self._card.odid or self._card.did)
|
fields["Deck"] = self._col.decks.name(self._card.currentDeckID())
|
||||||
fields["Subdeck"] = DeckManager.basename(fields["Deck"])
|
fields["Subdeck"] = DeckManager.basename(fields["Deck"])
|
||||||
if self._template:
|
if self._template:
|
||||||
fields["Card"] = self._template["name"]
|
fields["Card"] = self._template["name"]
|
||||||
|
|
|
@ -834,7 +834,7 @@ time = %(time)d;
|
||||||
qconnect(a.triggered, func)
|
qconnect(a.triggered, func)
|
||||||
|
|
||||||
def onOptions(self) -> None:
|
def onOptions(self) -> None:
|
||||||
self.mw.onDeckConf(self.mw.col.decks.get(self.card.odid or self.card.did))
|
self.mw.onDeckConf(self.mw.col.decks.get(self.card.currentDeckID()))
|
||||||
|
|
||||||
def set_flag_on_current_card(self, desired_flag: int) -> None:
|
def set_flag_on_current_card(self, desired_flag: int) -> None:
|
||||||
# need to toggle off?
|
# need to toggle off?
|
||||||
|
|
Loading…
Reference in a new issue