mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00
fix adding deck configs
This commit is contained in:
parent
ec6c0f86fb
commit
c023bdd78e
1 changed files with 5 additions and 4 deletions
|
@ -1,8 +1,9 @@
|
||||||
# Copyright: Ankitects Pty Ltd and contributors
|
# Copyright: Ankitects Pty Ltd and contributors
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
from typing import Union
|
from typing import Dict, Union
|
||||||
|
|
||||||
import aqt
|
import aqt
|
||||||
from anki.consts import NEW_CARDS_RANDOM
|
from anki.consts import NEW_CARDS_RANDOM
|
||||||
|
@ -22,7 +23,7 @@ from aqt.utils import (
|
||||||
|
|
||||||
|
|
||||||
class DeckConf(QDialog):
|
class DeckConf(QDialog):
|
||||||
def __init__(self, mw, deck):
|
def __init__(self, mw: aqt.AnkiQt, deck: Dict):
|
||||||
QDialog.__init__(self, mw)
|
QDialog.__init__(self, mw)
|
||||||
self.mw = mw
|
self.mw = mw
|
||||||
self.deck = deck
|
self.deck = deck
|
||||||
|
@ -117,14 +118,14 @@ class DeckConf(QDialog):
|
||||||
txt = ""
|
txt = ""
|
||||||
self.form.count.setText(txt)
|
self.form.count.setText(txt)
|
||||||
|
|
||||||
def addGroup(self):
|
def addGroup(self) -> None:
|
||||||
name = getOnlyText(_("New options group name:"))
|
name = getOnlyText(_("New options group name:"))
|
||||||
if not name:
|
if not name:
|
||||||
return
|
return
|
||||||
# first, save currently entered data to current conf
|
# first, save currently entered data to current conf
|
||||||
self.saveConf()
|
self.saveConf()
|
||||||
# then clone the conf
|
# then clone the conf
|
||||||
id = self.mw.col.decks.add_config_returning_id(name, cloneFrom=self.conf)
|
id = self.mw.col.decks.add_config_returning_id(name, clone_from=self.conf)
|
||||||
# set the deck to the new conf
|
# set the deck to the new conf
|
||||||
self.deck["conf"] = id
|
self.deck["conf"] = id
|
||||||
# then reload the conf list
|
# then reload the conf list
|
||||||
|
|
Loading…
Reference in a new issue