Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug which generates same type of error also mentioned in #310. #358

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions zxlive/graphscene.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def update_graph(self, new: GraphT, select_new: bool = False) -> None:
anim_v.stop()
selected_vertices.discard(v)
self.removeItem(v_item)
del self.vertex_map[v]

for e in diff.removed_edges:
edge_idx = len(self.edge_map[e]) - 1
Expand All @@ -129,6 +130,8 @@ def update_graph(self, new: GraphT, select_new: bool = False) -> None:
self.edge_map[e].pop(edge_idx)
s, t = self.g.edge_st(e)
self.update_edge_curves(s, t)
if len(self.edge_map[e]) == 0:
del self.edge_map[e]

new_g = diff.apply_diff(self.g)
# Mypy issue: https://github.com/python/mypy/issues/11673
Expand Down
3 changes: 2 additions & 1 deletion zxlive/vitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def ty(self) -> VertexType:
_ty: VertexType = self.g.type(self.v)
return _ty


@property
def is_dragging(self) -> bool:
return self._old_pos is not None
Expand Down Expand Up @@ -424,7 +425,7 @@ def __init__(self, v_item: VItem) -> None:

def refresh(self) -> None:
"""Call this when a vertex moves or its phase changes"""
vertex_type = self.v_item.g.type(self.v_item.v)
vertex_type = self.v_item.ty
if vertex_type == VertexType.Z_BOX:
self.setPlainText(str(get_z_box_label(self.v_item.g, self.v_item.v)))
elif vertex_type != VertexType.BOUNDARY:
Expand Down
Loading