aqt#

Submodules#

Attributes#

Classes#

Functions#

setupLangAndBackend(→ anki._backend.RustBackend)

parseArgs(→ tuple[argparse.Namespace, list[str]])

Returns (opts, args).

shift_held_before_app(→ bool)

Check whether Shift is held, without needing a QApplication.

setupGL(→ None)

write_profile_results(→ None)

run(→ None)

Package Contents#

aqt.appVersion#
aqt.appWebsite = 'https://apps.ankiweb.net/'#
aqt.appWebsiteDownloadSection = 'https://apps.ankiweb.net/#download'#
aqt.appDonate = 'https://docs.ankiweb.net/manual/contrib'#
aqt.appShared = 'https://ankiweb.net/shared/'#
aqt.appUpdate = 'https://ankiweb.net/update/desktop'#
aqt.appHelpSite = 'https://docs.ankiweb.net/manual/'#
aqt.profiler: cProfile.Profile | None = None#
aqt.mw: main.AnkiQt = None#
class aqt.DialogManager#
open(name: str, *args: Any, **kwargs: Any) → Any#
activeWindow() → QWidget#
getInstance(name: str)#
markClosed(name: str) → None#
allClosed() → bool#
closeAll(onsuccess: collections.abc.Callable[[], None]) → bool | None#
register_dialog(name: str, creator: collections.abc.Callable | type, instance: Any | None = None) → None#

Allows add-ons to register a custom dialog to be managed by Anki’s dialog manager, which ensures that only one copy of the window is open at once, and that the dialog cleans up asynchronously when the collection closes

Please note that dialogs added in this manner need to define a close behavior by either:

  • setting dialog.silentlyClose = True to have it close immediately

  • define a dialog.closeWithCallback() method that is called when closed by the dialog manager

TODO?: Implement more restrictive type check to ensure these requirements are met

Arguments:

name {str} – Name/identifier of the dialog in question creator {Union[Callable, type]} – A class or function to create new

dialog instances with

Keyword Arguments:
instance {Optional[Any]} – An optional existing instance of the dialog

(default: {None})

aqt.dialogs#
aqt.setupLangAndBackend(pm: profiles.ProfileManager, app: QApplication, force: str | None = None, firstTime: bool = False) → anki._backend.RustBackend#
class aqt.NativeEventFilter#

Bases: QAbstractNativeEventFilter

nativeEventFilter(eventType: Any, message: Any) → tuple[bool, qt.sip.voidptr]#
class aqt.AnkiApp(argv: list[str], force_safemode: bool = False)#

Bases: QApplication

appMsg#
KEY#
TMOUT = 30000#
safeMode#
secondInstance() → bool#
sendMsg(txt: str) → bool#
onRecv() → None#
event(evt: QEvent | None) → bool#
eventFilter(src: Any, evt: QEvent | None) → bool#
aqt.parseArgs(argv: list[str]) → tuple[argparse.Namespace, list[str]]#

Returns (opts, args).

aqt.shift_held_before_app() → bool#

Check whether Shift is held, without needing a QApplication.

Some video driver settings must be applied before the app is created, but QGuiApplication.queryKeyboardModifiers() only works once it exists. Returns False on platforms where this isn’t implemented, or if the check fails.

aqt.setupGL(pm: profiles.ProfileManager, driver: profiles.VideoDriver | None = None) → None#
aqt.PROFILE_CODE#
aqt.write_profile_results() → None#
aqt.run() → None#