Skip to content

Commit

Permalink
fixing mypy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
RazinShaikh committed Aug 30, 2024
1 parent 2835bd0 commit 9f217b6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion zxlive/eitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def __init__(self, item: Union[EItem, ET], property: EItem.Properties,
@property
def it(self) -> EItem:
if self._it is None and self.scene is not None and self.e is not None:
self._it = self.scene.edge_map[self.e]
self._it = self.scene.edge_map[self.e][0]
assert self._it is not None
return self._it

Expand Down
9 changes: 6 additions & 3 deletions zxlive/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ class ColorScheme(TypedDict):
"outline": QColor("#000000"),
}

classic_red_green: ColorScheme = modern_red_green | {
classic_red_green: ColorScheme = {
**modern_red_green,
"id": "classic-red-green",
"label": "Classic Red & Green",
"z_spider": QColor("#00ff00"),
Expand All @@ -121,7 +122,8 @@ class ColorScheme(TypedDict):
"x_spider_pressed": QColor("#dd0b00"),
}

white_gray: ColorScheme = modern_red_green | {
white_gray: ColorScheme = {
**modern_red_green,
"id": 'white-grey',
"label": "Dodo book White & Grey",
"z_spider": QColor("#ffffff"),
Expand All @@ -132,7 +134,8 @@ class ColorScheme(TypedDict):
"hadamard_pressed": QColor("#dddddd"),
}

gidney: ColorScheme = white_gray | {
gidney: ColorScheme = {
**white_gray,
"id": 'gidney',
"label": "Gidney's Black & White",
"z_spider": QColor("#000000"),
Expand Down
6 changes: 4 additions & 2 deletions zxlive/tikz.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from PySide6.QtCore import QSettings
from pyzx.tikz import TIKZ_BASE, _to_tikz

from .common import get_settings_value
from .common import GraphT, get_settings_value
from zxlive.proof import ProofModel


Expand All @@ -23,7 +23,9 @@ def proof_to_tikz(proof: ProofModel) -> str:

# Translate graph so that the first vertex starts at 0
min_x = min(g.row(v) for v in g.vertices())
g = g.translate(-min_x, 0)
g_t = g.translate(-min_x, 0)
assert isinstance(g_t, GraphT)
g = g_t

if i > 0:
rewrite = proof.steps[i-1]
Expand Down
4 changes: 2 additions & 2 deletions zxlive/vitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ def refresh(self) -> None:
pen = QPen()
if not self.isSelected():
color_key = color_map.get(self.ty, "boundary")
brush = QBrush(display_setting.colors[color_key])
brush = QBrush(display_setting.colors[color_key]) # type: ignore # https://github.com/python/mypy/issues/7178
pen.setWidthF(3)
pen.setColor(display_setting.colors["outline"])
else:
color_key = pressed_color_map.get(self.ty, "boundary_pressed")
brush = QBrush(display_setting.colors[color_key])
brush = QBrush(display_setting.colors[color_key]) # type: ignore # https://github.com/python/mypy/issues/7178
brush.setStyle(Qt.BrushStyle.Dense1Pattern)
pen.setWidthF(5)
if self.ty not in pressed_color_map:
Expand Down

0 comments on commit 9f217b6

Please sign in to comment.