Merge pull request #1130 from glutanimate/add-deckchooser-to-addcards-legacy-api
Add AddCards.deckChooser property for legacy add-on support
This commit is contained in:
commit
1648adc126
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
from typing import Callable, List, Optional
|
from typing import Callable, List, Optional
|
||||||
|
|
||||||
import aqt.deckchooser
|
|
||||||
import aqt.editor
|
import aqt.editor
|
||||||
import aqt.forms
|
import aqt.forms
|
||||||
from anki.collection import OpChanges, SearchNode
|
from anki.collection import OpChanges, SearchNode
|
||||||
@ -13,6 +12,7 @@ from anki.models import NotetypeId
|
|||||||
from anki.notes import DuplicateOrEmptyResult, Note, NoteId
|
from anki.notes import DuplicateOrEmptyResult, Note, NoteId
|
||||||
from anki.utils import htmlToTextLine, isMac
|
from anki.utils import htmlToTextLine, isMac
|
||||||
from aqt import AnkiQt, gui_hooks
|
from aqt import AnkiQt, gui_hooks
|
||||||
|
from aqt.deckchooser import DeckChooser
|
||||||
from aqt.notetypechooser import NotetypeChooser
|
from aqt.notetypechooser import NotetypeChooser
|
||||||
from aqt.operations.note import add_note
|
from aqt.operations.note import add_note
|
||||||
from aqt.qt import *
|
from aqt.qt import *
|
||||||
@ -70,7 +70,7 @@ class AddCards(QDialog):
|
|||||||
on_button_activated=self.show_notetype_selector,
|
on_button_activated=self.show_notetype_selector,
|
||||||
on_notetype_changed=self.on_notetype_change,
|
on_notetype_changed=self.on_notetype_change,
|
||||||
)
|
)
|
||||||
self.deck_chooser = aqt.deckchooser.DeckChooser(
|
self.deck_chooser = DeckChooser(
|
||||||
self.mw, self.form.deckArea, starting_deck_id=DeckId(defaults.deck_id)
|
self.mw, self.form.deckArea, starting_deck_id=DeckId(defaults.deck_id)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -272,6 +272,11 @@ class AddCards(QDialog):
|
|||||||
|
|
||||||
# legacy aliases
|
# legacy aliases
|
||||||
|
|
||||||
|
@property
|
||||||
|
def deckChooser(self) -> DeckChooser:
|
||||||
|
print("deckChooser is deprecated; use deck_chooser instead")
|
||||||
|
return self.deck_chooser
|
||||||
|
|
||||||
addCards = add_current_note
|
addCards = add_current_note
|
||||||
_addCards = _add_current_note
|
_addCards = _add_current_note
|
||||||
onModelChange = on_notetype_change
|
onModelChange = on_notetype_change
|
||||||
|
Loading…
Reference in New Issue
Block a user