mirror of
https://github.com/ankitects/anki.git
synced 2025-11-06 12:47:11 -05:00
fix shared deck conf warning
This commit is contained in:
parent
b9b837e7bd
commit
252eb3a444
2 changed files with 6 additions and 13 deletions
|
|
@ -63,9 +63,6 @@ class DeckManager:
|
|||
def __init__(self, col: anki.storage._Collection) -> None:
|
||||
self.col = col.weakref()
|
||||
self.decks = DecksDictProxy(col)
|
||||
# do not access this directly!
|
||||
# self._cache: Dict[int, ] = {}
|
||||
# self.decks = {}
|
||||
|
||||
def save(self, g: Dict = None) -> None:
|
||||
"Can be called with either a deck or a deck configuration."
|
||||
|
|
@ -78,8 +75,6 @@ class DeckManager:
|
|||
self.update_config(g)
|
||||
return
|
||||
else:
|
||||
# g["mod"] = intTime()
|
||||
# g["usn"] = self.col.usn()
|
||||
self.update(g)
|
||||
|
||||
# legacy
|
||||
|
|
@ -396,10 +391,9 @@ class DeckManager:
|
|||
grp["conf"] = id
|
||||
self.save(grp)
|
||||
|
||||
# fixme: expensive
|
||||
def didsForConf(self, conf) -> List:
|
||||
dids = []
|
||||
for deck in list(self.decks.values()):
|
||||
for deck in self.all():
|
||||
if "conf" in deck and deck["conf"] == conf["id"]:
|
||||
dids.append(deck["id"])
|
||||
return dids
|
||||
|
|
@ -483,6 +477,9 @@ class DeckManager:
|
|||
def update_active(self):
|
||||
self.select(self.current()["id"])
|
||||
|
||||
# Parents/children
|
||||
#############################################################
|
||||
|
||||
def children(self, did: int) -> List[Tuple[Any, Any]]:
|
||||
"All children of did, as (name, id)."
|
||||
name = self.get(did)["name"]
|
||||
|
|
|
|||
|
|
@ -103,13 +103,9 @@ class DeckConf(QDialog):
|
|||
self.saveConf()
|
||||
conf = self.confList[idx]
|
||||
self.deck["conf"] = conf["id"]
|
||||
self.mw.col.decks.save(self.deck)
|
||||
self.loadConf()
|
||||
cnt = 0
|
||||
for d in self.mw.col.decks.all():
|
||||
if d["dyn"]:
|
||||
continue
|
||||
if d["conf"] == conf["id"]:
|
||||
cnt += 1
|
||||
cnt = len(self.mw.col.decks.didsForConf(conf))
|
||||
if cnt > 1:
|
||||
txt = _(
|
||||
"Your changes will affect multiple decks. If you wish to "
|
||||
|
|
|
|||
Loading…
Reference in a new issue