Skip to content

Commit

Permalink
Fixed a bug where CustomRules loading an old file would load it as a …
Browse files Browse the repository at this point in the history
…GraphS instead of a MultiGraph
  • Loading branch information
jvdwetering committed Jan 22, 2025
1 parent ecbe8c7 commit 5280470
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 3 additions & 4 deletions zxlive/custom_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,10 @@ def from_json(cls, json_str: Union[str,Dict[str,Any]]) -> "CustomRule":
d = json.loads(json_str)
else:
d = json_str
lhs_graph = GraphT.from_json(d['lhs_graph'])
rhs_graph = GraphT.from_json(d['rhs_graph'])
lhs_graph = pyzx.graph.jsonparser.json_to_graph(d['lhs_graph'],'multigraph')
rhs_graph = pyzx.graph.jsonparser.json_to_graph(d['rhs_graph'],'multigraph')
# Mypy issue: https://github.com/python/mypy/issues/11673
if TYPE_CHECKING:
assert (isinstance(lhs_graph, GraphT) and isinstance(rhs_graph, GraphT)) # type: ignore
assert (isinstance(lhs_graph, GraphT) and isinstance(rhs_graph, GraphT))
lhs_graph.set_auto_simplify(False)
rhs_graph.set_auto_simplify(False)
return cls(lhs_graph, rhs_graph, d['name'], d['description'])
Expand Down
2 changes: 0 additions & 2 deletions zxlive/proof.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,15 +259,13 @@ def set_model(self, model: ProofModel) -> None:
self.setCurrentIndex(model.index(len(model.steps), 0))

def move_to_step(self, index: int) -> None:
print("Moving to step", index)
idx = self.model().index(index, 0, QModelIndex())
self.clearSelection()
self.selectionModel().blockSignals(True)
self.setCurrentIndex(idx)
self.selectionModel().blockSignals(False)
self.update(idx)
g = self.model().get_graph(index)
print(g)
self.graph_view.set_graph(g)

def show_context_menu(self, position: QPoint) -> None:
Expand Down

0 comments on commit 5280470

Please sign in to comment.