How to use the aqt.mw.pm.addonFolder 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 baitisj / anki-voice-control / module / voice_control / voice_control.py View on Github external
def initSphynx(self):
    addons = mw.pm.addonFolder()
    self.file_language_model = os.path.join(addons,'voice_control','anki.lm')
    self.file_dictionary     = os.path.join(addons,'voice_control','anki.dic')
    self.init_actions()
github sth2018 / FastWordQuery / addons / fastwq / libs / ankihub.py View on Github external
def installZipFile(data, fname):
    base = mw.pm.addonFolder()#os.path.join(defaultBase(),'addons')
    if fname.endswith(".py"):
        path = os.path.join(base, fname)
        with open(path, "wb") as file:
            file.write(data)
            file.close()
        return True
    # .zip file
    try:
        z = zipfile.ZipFile(io.BytesIO(data))
    except zipfile.BadZipfile:
        return False
    for n in z.namelist():
        if n.endswith("/"):
            # folder; ignore
            continue
        # write
github sth2018 / FastWordQuery / addons / fastwq / libs / ankihub.py View on Github external
def defaultBase():
    path = mw.pm.addonFolder()
    return os.path.dirname(os.path.abspath(path))
github ospalh / anki-addons / metric_time.py View on Github external
from aqt import mw  # We need this early to get to the path

# These *are* available with standard Anki
import math
import os
import sys

from anki import utils, sched, stats
from anki.lang import _
# To override fmtTimeSpan that are already loaded:
from aqt import browser, deckbrowser, reviewer

# Now add the path, but only once. (Other add-ons by YT contain
# similar code.)
if not [pe for pe in sys.path if 'batteries' in pe]:
    sys.path.append(os.path.join(mw.pm.addonFolder(), "batteries"))

# Now this should work. Include module to deal with numbers digit by
# digit.
from decimal import Decimal

"""Replace time values with just days or years."""

__version__ = "1.0.1"

day_format_separators = {-1: u'.', -3: u"’", -4: u"’", -6: u"’"}
# Year length taken from Wikipedia's tropical year article as "mean
# tropical year current value"
year = 365.2421897
# NIST value for tropical year
# year = 3.155693E+07 / 86400.0
# which is 5.567e-05 days or 4.81s longer
github sth2018 / FastWordQuery / addons21 / fastwq / libs / ankihub.py View on Github external
def defaultBase():
    path = mw.pm.addonFolder()
    return os.path.dirname(os.path.abspath(path))
github fanatic84 / KanjiKeywordOverlay / KanjiOverlay.py View on Github external
def getConfigFilePathName(self):
        return os.path.join(mw.pm.addonFolder(), 'kol', KolConfig.CONFIGFILENAME)
github luoliyan / chinese-support-redux / chinese / pinyin.py View on Github external
def __init__(self):
        # N.B. This assumes that type is either 'cantonese' or
        # 'mandarin'.
        readings_file_name = os.path.join(mw.pm.addonFolder(), 'chinese',
                                          type + '_readings.json')
        self.readings = json.load(open(readings_file_name))
github fanatic84 / KanjiKeywordOverlay / kol / src / KolOverlay.py View on Github external
def __setupObjectData(self):
        self.kanjiDefaultDictPath = os.path.join(mw.pm.addonFolder(), "kol", "data", "english.db")
        self.kanjiCustomDictPath = os.path.join(mw.pm.profileFolder(), "kol", "user_files", "custom-kol.db")

        self.cssFileInPlugin = os.path.join(mw.pm.addonFolder(), "kol", "data", "styles.css")
        self.cssFileUserFiles = os.path.join(mw.pm.addonFolder(), "kol", "user_files", "styles.css")

        self.scriptsFileInPlugin = os.path.join(mw.pm.addonFolder(), "kol", "data", "scripts.js")
        self.scriptsFileUserFiles = os.path.join(mw.pm.addonFolder(), "kol", "user_files", "scripts.js")

        self.templateInPlugin = os.path.join(mw.pm.addonFolder(), "kol", "data", "template.hbs")
        self.templateUserFiles = os.path.join(mw.pm.addonFolder(), "kol", "user_files", "template.hbs")