Skip to content

Commit

Permalink
moved ItemIsSelectable flag from init to refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
RazinShaikh committed Aug 19, 2023
1 parent 8dd6533 commit c29c8ac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion zxlive/eitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def __init__(self, graph_scene: GraphScene, e: ET, s_item: VItem, t_item: VItem)
self.setZValue(EITEM_Z)
self.setFlag(QGraphicsItem.GraphicsItemFlag.ItemIsSelectable, True)
self.setFlag(QGraphicsItem.GraphicsItemFlag.ItemSendsGeometryChanges, True)
self.setFlag(QGraphicsItem.GraphicsItemFlag.ItemIsSelectable, graph_scene.g.edge_type(e) != EdgeType.W_IO)

self.graph_scene = graph_scene
self.e = e
Expand All @@ -64,6 +63,8 @@ def g(self) -> GraphT:
def refresh(self) -> None:
"""Call whenever source or target moves or edge data changes"""

self.setFlag(QGraphicsItem.GraphicsItemFlag.ItemIsSelectable,
self.g.edge_type(self.e) != EdgeType.W_IO)
# set color/style according to edge type
pen = QPen()
pen.setWidthF(3)
Expand Down

0 comments on commit c29c8ac

Please sign in to comment.