fix incorrect constant naming
This commit is contained in:
parent
64bb526008
commit
bc2c3a57ba
@ -33,8 +33,8 @@ DeckConfigDict = Dict[str, Any]
|
|||||||
DeckID = NewType("DeckID", int)
|
DeckID = NewType("DeckID", int)
|
||||||
DeckConfID = NewType("DeckConfID", int)
|
DeckConfID = NewType("DeckConfID", int)
|
||||||
|
|
||||||
default_deck_id = DeckID(1)
|
DEFAULT_DECK_ID = DeckID(1)
|
||||||
default_deck_conf_id = DeckConfID(1)
|
DEFAULT_DECK_CONF_ID = DeckConfID(1)
|
||||||
|
|
||||||
|
|
||||||
class DecksDictProxy:
|
class DecksDictProxy:
|
||||||
@ -252,7 +252,7 @@ class DeckManager:
|
|||||||
def get(self, did: Union[DeckID, str], default: bool = True) -> Optional[DeckDict]:
|
def get(self, did: Union[DeckID, str], default: bool = True) -> Optional[DeckDict]:
|
||||||
if not did:
|
if not did:
|
||||||
if default:
|
if default:
|
||||||
return self.get_legacy(default_deck_id)
|
return self.get_legacy(DEFAULT_DECK_ID)
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
id = DeckID(int(did))
|
id = DeckID(int(did))
|
||||||
@ -260,7 +260,7 @@ class DeckManager:
|
|||||||
if deck:
|
if deck:
|
||||||
return deck
|
return deck
|
||||||
elif default:
|
elif default:
|
||||||
return self.get_legacy(default_deck_id)
|
return self.get_legacy(DEFAULT_DECK_ID)
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -324,7 +324,7 @@ class DeckManager:
|
|||||||
conf = self.get_config(dcid)
|
conf = self.get_config(dcid)
|
||||||
if not conf:
|
if not conf:
|
||||||
# fall back on default
|
# fall back on default
|
||||||
conf = self.get_config(default_deck_conf_id)
|
conf = self.get_config(DEFAULT_DECK_CONF_ID)
|
||||||
conf["dyn"] = False
|
conf["dyn"] = False
|
||||||
return conf
|
return conf
|
||||||
# dynamic decks have embedded conf
|
# dynamic decks have embedded conf
|
||||||
@ -586,7 +586,7 @@ class DeckManager:
|
|||||||
|
|
||||||
def new_filtered(self, name: str) -> DeckID:
|
def new_filtered(self, name: str) -> DeckID:
|
||||||
"Return a new dynamic deck and set it as the current deck."
|
"Return a new dynamic deck and set it as the current deck."
|
||||||
did = self.id(name, type=default_deck_conf_id)
|
did = self.id(name, type=DEFAULT_DECK_CONF_ID)
|
||||||
self.select(did)
|
self.select(did)
|
||||||
return did
|
return did
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ class Note:
|
|||||||
) -> anki.cards.Card:
|
) -> anki.cards.Card:
|
||||||
card = anki.cards.Card(self.col)
|
card = anki.cards.Card(self.col)
|
||||||
card.ord = ord
|
card.ord = ord
|
||||||
card.did = anki.decks.default_deck_id
|
card.did = anki.decks.DEFAULT_DECK_ID
|
||||||
|
|
||||||
model = custom_note_type or self.model()
|
model = custom_note_type or self.model()
|
||||||
template = copy.copy(
|
template = copy.copy(
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from anki.decks import DeckID, default_deck_id
|
from anki.decks import DEFAULT_DECK_ID, DeckID
|
||||||
from aqt import AnkiQt
|
from aqt import AnkiQt
|
||||||
from aqt.qt import *
|
from aqt.qt import *
|
||||||
from aqt.utils import TR, HelpPage, shortcut, tr
|
from aqt.utils import TR, HelpPage, shortcut, tr
|
||||||
@ -71,7 +71,7 @@ class DeckChooser(QHBoxLayout):
|
|||||||
|
|
||||||
def _ensure_selected_deck_valid(self) -> None:
|
def _ensure_selected_deck_valid(self) -> None:
|
||||||
if not self.mw.col.decks.get(self._selected_deck_id, default=False):
|
if not self.mw.col.decks.get(self._selected_deck_id, default=False):
|
||||||
self.selected_deck_id = default_deck_id
|
self.selected_deck_id = DEFAULT_DECK_ID
|
||||||
|
|
||||||
def _update_button_label(self) -> None:
|
def _update_button_label(self) -> None:
|
||||||
self.deck.setText(self.selected_deck_name().replace("&", "&&"))
|
self.deck.setText(self.selected_deck_name().replace("&", "&&"))
|
||||||
|
Loading…
Reference in New Issue
Block a user