Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Commit

Permalink
Fix add component bug where transform parent could not be found by index
Browse files Browse the repository at this point in the history
  • Loading branch information
rerpha committed Apr 24, 2019
1 parent f64a30d commit ba178f2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion nexus_constructor/qml_models/instrument_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,17 @@ def update_child_transforms(self, component):

@Slot(int, result="QVariant")
def get_transform_model(self, index: int):
return self.transform_models[index]
"""
Returns the transform model for the component.
The list is 1-based due to the 0 being no parent, so we have to use index-1 here
unless the component has no transform parent (for example the sample)
:param index: The component's transform parents index.
:return: The transform model for the component.
"""
if index == 0:
return self.transform_models[index]
else:
return self.transform_models[index - 1]

@Slot(str, result=str)
def generate_component_name(self, base):
Expand Down

0 comments on commit ba178f2

Please sign in to comment.