Skip to content

Commit

Permalink
Fix mypy errors in proof_panel.py.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlyongemallo committed Dec 28, 2023
1 parent d63b1e8 commit 22fab45
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions zxlive/proof_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ def __init__(self, graph: GraphT, *actions: QAction) -> None:
self.step_view.setCurrentIndex(self.proof_model.index(0, 0))
self.step_view.selectionModel().selectionChanged.connect(self._proof_step_selected)
self.step_view.viewport().setAttribute(Qt.WidgetAttribute.WA_Hover)
self.step_view.doubleClicked.connect(self.__doubleClickHandler)
self.step_view.doubleClicked.connect(self._double_click_handler)

self.splitter.addWidget(self.step_view)

def __doubleClickHandler(self, index: QModelIndex | QPersistentModelIndex):
def _double_click_handler(self, index: QModelIndex | QPersistentModelIndex) -> None:
# The first row in the item list is the START step, which is not interactive
if index.row() == 0:
return
Expand All @@ -79,7 +79,7 @@ def __doubleClickHandler(self, index: QModelIndex | QPersistentModelIndex):
if ok:
# Subtract 1 from index since the START step isn't part of the model
old_name = self.proof_model.steps[index.row()-1].display_name
cmd = UndoableChange(self,
cmd = UndoableChange(self.graph_view,
lambda: self.proof_model.rename_step(index.row()-1, old_name),
lambda: self.proof_model.rename_step(index.row()-1, new_name)
)
Expand Down Expand Up @@ -300,7 +300,7 @@ def _unfuse_w(self, v: VT, left_neighbours: list[VT], mouse_dir: QPointF) -> Non
).normalized()

perp_dir = QVector2D(mouse_dir - QPointF(self.graph.row(v)/SCALE, self.graph.qubit(v)/SCALE)).normalized()
perp_dir -= QVector2D.dotProduct(perp_dir, par_dir) * par_dir
perp_dir -= par_dir * QVector2D.dotProduct(perp_dir, par_dir)
perp_dir.normalize()

out_offset_x = par_dir.x() * 0.5 + perp_dir.x() * 0.5
Expand Down Expand Up @@ -328,7 +328,8 @@ def _unfuse_w(self, v: VT, left_neighbours: list[VT], mouse_dir: QPointF) -> Non
cmd = AddRewriteStep(self.graph_view, new_g, self.step_view, "unfuse")
self.undo_stack.push(cmd, anim_after=anim)

def _unfuse(self, v: VT, left_neighbours: list[VT], mouse_dir: QPointF, phase: FractionLike) -> None:
def _unfuse(self, v: VT, left_neighbours: list[VT], mouse_dir: QPointF, phase: Union[FractionLike, complex]) -> \
None:
def snap_vector(v: QVector2D) -> None:
if abs(v.x()) > abs(v.y()):
v.setY(0.0)
Expand Down

0 comments on commit 22fab45

Please sign in to comment.