wdcqc commited on
Commit
fdf60dd
1 Parent(s): cea9c8b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -10
app.py CHANGED
@@ -7,13 +7,16 @@ import urllib.request
7
  import json
8
 
9
  def fix_theme(theme):
10
- with open("/home/user/.local/lib/python3.8/site-packages/wfd/webui/doki_settings.json", encoding = "utf-8") as fp:
11
- doki = json.load(fp)
12
-
13
- doki["theme"] = theme
14
 
15
- with open("/home/user/.local/lib/python3.8/site-packages/wfd/webui/doki_settings.json", "w", encoding = "utf-8") as fp:
16
- json.dump(doki, fp)
 
 
 
 
17
 
18
  def fix_local_file(path):
19
  # probably should include the tile files in the package. let's get it running first.
@@ -49,10 +52,10 @@ def fix_package_file(path):
49
  print("{} is fixed!".format(path))
50
 
51
  if __name__ == "__main__":
52
- # fix_package_file("mpqapi/libstorm.so")
53
- # fix_package_file("webui/templates/tempura.css")
54
- # fix_package_file("webui/templates/background.css")
55
- # fix_package_file("webui/doki_settings.json")
56
  fix_local_file("tile_data/platform.cv5.bin")
57
  fix_local_file("tile_data/platform.png")
58
  fix_local_file("tile_data/platform_mapping.npz")
 
7
  import json
8
 
9
  def fix_theme(theme):
10
+ try:
11
+ with open("/home/user/.local/lib/python3.8/site-packages/wfd/webui/doki_settings.json", encoding = "utf-8") as fp:
12
+ doki = json.load(fp)
 
13
 
14
+ doki["theme"] = theme
15
+
16
+ with open("/home/user/.local/lib/python3.8/site-packages/wfd/webui/doki_settings.json", "w", encoding = "utf-8") as fp:
17
+ json.dump(doki, fp)
18
+ except Exception as e:
19
+ print(e)
20
 
21
  def fix_local_file(path):
22
  # probably should include the tile files in the package. let's get it running first.
 
52
  print("{} is fixed!".format(path))
53
 
54
  if __name__ == "__main__":
55
+ fix_package_file("mpqapi/libstorm.so")
56
+ fix_package_file("webui/templates/tempura.css")
57
+ fix_package_file("webui/templates/background.css")
58
+ fix_package_file("webui/doki_settings.json")
59
  fix_local_file("tile_data/platform.cv5.bin")
60
  fix_local_file("tile_data/platform.png")
61
  fix_local_file("tile_data/platform_mapping.npz")