-
-
Notifications
You must be signed in to change notification settings - Fork 80
/
iset.py
48 lines (38 loc) · 1.25 KB
/
iset.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
# Get Settings
import json
path = None
def create(path):
with open(path, "w") as obj:
app = {"conf_ver": 7,
"gwsl_ver": "1.4.5",
"general": {"pulseaudio":True, "hide_donation_reminder":False, "force_disable_primary":False, "clipboard": True, "start_menu_mode": False, "shell_gui": "cmd", "acrylic_enabled": True},
"graphics": {"window_mode": "multi", "hidpi": True},
"putty": {"ip": None, "ssh_key": None},
"distro_blacklist": ["docker"],
"app_blacklist": ["exampleblock"],
"xserver_profiles": {"Plain VcXsrv": []
}}
json.dump(app, obj, indent=True)
obj.close()
"""
def get(setting):
settings = setting.split(sep=".")
with open(path, "r") as obj:
current = json.load(obj)
try:
for s in settings:
current = current[s]
obj.close()
return current
except:
return None
"""
def read():
with open(path, "r") as obj:
current = json.load(obj)
obj.close()
return current
def set(json_f):
with open(path, "w") as obj:
json.dump(json_f, obj, indent=True)
obj.close()