Commit 140b717a authored by Carsten Richter's avatar Carsten Richter
Browse files

Merge branch 'fix-custom-names' into 'master'

Fix issues when the qspace was renamed in the tree

Closes #62

See merge request !91
parents bcf1f0e9 3eefd003
Pipeline #6534 canceled with stages
...@@ -227,7 +227,7 @@ class XsocsGui(Qt.QMainWindow): ...@@ -227,7 +227,7 @@ class XsocsGui(Qt.QMainWindow):
fitGroup = item.fitGroup() fitGroup = item.fitGroup()
fitItem = fitGroup.addFitFile(fitFile) fitItem = fitGroup.addFitFile(fitFile)
self.model().refresh() self.model().refresh()
index = self.tree.pathToIndex(fitItem.path) index = self.tree.pathToIndex(fitItem.customPath)
if index.isValid(): if index.isValid():
self.tree.setCurrentIndex(index) self.tree.setCurrentIndex(index)
self.__showFit(index.data(ModelRoles.InternalDataRole)) self.__showFit(index.data(ModelRoles.InternalDataRole))
...@@ -251,7 +251,7 @@ class XsocsGui(Qt.QMainWindow): ...@@ -251,7 +251,7 @@ class XsocsGui(Qt.QMainWindow):
if qspaceItem is None: if qspaceItem is None:
raise ValueError('This fitItem doesnt have a parent.') raise ValueError('This fitItem doesnt have a parent.')
index = self.centralWidget().pathToIndex(qspaceItem.path) index = self.centralWidget().pathToIndex(qspaceItem.customPath)
node = index.data(ModelRoles.InternalDataRole) node = index.data(ModelRoles.InternalDataRole)
qspaceView = self.__showQSpace(node, bringToFront=False) qspaceView = self.__showQSpace(node, bringToFront=False)
qspaceView.selectPoint(point.x, point.y) qspaceView.selectPoint(point.x, point.y)
......
...@@ -287,6 +287,21 @@ class ProjectItem(XsocsH5Base): ...@@ -287,6 +287,21 @@ class ProjectItem(XsocsH5Base):
else: else:
return '' return ''
@property
def customPath(self):
"""Path with custom item names if defined"""
parent = self.parent()
if parent is not None:
path = parent.customPath
else:
path = ''
customName = self.getItemName()
if not customName:
customName = self.path.split('/')[-1]
return '/'.join((path, customName))
def _createItem(self): def _createItem(self):
""" """
Called when the xsocsh5 file is succesfuly called. This should be used Called when the xsocsh5 file is succesfuly called. This should be used
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment