diff --git a/zxlive/custom_rule.py b/zxlive/custom_rule.py index 14f68e7..5bffb15 100644 --- a/zxlive/custom_rule.py +++ b/zxlive/custom_rule.py @@ -266,11 +266,8 @@ def filter_matchings_if_symbolic_compatible(matchings: list[Dict[VT, VT]], left: for matching in matchings: if len(matching) != len(left): continue - try: - match_symbolic_parameters(matching, left, right) - new_matchings.append(matching) - except ValueError: - pass + match_symbolic_parameters(matching, left, right) + new_matchings.append(matching) return new_matchings diff --git a/zxlive/dialogs.py b/zxlive/dialogs.py index 81bca9b..d069f5f 100644 --- a/zxlive/dialogs.py +++ b/zxlive/dialogs.py @@ -210,10 +210,7 @@ def save_diagram_dialog(graph: GraphT, parent: QWidget) -> Optional[tuple[str, F file_path, selected_format = file_path_and_format if selected_format in (FileFormat.QGraph, FileFormat.Json): - try: - graph.auto_detect_io() - except TypeError: - pass + graph.auto_detect_io() data = graph.to_json() elif selected_format == FileFormat.QASM: try: diff --git a/zxlive/rewrite_action.py b/zxlive/rewrite_action.py index 4ca0c0d..5d359f6 100644 --- a/zxlive/rewrite_action.py +++ b/zxlive/rewrite_action.py @@ -112,6 +112,8 @@ def do_rewrite(self, panel: ProofPanel) -> None: try: g, rem_verts = self.apply_rewrite(g, matches) + except ValueError as ex: + raise ex except Exception as ex: show_error_msg('Error while applying rewrite rule', str(ex)) return diff --git a/zxlive/rule_panel.py b/zxlive/rule_panel.py index dbc4cd6..d950dde 100644 --- a/zxlive/rule_panel.py +++ b/zxlive/rule_panel.py @@ -96,12 +96,9 @@ def add_edge(self, u: VT, v: VT) -> None: self.update_io_labels(self.graph_scene) def update_io_labels(self, scene: EditGraphScene) -> None: - try: - scene.g.auto_detect_io() - for v in scene.g.vertices(): - if v in scene.g.inputs(): - scene.vertex_map[v].phase_item.setPlainText("in-" + str(scene.g.inputs().index(v))) - elif v in scene.g.outputs(): - scene.vertex_map[v].phase_item.setPlainText("out-" + str(scene.g.outputs().index(v))) - except TypeError: - return + scene.g.auto_detect_io() + for v in scene.g.vertices(): + if v in scene.g.inputs(): + scene.vertex_map[v].phase_item.setPlainText("in-" + str(scene.g.inputs().index(v))) + elif v in scene.g.outputs(): + scene.vertex_map[v].phase_item.setPlainText("out-" + str(scene.g.outputs().index(v))) diff --git a/zxlive/vitem.py b/zxlive/vitem.py index 8e386be..e704757 100644 --- a/zxlive/vitem.py +++ b/zxlive/vitem.py @@ -107,6 +107,7 @@ def g(self) -> GraphT: @property def ty(self) -> VertexType: + # https://github.com/zxcalc/zxlive/pull/281 _ty: VertexType = self.g.type(self.v) return _ty