-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
executable file
·46 lines (41 loc) · 1.44 KB
/
__init__.py
File metadata and controls
executable file
·46 lines (41 loc) · 1.44 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from PyQt5 import QtCore, QtWidgets, QtGui#, uic
import argparse, sys, os
addonPath = os.path.split(os.path.realpath(__file__))[0]
print('Addon path:', addonPath)
sys.path.append(addonPath + '/modules')
def ankiMain():
# import the main window object (mw) from aqt
from aqt import mw
def spawnWindow():
win = MainWidget(None, args={'debug': False}, ankiIntegration=True)
win.show()
# create a new menu item, "test"
action = QtWidgets.QAction("Create Japanese Cards", mw)
# set it to call testFunction when it's clicked
action.triggered.connect(spawnWindow)
# and add it to the tools menu
mw.menuBar().addAction(action)
def main():
from modules.UnixSignals import setupQuitOnSignal
setupQuitOnSignal()
app = QtWidgets.QApplication(sys.argv)
parser = argparse.ArgumentParser("Creates Cards for Anki")
parser.add_argument("--debug", dest='debug', action='store_const',
default=False, const=True)
args = parser.parse_args()
# timer = QtCore.QTimer()
# timer.setSingleShot(True)
# timer.timeout.connect(lambda: win.scrapeImages(sys.argv[1], 5))
win = MainWidget(app, args=args)
# win.loadTestImages()
win.show()
# timer.start(0)
app.exec_()
if __name__ == "__main__":
from modules.MainWidget import MainWidget
main()
else:
from CardCreator.modules.MainWidget import MainWidget
ankiMain()