network: Fix edge selection display update.

mesh
Pierre-Antoine Rouby 2023-04-05 10:59:48 +02:00
parent a7460193b5
commit 77736b0885
1 changed files with 6 additions and 6 deletions

View File

@ -52,7 +52,7 @@ class NodeItem(QGraphicsItem):
# Select color in function of node position in graph and # Select color in function of node position in graph and
# status # status
color = Qt.blue color = Qt.black
if self.graph.selected_new_edge_src_node() == self: if self.graph.selected_new_edge_src_node() == self:
color = Qt.darkRed color = Qt.darkRed
elif self.graph.selected_item() == self: elif self.graph.selected_item() == self:
@ -139,11 +139,11 @@ class EdgeItem(QGraphicsItem):
return return
# Select color # Select color
color = Qt.blue color = Qt.black
if self.graph.selected_item() == self: if self.graph.selected_item() == self:
color = Qt.red color = Qt.red
elif self.graph.current_edge() == self: elif self.graph.current_edge() == self:
color = Qt.darkBlue color = Qt.blue
elif not self.graph.graph.is_enable_edge(self.edge): elif not self.graph.graph.is_enable_edge(self.edge):
color = Qt.darkGray color = Qt.darkGray
@ -537,7 +537,7 @@ class GraphWidget(QGraphicsView):
""" """
return self._current_edge return self._current_edge
def setCurrentEdge(self, edge): def set_current_edge(self, edge):
"""Set the current edge item selected """Set the current edge item selected
Args: Args:
@ -546,7 +546,7 @@ class GraphWidget(QGraphicsView):
Returns: Returns:
Nothing Nothing
""" """
previous_edge = self._selected_new_edge_src_node previous_edge = self._current_edge
self._current_edge = edge self._current_edge = edge
if previous_edge: if previous_edge:
@ -613,7 +613,7 @@ class GraphWidget(QGraphicsView):
if items and type(items[0]) == EdgeItem: if items and type(items[0]) == EdgeItem:
edge = items[0] edge = items[0]
if edge: if edge:
self.setCurrentEdge(edge) self.set_current_edge(edge)
# Add nodes and edges # Add nodes and edges
elif self._state == "add": elif self._state == "add":