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

Commit

Permalink
Merge pull request #205 from ess-dmsc/112_fix_add_component_bug
Browse files Browse the repository at this point in the history
Fix add component bug where transform parent could not be found by index
  • Loading branch information
DominicOram authored Apr 26, 2019
2 parents ad2079a + ba178f2 commit 0c0c63d
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 0c0c63d

Please sign in to comment.