diff --git a/b_asic/GUI/drag_button.py b/b_asic/GUI/drag_button.py index c28f5551b0c31dad8cc38d756a5b31e4f743e3e7..0aae12557640a298bf80878408cc9d2a26997aad 100644 --- a/b_asic/GUI/drag_button.py +++ b/b_asic/GUI/drag_button.py @@ -63,25 +63,22 @@ class DragButton(QPushButton): self._flipped = False self._properties_window = None self.label = None - self._context_menu = None super().__init__(parent) def contextMenuEvent(self, event): - if self._context_menu is None: - menu = QMenu() - properties = QAction("Properties") - menu.addAction(properties) - properties.triggered.connect(self.show_properties_window) - - delete = QAction("Delete") - menu.addAction(delete) - delete.triggered.connect(self.remove) - - flip = QAction("Flip horizontal") - menu.addAction(flip) - flip.triggered.connect(self._flip) - self._context_menu = menu - self._context_menu.exec_(self.cursor().pos()) + menu = QMenu() + properties = QAction("Properties") + menu.addAction(properties) + properties.triggered.connect(self.show_properties_window) + + delete = QAction("Delete") + menu.addAction(delete) + delete.triggered.connect(self.remove) + + flip = QAction("Flip horizontal") + menu.addAction(flip) + flip.triggered.connect(self._flip) + menu.exec_(self.cursor().pos()) def show_properties_window(self, event=None) -> None: """Display the properties window for the associated Operation.""" diff --git a/b_asic/scheduler_gui/operation_item.py b/b_asic/scheduler_gui/operation_item.py index 6259a643c9c376d2bdb8be59f057aca678d843e0..b687a01633edb8b71ad861d3b2ae0aae59827682 100644 --- a/b_asic/scheduler_gui/operation_item.py +++ b/b_asic/scheduler_gui/operation_item.py @@ -89,7 +89,6 @@ class OperationItem(QGraphicsItemGroup): QCursor(Qt.CursorShape.OpenHandCursor) ) # default cursor when hovering over object - self._context_menu = None self._make_component() # def sceneEvent(self, event: QEvent) -> bool: