-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprefs.py
30 lines (26 loc) · 812 Bytes
/
prefs.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
import os
import lib.var as var
import json
# Load preferences
if not os.path.exists(var.PREFERENCE_DIR):
os.makedirs(var.PREFERENCE_DIR)
# Set default preferences
app_preferences = {
"tray" : False,
"menu" : False,
"log" : True,
"profiles" : True,
"preview" : True,
"startMinimized": False,
"closeToTray" : False,
"applyStart" : False,
"extendSpeed" : False,
"language" : "",
"trayIconStyle" : "color"
}
# Get path to preference file
pref_file = os.path.join(var.PREFERENCE_DIR, var.PREFERENCE_FILE)
if os.path.isfile(pref_file):
# Read preferences from file and merge with default preferences
with open(f"{pref_file}", 'rt') as file:
app_preferences = {**app_preferences, **json.load(file)}