diff --git a/CHANGELOG.md b/CHANGELOG.md index ce70d17..e449a3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 Release dates are in YYYY-MM-DD +## [0.6.1] - 2022-07-25 + +- Fix base_blocks_list passed to the compute engine. + ## [0.6.0] - 2022-07-19 - Add option to categories the Blocks with a category in a sub-menu in the context menu on right-click>add-node. diff --git a/barfi/__init__.py b/barfi/__init__.py index a430ed3..8d7bdac 100644 --- a/barfi/__init__.py +++ b/barfi/__init__.py @@ -61,11 +61,14 @@ def st_barfi(base_blocks: Union[List[Block], Dict], load_schema: str = None, com if isinstance(base_blocks, List): base_blocks_data = [block._export() for block in base_blocks] + base_blocks_list = base_blocks elif isinstance(base_blocks, Dict): base_blocks_data = [] + base_blocks_list = [] for category, block_list in base_blocks.items(): if isinstance(block_list, List): for block in block_list: + base_blocks_list.append(block) block_data = block._export() block_data['category'] = category base_blocks_data.append(block_data) @@ -82,13 +85,13 @@ def st_barfi(base_blocks: Union[List[Block], Dict], load_schema: str = None, com if _from_client['command'] == 'execute': if compute_engine: - _ce = ComputeEngine(blocks=base_blocks) + _ce = ComputeEngine(blocks=base_blocks_list) _ce.add_editor_state(_from_client['editor_state']) _ce._map_block_link() _ce._execute_compute() return _ce.get_result() else: - _ce = ComputeEngine(blocks=base_blocks) + _ce = ComputeEngine(blocks=base_blocks_list) _ce.add_editor_state(_from_client['editor_state']) _ce._map_block_link() # return _ce.get_result() diff --git a/barfi/compute_engine.py b/barfi/compute_engine.py index 0bd4543..2779c49 100644 --- a/barfi/compute_engine.py +++ b/barfi/compute_engine.py @@ -43,7 +43,7 @@ def _map_block_link(self): for _block in self._editor_state['nodes']: - # Create a child block object for the active the block and associate with its id + # Create a child block object for the active block and associate with its id _parent_block = next( _b for _b in self._blocks if _b._type == _block['type']) # Create an independent deep copy of the parent block type diff --git a/setup.py b/setup.py index 55be1e4..51d960f 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ setuptools.setup( name="barfi", - version="0.6.0", + version="0.6.1", author="Adithya Krishnan", author_email="krishsandeep@gmail.com", description="Framework for a graphical programming environment.", diff --git a/tests/test_app.py b/tests/test_app.py index bf4b488..450fc9e 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -10,7 +10,7 @@ compute_engine = st.checkbox('Activate barfi compute engine', value=False) -barfi_result = st_barfi(base_blocks=base_blocks, compute_engine=compute_engine, +barfi_result = st_barfi(base_blocks=base_blocks_category, compute_engine=compute_engine, load_schema=barfi_schema_name) if barfi_result: