-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__init__.py
34 lines (24 loc) · 892 Bytes
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# NOTE: Add the support directory to the sys path so
# that dependency modules can be imported
import os,sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "support"))
import anki
from aqt.deckbrowser import DeckBrowser
from .gui.configurator import Configurator
from .gui.kanjigrid import KanjiGrid
from .gui.launcher import Launcher
from aqt import mw
from aqt.qt import QAction
mw.kanjigrid = {
'configure': Configurator(mw),
'kanjigrid': KanjiGrid(mw),
'launcher': Launcher(mw),
}
def preload(a, b):
mw.kanjigrid['configure'].deck_widget()
mw.kanjigrid['configure'].note_widget()
DeckBrowser._renderPage = anki.hooks.wrap(DeckBrowser._renderPage, preload, 'after')
launch_action = QAction(mw)
launch_action.setText("Generate Kanji Grid")
mw.form.menuTools.addAction(launch_action)
launch_action.triggered.connect(mw.kanjigrid['launcher'].show)