Skip to content

Commit

Permalink
generate_config.py once again defaulting to original behavior.
Browse files Browse the repository at this point in the history
  • Loading branch information
joshreve committed Aug 23, 2021
1 parent ac79be4 commit 27f491b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
14 changes: 11 additions & 3 deletions src/generate_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
# THUMB PARAMETERS
##############################
# 'DEFAULT' 6-key, 'MINI' 5-key, 'CARBONFET' 6-key, 'MINIDOX' 3-key, 'TRACKBALL_ORBYL', 'TRACKBALL_CJ'
'thumb_style': 'TRACKBALL_CJ',
'thumb_style': 'TRACKBALL_ORBYL',
'default_1U_cluster': True, # only used with default, makes top right thumb cluster key 1U
# Thumb key size. May need slight oversizing, check w/ caps. Additional spacing will be automatically added for larger keys.
'minidox_Usize': 1.6,
Expand Down Expand Up @@ -388,21 +388,29 @@
def save_config():
# Check to see if the user has specified an alternate config
opts, args = getopt.getopt(sys.argv[1:], "", ["config=", "update="])
got_opts = False
for opt, arg in opts:
if opt in ('--update'):
with open(os.path.join(r"..", "configs", arg + '.json'), mode='r') as fid:
data = json.load(fid)
shape_config.update(data)
got_opts = True

for opt, arg in opts:
if opt in ('--config'):
# If a config file was specified, set the config_name and save_dir
shape_config['save_dir'] = arg
shape_config['config_name'] = arg
got_opts = True

# Write the config to ./configs/<config_name>.json
with open(os.path.join(r"..", "configs", shape_config['config_name'] + '.json'), mode='w') as fid:
json.dump(shape_config, fid, indent=4)
if got_opts:
with open(os.path.join(r"..", "configs", shape_config['config_name'] + '.json'), mode='w') as fid:
json.dump(shape_config, fid, indent=4)

else:
with open(os.path.join(r".", 'run_config.json'), mode='w') as fid:
json.dump(shape_config, fid, indent=4)


if __name__ == '__main__':
Expand Down
6 changes: 3 additions & 3 deletions src/run_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"config_name": "DM",
"show_caps": true,
"show_pcbs": false,
"nrows": 4,
"ncols": 5,
"nrows": 5,
"ncols": 6,
"alpha": 0.26179916666666664,
"beta": 0.08726638888888888,
"centercol": 3,
Expand All @@ -20,7 +20,7 @@
7
],
"keyboard_z_offset": 11,
"thumb_style": "TRACKBALL_CJ",
"thumb_style": "TRACKBALL_ORBYL",
"default_1U_cluster": true,
"minidox_Usize": 1.6,
"thumb_plate_tr_rotation": 0.0,
Expand Down

0 comments on commit 27f491b

Please sign in to comment.