-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
45 lines (31 loc) · 965 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
41
42
43
44
45
import webview
import sys
import os
class Api:
def __init__(self):
pass
def init(self):
response = {
'message': 'Hello from Python {0}'.format(sys.version)
}
return response
def openFileDialog(self):
file = window.create_file_dialog(webview.OPEN_DIALOG, allow_multiple=False)
return file[0]
def getDir(self):
file = self.openFileDialog()
path = os.path.dirname(file)
return path
def getEngineFiles(self):
pass
def getDefaultEngine(self, path):
main_path = path+"\main.mr"
with open(main_path, "r+") as file:
text = file.read()
index = text.index("set_engine") + 10
engine_name = file[index:-1]
return engine_name
if __name__ == '__main__':
api = Api()
window = webview.create_window('Engine Launcher', "./ui/index.html", js_api=api)
webview.start(debug=True)