From 52804702741e7eee6a0740f51c930c6d300bd861 Mon Sep 17 00:00:00 2001 From: John van de Wetering Date: Wed, 22 Jan 2025 16:19:09 +0100 Subject: [PATCH] Fixed a bug where CustomRules loading an old file would load it as a GraphS instead of a MultiGraph --- zxlive/custom_rule.py | 7 +++---- zxlive/proof.py | 2 -- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/zxlive/custom_rule.py b/zxlive/custom_rule.py index f6b33e0..a19e37e 100644 --- a/zxlive/custom_rule.py +++ b/zxlive/custom_rule.py @@ -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']) diff --git a/zxlive/proof.py b/zxlive/proof.py index 6ee94c6..5856290 100644 --- a/zxlive/proof.py +++ b/zxlive/proof.py @@ -259,7 +259,6 @@ 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) @@ -267,7 +266,6 @@ def move_to_step(self, index: int) -> None: 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: