Skip to content

Commit a96f864

Browse files
committed
set initial value to list. annotate palette and circle
1 parent ef45945 commit a96f864

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

adafruit_displayio_layout/widgets/cartesian.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,9 @@ def __init__(
317317
self.append(self._screen_tilegrid)
318318
self.append(self._corner_tilegrid)
319319

320-
self._pointer = None
321-
self._circle_palette = None
322-
self.plot_line_point: Optional[List[Tuple[int, int]]] = None
320+
self._pointer: Optional[vectorio.Circle] = None
321+
self._circle_palette: Optional[displayio.Palette] = None
322+
self.plot_line_point: List[Tuple[int, int]] = []
323323

324324
@staticmethod
325325
def _get_font_height(font: terminalio.FONT, scale: int) -> Tuple[int, int]:
@@ -449,9 +449,6 @@ def _draw_pointers(self, x: int, y: int) -> None:
449449

450450
self._circle_palette = displayio.Palette(1)
451451

452-
# mypy, _circle_palette can't be None at this point
453-
assert self._circle_palette is not None
454-
455452
self._circle_palette[0] = self._pointer_color
456453
self._pointer = vectorio.Circle(
457454
radius=self._pointer_radius, x=x, y=y, pixel_shader=self._circle_palette
@@ -591,8 +588,6 @@ def update_pointer(self, x: int, y: int) -> None:
591588
:return: None
592589
rtype: None
593590
"""
594-
# mypy, plot_line_point can't be None at this point
595-
assert self.plot_line_point is not None
596591

597592
self._add_point(x, y)
598593
if not self._pointer:
@@ -616,8 +611,6 @@ def add_plot_line(self, x: int, y: int) -> None:
616611
617612
rtype: None
618613
"""
619-
# mypy, plot_line_point can't be None at this point
620-
assert self.plot_line_point is not None
621614

622615
self._add_point(x, y)
623616
if len(self.plot_line_point) > 1:
@@ -641,5 +634,5 @@ def clear_plot_lines(self, palette_index: int = 5) -> None:
641634
642635
rtype: None
643636
"""
644-
self.plot_line_point = None
637+
self.plot_line_point = []
645638
self._plot_bitmap.fill(palette_index)

0 commit comments

Comments
 (0)