Show a user-facing message instead of a traceback on invalid file type
While our importing dialog limits the types of files that can be selected, users can also import by providing a filename on the command line.
This commit is contained in:
parent
ac1cbaf719
commit
72389b97be
@ -87,3 +87,4 @@ importing-processed-notes =
|
||||
[one] Processed { $count } note...
|
||||
*[other] Processed { $count } notes...
|
||||
}
|
||||
importing-unable-to-import-filename = Unable to import { $filename }: file type not supported
|
||||
|
@ -25,7 +25,11 @@ def import_file(mw: aqt.main.AnkiQt, path: str) -> None:
|
||||
elif filename.endswith(".apkg"):
|
||||
import_anki_package(mw, path)
|
||||
else:
|
||||
raise NotImplementedError
|
||||
showWarning(
|
||||
tr.importing_unable_to_import_filename(filename=filename),
|
||||
parent=mw,
|
||||
textFormat="plain",
|
||||
)
|
||||
|
||||
|
||||
def prompt_for_file_then_import(mw: aqt.main.AnkiQt) -> None:
|
||||
|
Loading…
Reference in New Issue
Block a user