aqt.exporter takes extra argument cid

This commit is contained in:
Arthur Milchior 2020-02-08 22:37:50 -08:00
parent af26922493
commit d8669835d8
2 changed files with 5 additions and 3 deletions

View File

@ -8,7 +8,7 @@ import shutil
import unicodedata import unicodedata
import zipfile import zipfile
from io import BufferedWriter from io import BufferedWriter
from typing import Any, Dict, List, Tuple, Union from typing import Any, Dict, List, Optional, Tuple, Union
from zipfile import ZipFile from zipfile import ZipFile
from anki import hooks from anki import hooks

View File

@ -4,6 +4,7 @@
import os import os
import re import re
import time import time
from typing import List, Optional
import aqt import aqt
from anki import hooks from anki import hooks
@ -14,17 +15,18 @@ from aqt.utils import checkInvalidFilename, getSaveFile, showInfo, showWarning,
class ExportDialog(QDialog): class ExportDialog(QDialog):
def __init__(self, mw, did=None): def __init__(self, mw, did: Optional[int] = None, cids: Optional[List[int]] = None):
QDialog.__init__(self, mw, Qt.Window) QDialog.__init__(self, mw, Qt.Window)
self.mw = mw self.mw = mw
self.col = mw.col self.col = mw.col
self.frm = aqt.forms.exporting.Ui_ExportDialog() self.frm = aqt.forms.exporting.Ui_ExportDialog()
self.frm.setupUi(self) self.frm.setupUi(self)
self.exporter = None self.exporter = None
self.cids = cids
self.setup(did) self.setup(did)
self.exec_() self.exec_()
def setup(self, did): def setup(self, did: Optional[int]):
self.exporters = exporters() self.exporters = exporters()
# if a deck specified, start with .apkg type selected # if a deck specified, start with .apkg type selected
idx = 0 idx = 0