Skip to content

Commit d0816d3

Browse files
author
Silver Kuusik
committed
add default values for config file update
1 parent fb9a1e8 commit d0816d3

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

main.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
from PyQt5.QtWidgets import *
3636

3737
# App versioning
38-
APP_VERSION = '0.8.0'
39-
APP_TIMESTAMP = '2019.05.26 22:20:00'
38+
APP_VERSION = '0.8.1'
39+
APP_TIMESTAMP = '2019.06.01 12:20:00'
4040

4141
# App name
4242
APP_NAME = 'SumoManager v' + APP_VERSION
@@ -418,15 +418,15 @@ def run(self):
418418
if window.config:
419419
# Transfer the personalized values
420420
tmp_config = json.loads(data['config.json'])
421-
tmp_config['wifis'] = window.config['wifis']
422-
tmp_config['sumo_id'] = window.config['sumo_id']
421+
tmp_config['wifis'] = window.config.get('wifis')
422+
tmp_config['sumo_id'] = window.config.get('sumo_id') or 'xxxxxxxx'
423423
tmp_config['status_led_pin'] = window.status_led_pin
424-
tmp_config['sumo_server'] = window.config['sumo_server']
425-
tmp_config['ultrasonic_threshold'] = window.config['ultrasonic_threshold']
426-
tmp_config['left_line_value'] = window.config['left_line_value']
427-
tmp_config['right_line_value'] = window.config['right_line_value']
428-
tmp_config['left_line_threshold'] = window.config['left_line_threshold']
429-
tmp_config['right_line_threshold'] = window.config['right_line_threshold']
424+
tmp_config['sumo_server'] = window.config.get('sumo_server') or '165.227.140.64:80'
425+
tmp_config['ultrasonic_threshold'] = window.config.get('ultrasonic_threshold') or 40
426+
tmp_config['left_line_value'] = window.config.get('left_line_value') or 0
427+
tmp_config['right_line_value'] = window.config.get('right_line_value') or 0
428+
tmp_config['left_line_threshold'] = window.config.get('left_line_threshold') or 1000
429+
tmp_config['right_line_threshold'] = window.config.get('right_line_threshold') or 1000
430430
data['config.json'] = json.dumps(tmp_config, indent=8)
431431
# In case it's the default config file
432432
else:

0 commit comments

Comments
 (0)