Skip to content

Commit

Permalink
read extruder_colour in connect metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
sarkafa committed Jul 3, 2024
1 parent 8ae75bd commit adf8fed
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ dist/
Testing
.py-build*
__pycache__
venv
4 changes: 2 additions & 2 deletions pybgcode/pybgcode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ def read_metadata(gcodefile: FILEWrapper, type: str = 'printer'):
"support_material", "ironing", "quiet_percent_present",
"quiet_left_present", "quiet_change_in_present", "normal_percent_present",
"normal_left_present", "normal_change_in_present", "layer_info_present",
"max_layer_z", "objects_info"]
"max_layer_z", "objects_info", "extruder_colour"]


def filter_connect_metadata(output: dict) -> dict:
all_metadata = {**output['print'], **output['printer']}
connect_metadata = {
key: item for key, item in all_metadata.items()
if key in connect_metadata_keys}
if (key in connect_metadata_keys and item != '""')}
return {'thumbnails': output['thumbnails'], 'metadata': connect_metadata}


Expand Down
2 changes: 2 additions & 0 deletions pybgcode/tests/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ def test_main():
assert len(slicer_metadata) == TEST_LEN_SLICER_METADATA

all_metadata = read_connect_metadata(thumb_f)
# ; extruder_colour = "" filtered out
assert 'extruder_colour' not in all_metadata['metadata']
assert len(all_metadata['thumbnails']) == TEST_THUMBNAILS
for key in all_metadata['metadata'].keys():
assert key in connect_metadata_keys
Expand Down

0 comments on commit adf8fed

Please sign in to comment.