Skip to content

Commit

Permalink
Added mouseDoubleClickEvent method in schematic items
Browse files Browse the repository at this point in the history
  • Loading branch information
s-simoncelli committed Feb 17, 2024
1 parent 1927ad0 commit 7171cbf
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pywr_editor/schematic/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,14 @@ def add_delete_edge_actions(self, menu: QMenu) -> bool:

return True

def mouseDoubleClickEvent(self, event) -> None:
"""
Edit node on double-click.
:param event: The event that triggered this.
:return: None.
"""
self.on_edit_node()

def contextMenuEvent(
self, event: PySide6.QtWidgets.QGraphicsSceneContextMenuEvent
) -> None:
Expand Down Expand Up @@ -445,14 +453,6 @@ def on_disconnect_edge(self, action: QAction) -> None:
f'Deleted edge from "{source_node.name}" to "{target_node.name}"'
)

# @Slot()
# def on_delete_node(self) -> None:
# """
# Deletes a node and its edges from the schematic and model configuration.
# :return: None
# """
# self.view.on_delete_item([self])

@Slot()
def on_edit_node(self) -> None:
"""
Expand Down
8 changes: 8 additions & 0 deletions pywr_editor/schematic/shapes/arrow_shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,3 +445,11 @@ def on_edit_shape(self) -> None:
color_widget: ColorPickerWidget = dialog.form.find_field("border_color").widget
color_widget.changed_color.connect(dialog.form.on_field_changed)
dialog.show()

def mouseDoubleClickEvent(self, event) -> None:
"""
Edit node on double-click.
:param event: The event that triggered this.
:return: None.
"""
self.on_edit_shape()
8 changes: 8 additions & 0 deletions pywr_editor/schematic/shapes/rectangle_shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,3 +514,11 @@ def on_edit_shape(self) -> None:
color_widget: ColorPickerWidget = dialog.form.find_field(name).widget
color_widget.changed_color.connect(dialog.form.on_field_changed)
dialog.show()

def mouseDoubleClickEvent(self, event) -> None:
"""
Edit node on double-click.
:param event: The event that triggered this.
:return: None.
"""
self.on_edit_shape()
8 changes: 8 additions & 0 deletions pywr_editor/schematic/shapes/text_shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,11 @@ def check_form_text(self, name: str, label: str, value: str) -> Validation:
)

return Validation()

def mouseDoubleClickEvent(self, event) -> None:
"""
Edit node on double-click.
:param event: The event that triggered this.
:return: None.
"""
self.on_edit_shape()

0 comments on commit 7171cbf

Please sign in to comment.