-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.py
40 lines (29 loc) · 915 Bytes
/
main.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
35
36
37
38
39
40
import webview as pwv
import server as srv
from requests import get
from threading import Thread
from CoreProxy import *
from shutil import rmtree
from os import mkdir, path, getcwd
def shutdown():
try:
CoreLibs.utils.unloadDB()
except Exception:
pass
CoreLibs.utils.stop()
rmtree(path.join(getcwd(),"tmp"))
get("http://127.0.0.1:5000/shutdown")
try:
mkdir(path.join(getcwd(),"tmp"))
except Exception as e:
print(e)
print("[STDWARN] > The software seems to have crashed during the last running process.")
CoreLibs.utils.init()
CoreLibs.issueHandler.init()
cfg, DB = CoreLibs.utils.getVars()
srv.init(cfg,DB)
window = pwv.create_window(title = "Logiciel de gestion CAPS (local)",url="http://127.0.0.1:5000/", confirm_close=True)
window.events.closed += shutdown
t1 = Thread(target=srv.srv.run)
t1.start()
pwv.start()