summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Shreve <j.a.shreve@gmail.com>2021-08-21 20:31:07 -0400
committerJoshua Shreve <j.a.shreve@gmail.com>2021-08-21 20:31:07 -0400
commit9e2c0c3b72eb0bb27210bf19d76e7e4b6f5ce295 (patch)
tree7a6ef8f77f99ecf3b7cfb4cb370c163d81e888e0
parent4c179f900053db8acb072cf6eb6e73b40293fea7 (diff)
Added config update to add new parameters to config. Retained ability to run the run_config.json file if there are no CLI arguments.
Retained ability to run the run_config.json file if there are no CLI arguments. Will eventually deprecate run_config in favor of the configs directory, but don't want to mess up existing configs until they have time to migrate. Un-ignored configs. Would like to build a set of user configs through PRs to see variety. Add gallery directory for those with submit configs for people to see examples. All PRs for configs are expected to have identically named files (with some suffix for multiple) to show example images.
-rw-r--r--.gitignore3
-rw-r--r--gallery/.gitkeep0
-rw-r--r--src/dactyl_manuform.py33
-rw-r--r--src/generate_configuration.py8
-rw-r--r--src/run_config.json2
5 files changed, 24 insertions, 22 deletions
diff --git a/.gitignore b/.gitignore
index 41ac558..969b9fe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,5 +14,4 @@
debug_*
*/__pycache__/*
*~$*
-things/
-configs/*.json \ No newline at end of file
+things/ \ No newline at end of file
diff --git a/gallery/.gitkeep b/gallery/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/gallery/.gitkeep
diff --git a/src/dactyl_manuform.py b/src/dactyl_manuform.py
index 1dc1507..8156ca6 100644
--- a/src/dactyl_manuform.py
+++ b/src/dactyl_manuform.py
@@ -24,14 +24,20 @@ import generate_configuration as cfg
for item in cfg.shape_config:
locals()[item] = cfg.shape_config[item]
-## CHECK FOR CONFIG FILE AND WRITE TO ANY VARIABLES IN FILE.
-opts, args = getopt.getopt(sys.argv[1:], "", ["config="]);
-for opt, arg in opts:
- if opt in ('--config'):
- with open(os.path.join(r"..", "configs", arg + '.json'), mode='r') as fid:
- data = json.load(fid)
- for item in data:
- locals()[item] = data[item]
+if len(sys.argv) <= 1:
+ with open(os.path.join(r".", 'run_config.json'), mode='r') as fid:
+ data = json.load(fid)
+
+else:
+ ## CHECK FOR CONFIG FILE AND WRITE TO ANY VARIABLES IN FILE.
+ opts, args = getopt.getopt(sys.argv[1:], "", ["config="])
+ for opt, arg in opts:
+ if opt in ('--config'):
+ with open(os.path.join(r"..", "configs", arg + '.json'), mode='r') as fid:
+ data = json.load(fid)
+
+for item in data:
+ locals()[item] = data[item]
# Really rough setup. Check for ENGINE, set it not present from configuration.
@@ -152,15 +158,6 @@ teensy_holder_width = 7 + teensy_pcb_thickness
teensy_holder_height = 6 + teensy_width
-
-# wire_post_height = 7
-# wire_post_overhang = 3.5
-# wire_post_diameter = 2.6
-#
-# screw_insert_height = 3.8
-# screw_insert_bottom_radius = 5.31 / 2
-# screw_insert_top_radius = 5.1 / 2
-
# save_path = path.join("..", "things", save_dir)
if not path.isdir(save_path):
os.mkdir(save_path)
@@ -2605,7 +2602,7 @@ def thumb_walls(side='right', style_override=None):
elif "TRACKBALL" in _thumb_style:
if (side == ball_side or ball_side == 'both'):
- if _thumb_style == "TRACKBALL_ORBYL" :
+ if _thumb_style == "TRACKBALL_ORBYL":
return tbjs_thumb_walls()
elif thumb_style == "TRACKBALL_CJ":
return tbcj_thumb_walls()
diff --git a/src/generate_configuration.py b/src/generate_configuration.py
index 79ef5b3..7b0ef84 100644
--- a/src/generate_configuration.py
+++ b/src/generate_configuration.py
@@ -387,7 +387,13 @@ shape_config = {
def save_config():
# Check to see if the user has specified an alternate config
- opts, args = getopt.getopt(sys.argv[1:], "", ["config="]);
+ opts, args = getopt.getopt(sys.argv[1:], "", ["config=", "update="])
+ 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)
+
for opt, arg in opts:
if opt in ('--config'):
# If a config file was specified, set the config_name and save_dir
diff --git a/src/run_config.json b/src/run_config.json
index cd7db76..3679941 100644
--- a/src/run_config.json
+++ b/src/run_config.json
@@ -20,7 +20,7 @@
7
],
"keyboard_z_offset": 11,
- "thumb_style": "TRACKBALL_CJ",
+ "thumb_style": "DEFAULT",
"default_1U_cluster": true,
"minidox_Usize": 1.6,
"thumb_plate_tr_rotation": 0.0,