diff --git a/beamline_editor/scene.py b/beamline_editor/scene.py index 7940b02..63923fa 100644 --- a/beamline_editor/scene.py +++ b/beamline_editor/scene.py @@ -224,14 +224,13 @@ class BeamlineScene(QGraphicsScene): act_copy.triggered.connect(lambda: self._ctx_copy(node)) menu.addAction(act_copy) - # Flatten — only shown for Start markers - if node.element_type == "Start": - menu.addSeparator() - act_flatten = QAction("Flatten from here", menu) - act_flatten.triggered.connect( - lambda: self._ctx_flatten(node) - ) - menu.addAction(act_flatten) + # Flatten — calls on_flatten with this node's ID + menu.addSeparator() + act_flatten = QAction("Flatten from here", menu) + act_flatten.triggered.connect( + lambda: self._ctx_flatten(node) + ) + menu.addAction(act_flatten) menu.addSeparator() diff --git a/main.py b/main.py index 65223dc..2b8a521 100644 --- a/main.py +++ b/main.py @@ -150,6 +150,7 @@ class BeamlineEditor(QtWidgets.QMainWindow, Ui_BeamlineGUI): def updateProperties(self,node_id: str, data: dict): # make sure that the ID is not changed data['Name']['ID']=node_id + type = self.editor.getElementType(node_id) # check for name consitency if 'Index' in data['Name'].keys() and 'Tag' in data['Name'].keys(): tag=data['Name']['Tag'].upper()+'XXXX' @@ -165,8 +166,7 @@ class BeamlineEditor(QtWidgets.QMainWindow, Ui_BeamlineGUI): name = data['Name']['Name'] # update GUI type = self.editor.getElementType(node_id) - if not (type == 'Start' or type == 'End'): - self.editor.setElementName(node_id,name) + self.editor.setElementName(node_id,name) updated = self.editor.updatePropertyPane(node_id, data) proplist=getPropertyList(type) diff --git a/propertytypes.py b/propertytypes.py index dd85598..ab599c6 100644 --- a/propertytypes.py +++ b/propertytypes.py @@ -16,6 +16,8 @@ def getPropertyList(element_type: str | None) -> dict: return {} if element_type == 'Line': return {'Name':'Name/Name','LengthEnding':'Position/Reserved Length','firstElementID':'Anchor/Reference'} + elif element_type == 'Start': + return {'Name': 'Name/Name'} fields={} for i , fld in enumerate(eName): fields[fld]='Name/'+Name[i]