-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
39 lines (31 loc) · 1.06 KB
/
main.py
File metadata and controls
39 lines (31 loc) · 1.06 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
import sys
from common.constants import MISSING_DEPENDENCIES_ERROR_CODE
from common.deputils import check_import, do_import
from controller.controller import Controller
from model.model import Model
PLEASE_INSTALL_MODULES = "Please install dependency modules by doing this(use pip or pip3):\n"
dependencies = ['tkfilebrowser', 'tkcalendar']
warning = not all([check_import(dep) for dep in dependencies])
if warning:
sys.exit(MISSING_DEPENDENCIES_ERROR_CODE)
from view.view import GuiView
try:
for i in range(len(dependencies)):
d = dependencies[i]
do_import(d)
except ModuleNotFoundError as e:
print(PLEASE_INSTALL_MODULES)
if e.name == 'win32com':
print(f"C:\> pip install pywin32")
print(f"$ pip install pywin32")
else:
print(f"C:\> pip install {d}")
print(f"$ pip install {d}")
sys.exit(0)
if __name__ == '__main__':
model = Model()
if 'text' in sys.argv:
controller = Controller(model, TerminalView)
else:
controller = Controller(model, GuiView)
controller.start()