Skip to content
Snippets Groups Projects
Verified Commit e30a7025 authored by TheJoeCoder's avatar TheJoeCoder
Browse files

Make config file better

parent 7ed27584
Branches
No related tags found
No related merge requests found
...@@ -127,3 +127,4 @@ dmypy.json ...@@ -127,3 +127,4 @@ dmypy.json
cython_debug/ cython_debug/
module_config.json module_config.json
hw_config.json
\ No newline at end of file
PROP_SCREEN_WIDTH = 240 import os.path
PROP_SCREEN_HEIGHT = 280 import json
default_config = {
"screen_width": 240,
"screen_height": 280,
"window_fullscreen": True,
"hide_mouse": True,
"window_scale": 2,
"leds_driver": "npixel",
"leds_location": "D12",
"leds_length": 15,
"flask_debug": False,
"flask_host": "0.0.0.0",
"flask_port": 5000
}
config = default_config.copy()
if os.path.exists("config.json"):
with open("config.json", "r") as f:
config.update(json.load(f))
with open("config.json", "w") as f:
json.dump(config, f, indent=4)
PROP_SCREEN_WIDTH = config["screen_width"]
PROP_SCREEN_HEIGHT = config["screen_height"]
PROP_WINDOW_FULLSCREEN = config["window_fullscreen"]
PROP_HIDE_MOUSE = config["hide_mouse"]
PROP_WINDOW_FULLSCREEN = False # Make the window scale larger for development
PROP_WINDOW_SCALE = config["window_scale"]
PROP_HIDE_MOUSE = False PROP_FLASK_DEBUG = config["flask_debug"]
PROP_FLASK_HOST = config["flask_host"]
PROP_FLASK_PORT = config["flask_port"]
PROP_LEDS_DRIVER = config["leds_driver"]
PROP_LEDS_LOCATION = config["leds_location"]
PROP_LEDS_LENGTH = config["leds_length"]
# Make the window scale larger for development
PROP_WINDOW_SCALE = 3
PROP_AVAILABLE_WIDGETS = [ PROP_AVAILABLE_WIDGETS = [
"IPShowWidget", "IPShowWidget",
...@@ -19,15 +53,3 @@ PROP_AVAILABLE_PATTERNS = [ ...@@ -19,15 +53,3 @@ PROP_AVAILABLE_PATTERNS = [
"RainbowPattern", "RainbowPattern",
"SolidColorPattern" "SolidColorPattern"
] ]
PROP_FLASK_DEBUG = False
PROP_FLASK_HOST = "0.0.0.0"
PROP_FLASK_PORT = 5000
PROP_LEDS_DRIVER = "dummy"
PROP_LEDS_LOCATION=""
PROP_LEDS_LENGTH = 15
# PROP_LEDS_DRIVER="npixel"
# PROP_LEDS_LOCATION="D12"
# PROP_LEDS_LENGTH = 15
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment