How to use the aqt.mw.addonManager function in aqt

To help you get started, we’ve selected a few aqt examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gregorrr / anki-auto-markdown / auto_markdown / config.py View on Github external
def getConfig():
    return mw.addonManager.getConfig(__name__)
github Arthur-Milchior / anki-enhance-main-window / config.py View on Github external
def getUserOption(key=None, default=None):
    global userOption
    if userOption is None:
        userOption = mw.addonManager.getConfig(__name__)
    if key is None:
        return userOption
    if key in userOption:
        return userOption[key]
    else:
        userOption[key] = default
        writeConfig()
        return default
github cayennes / kanji-colorize / anki / kanji_colorizer.py View on Github external
#
# To add diagrams to all such fields, or regenerate them with new
# settings, use the "Kanji Colorizer: (re)generate all" option in the
# tools menu.


from anki.hooks import addHook
from aqt import mw
from aqt.utils import showInfo, askUser
from aqt.qt import *
from .kanjicolorizer.colorizer import (KanjiVG, KanjiColorizer,
                                      InvalidCharacterError)

# Configuration

addon_config = mw.addonManager.getConfig(__name__)

config = "--mode "
config += addon_config["mode"]
if addon_config["group-mode"]:
  config += " --group-mode "
config += " --saturation "
config += str(addon_config["saturation"])
config += " --value "
config += str(addon_config["value"])
config += " --image-size "
config += str(addon_config["image-size"])

modelNameSubstring = 'japanese'
srcField           = 'Kanji'
dstField           = 'Diagram'
github fanatic84 / KanjiKeywordOverlay / kol / src / KolConfigsManager.py View on Github external
def __loadConfigsFromFs(self):
        config = mw.addonManager.getConfig(__name__)
        kolConfigs = KolConfigs(profiles=config['profiles'], version=config['version'])
        return kolConfigs
github ssricardo / anki-plugins / fill-the-blanks / src / controller.py View on Github external
def _ankiConfigRead(key):
    return mw.addonManager.getConfig(__name__)[key]
github megachweng / Dict2Anki / src / addonWindow.py View on Github external
def config(self):
        if not self._config:
            self._config = mw.addonManager.getConfig(__name__)
        return self._config
github gmcmanus / anki-kindle-highlights-import / kindle_highlights_import / __init__.py View on Github external
with open(path, encoding='utf-8') as file:
        lower_path = path.lower()
        if lower_path.endswith('txt'):
            clippings, bad_clippings = parse_text_clippings(file)
        elif lower_path.endswith('html'):
            clippings, bad_clippings = parse_html_clippings(file)
        else:
            raise RuntimeError(f'Unknown extension in path: {path!r}')

    if bad_clippings:
        showText(
            f'The following {len(bad_clippings)} clippings could not be parsed:\n\n' +
            '\n==========\n'.join(bad_clippings))

    config = mw.addonManager.getConfig(__name__)

    highlight_clippings = list(highlights_only(clippings))
    clippings_to_add = after_last_added(highlight_clippings, last_added_datetime(config))

    num_added = 0
    last_added = None

    user_files_path = os.path.join(mw.addonManager.addonsFolder(__name__), 'user_files')
    os.makedirs(user_files_path, exist_ok=True)

    added_highlights_path = os.path.join(user_files_path, 'added_highlights.json')

    if os.path.isfile(added_highlights_path):
        with open(added_highlights_path, encoding='utf-8') as added_highlights_file:
            added_highlights = json.load(added_highlights_file)
    else:
github luoliyan / incremental-reading / ir / main.py View on Github external
def onProfileLoaded(self):
        self.settings = SettingsManager()
        mw.addonManager.setConfigAction(
            __name__, lambda: SettingsDialog(self.settings)
        )
        self.importer.settings = self.settings
        self.scheduler.settings = self.settings
        self.textManager.settings = self.settings
        self.viewManager.settings = self.settings
        self.viewManager.resetZoom('deckBrowser')
        self.addModel()
        self.loadMenuItems()
        self.shortcuts = [
            ('Down', self.viewManager.lineDown),
            ('PgDown', self.viewManager.pageDown),
            ('PgUp', self.viewManager.pageUp),
            ('Up', self.viewManager.lineUp),
            (self.settings['extractKey'], self.textManager.extract),
            (self.settings['highlightKey'], self.textManager.highlight),