From 71d396dc7b733b89eebe2067387607d8f0cf3897 Mon Sep 17 00:00:00 2001 From: Eric Jiang Date: Thu, 29 Oct 2020 17:55:37 -0700 Subject: [PATCH] Quit if default config file was created --- huion_keys.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/huion_keys.py b/huion_keys.py index 7fe285b..f19cb05 100644 --- a/huion_keys.py +++ b/huion_keys.py @@ -15,7 +15,10 @@ def main(): if os.path.isfile(CONFIG_FILE_PATH): read_config(CONFIG_FILE_PATH) else: - write_default_config(CONFIG_FILE_PATH) + print("No config file found.") + create_default_config(CONFIG_FILE_PATH) + print("Created an example config file at " + CONFIG_FILE_PATH) + return 1 hidraw = open(hidraw_path, 'rb') while True: btn = get_button_press(hidraw) @@ -57,6 +60,8 @@ def read_config(config_file): BUTTON_BINDINGS['scroll_up'] = value.encode('utf-8') elif setting == 'scroll_down': BUTTON_BINDINGS['scroll_down'] = value.encode('utf-8') + elif setting == '': + continue # ignore empty line else: print("[WARN] unrecognized setting '%s'" % (setting,))