Skip to content

Commit

Permalink
Move add-on properties into global ADDON namespace
Browse files Browse the repository at this point in the history
Following suite with latest libaddon changes
  • Loading branch information
glutanimate committed Aug 10, 2019
1 parent 0c856f0 commit 7ed63c0
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 82 deletions.
22 changes: 21 additions & 1 deletion src/cloze_overlapper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,24 @@

from ._version import __version__ # noqa: F401

from . import main # noqa: F401
from .consts import ADDON
from .libaddon.consts import setAddonProperties

setAddonProperties(ADDON)

from anki.hooks import addHook

from .gui.options_global import initializeOptions
from .template import initializeModels
from .editor import initializeEditor
from .sched import initializeScheduler
from .reviewer import initializeReviewer

def delayedInit():
initializeModels()
initializeScheduler()

addHook("profileLoaded", delayedInit)
initializeOptions()
initializeEditor()
initializeReviewer()
2 changes: 1 addition & 1 deletion src/cloze_overlapper/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def createNoteSettings(setopts):
"flds": OLC_FLDS,
"sched": [True, True, False],
"olmdls": [OLC_MODEL],
"version": ADDON_VERSION
"version": ADDON.VERSION
}
}

Expand Down
56 changes: 36 additions & 20 deletions src/cloze_overlapper/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,32 +38,48 @@

from ._version import __version__

try:
from .data.patrons import MEMBERS_CREDITED, MEMBERS_TOP
except ImportError:
MEMBERS_CREDITED = MEMBERS_TOP = ()

__all__ = [
"ADDON_NAME", "ADDON_ID", "ADDON_VERSION", "LINKS",
"LICENSE", "LIBRARIES", "AUTHORS", "CONTRIBUTORS",
"SPONSORS",
"ADDON",
"OLC_MODEL", "OLC_CARD", "OLC_MAX",
"OLC_FLDS", "OLC_FLDS_IDS", "OLC_FIDS_PRIV"
]

# ADD-ON

ADDON_NAME = "Cloze Overlapper"
ADDON_ID = "969733775"
ADDON_VERSION = __version__
LINKS = {
"help": "https://github.com/glutanimate/cloze-overlapper/wiki"
}
LICENSE = "GNU AGPLv3"
LIBRARIES = []
AUTHORS = [
{"name": "Aristotelis P. (Glutanimate)", "years": "2016-2019",
"contact": "https://glutanimate.com"}
]
# automatically sorted:
CONTRIBUTORS = ["zjosua"]
SPONSORS = []
# PROPERTIES DESCRIBING ADDON

class ADDON(object):
"""Class storing general add-on properties
Property names need to be all-uppercase with no leading underscores
"""
NAME = "Cloze Overlapper"
MODULE = "cloze_overlapper"
ID = "969733775"
VERSION = __version__
LICENSE = "GNU AGPLv3"
AUTHORS = (
{"name": "Aristotelis P. (Glutanimate)", "years": "2016-2019",
"contact": "https://glutanimate.com"},
)
AUTHOR_MAIL = "[email protected]"
LIBRARIES = ()
CONTRIBUTORS = ("zjosua", )
SPONSORS = ()
MEMBERS_CREDITED = MEMBERS_CREDITED
MEMBERS_TOP = MEMBERS_TOP
LINKS = {
"patreon": "https://www.patreon.com/glutanimate",
"bepatron": "https://www.patreon.com/bePatron?u=7522179",
"coffee": "http://ko-fi.com/glutanimate",
"description": "https://ankiweb.net/shared/info/{}".format(ID),
"rate": "https://ankiweb.net/shared/review/{}".format(ID),
"twitter": "https://twitter.com/glutanimate",
"youtube": "https://www.youtube.com/c/glutanimate",
"help": "https://github.com/glutanimate/review-heatmap/wiki"
}

# OLC

Expand Down
2 changes: 0 additions & 2 deletions src/cloze_overlapper/gui/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,3 @@
from .anki20 import * # noqa: F401
else:
from .anki21 import * # noqa: F401

QRC_PREFIX = "cloze_overlapper"
2 changes: 1 addition & 1 deletion src/cloze_overlapper/libaddon/gui/dialog_contrib.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
Uses the following addon-level constants, if defined:
ADDON_NAME, MAIL_AUTHOR, LINKS
ADDON.NAME, ADDON.AUTHOR_MAIL, ADDON.LINKS
"""

from __future__ import (absolute_import, division,
Expand Down
57 changes: 0 additions & 57 deletions src/cloze_overlapper/main.py

This file was deleted.

0 comments on commit 7ed63c0

Please sign in to comment.