Quit if default config file was created

This commit is contained in:
Eric Jiang 2020-10-29 17:55:37 -07:00
parent 3e2b04ef5a
commit 71d396dc7b

View File

@ -15,7 +15,10 @@ def main():
if os.path.isfile(CONFIG_FILE_PATH): if os.path.isfile(CONFIG_FILE_PATH):
read_config(CONFIG_FILE_PATH) read_config(CONFIG_FILE_PATH)
else: 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') hidraw = open(hidraw_path, 'rb')
while True: while True:
btn = get_button_press(hidraw) btn = get_button_press(hidraw)
@ -57,6 +60,8 @@ def read_config(config_file):
BUTTON_BINDINGS['scroll_up'] = value.encode('utf-8') BUTTON_BINDINGS['scroll_up'] = value.encode('utf-8')
elif setting == 'scroll_down': elif setting == 'scroll_down':
BUTTON_BINDINGS['scroll_down'] = value.encode('utf-8') BUTTON_BINDINGS['scroll_down'] = value.encode('utf-8')
elif setting == '':
continue # ignore empty line
else: else:
print("[WARN] unrecognized setting '%s'" % (setting,)) print("[WARN] unrecognized setting '%s'" % (setting,))