-
Notifications
You must be signed in to change notification settings - Fork 3
/
start_interface.py
71 lines (49 loc) · 1.67 KB
/
start_interface.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import json
import eel
import wx
@eel.expose
def get_config_file_content():
#
with open("./config.json", "r") as config_file:
config_json = json.loads(config_file.read())
return config_json
@eel.expose
def add_new_folder(folder_path, folder_summary):
with open("./config.json", "r") as config_file:
config_json = json.loads(config_file.read())
config_json["folders"].append({
"path": folder_path,
"summary": folder_summary
})
with open("./config.json", "w") as config_file:
config_file.write(json.dumps(config_json))
return True
@eel.expose
def choose_folder():
app = wx.App(None)
folder = wx.DirSelector(message="select")
return folder
@eel.expose
def delete_folder(folder_path):
with open("./config.json", "r") as config_file:
config_json = json.loads(config_file.read())
folders = [folder for folder in config_json["folders"]
if folder["path"] != folder_path]
config_json["folders"] = folders
with open("./config.json", "w") as config_file:
config_file.write(json.dumps(config_json))
return True
@eel.expose
def get_source_folder_path():
with open("./config.json", "r") as config_file:
config_json = json.loads(config_file.read())
return config_json["src_folder_path"]
@eel.expose
def set_source_folder_path(new_path):
with open("./config.json", "r") as config_file:
config_json = json.loads(config_file.read())
config_json["src_folder_path"] = new_path
with open("./config.json", "w") as config_file:
config_file.write(json.dumps(config_json))
eel.init('web')
eel.start('index.html', size=(1078, 800))