_basename used where possible
This commit is contained in:
parent
69a9425cd0
commit
5315b717c0
@ -126,7 +126,7 @@ class DeckManager:
|
||||
# child of an existing deck then it needs to be renamed
|
||||
deck = self.get(did)
|
||||
if "::" in deck["name"]:
|
||||
base = self.path(deck["name"])[-1]
|
||||
base = self._basename(deck["name"])
|
||||
suffix = ""
|
||||
while True:
|
||||
# find an unused name
|
||||
@ -296,8 +296,9 @@ class DeckManager:
|
||||
|
||||
_path = path
|
||||
|
||||
def _basename(self, name: str) -> Any:
|
||||
return self.path(name)[-1]
|
||||
@classmethod
|
||||
def _basename(cls, name: str) -> Any:
|
||||
return cls.path(name)[-1]
|
||||
|
||||
@classmethod
|
||||
def key(cls, deck: Dict[str, Any]) -> List[str]:
|
||||
|
@ -154,7 +154,7 @@ def fields_for_rendering(
|
||||
fields["Tags"] = note.stringTags().strip()
|
||||
fields["Type"] = card.note_type()["name"]
|
||||
fields["Deck"] = col.decks.name(card.odid or card.did)
|
||||
fields["Subdeck"] = DeckManager.path(fields["Deck"])[-1]
|
||||
fields["Subdeck"] = DeckManager._basename(fields["Deck"])
|
||||
fields["Card"] = card.template()["name"]
|
||||
flag = card.userFlag()
|
||||
fields["CardFlag"] = flag and f"flag{flag}" or ""
|
||||
|
@ -1303,7 +1303,7 @@ QTableView {{ gridline-color: {grid} }}
|
||||
def addDecks(parent, decks):
|
||||
for head, did, rev, lrn, new, children in decks:
|
||||
name = self.mw.col.decks.get(did)["name"]
|
||||
shortname = DeckManager.path(name)[-1]
|
||||
shortname = DeckManager._basename(name)
|
||||
if children:
|
||||
subm = parent.addMenu(shortname)
|
||||
subm.addItem(_("Filter"), self._filterFunc("deck", name))
|
||||
|
Loading…
Reference in New Issue
Block a user