From c4e365dc1aba276a468121062718984b5813dd1e Mon Sep 17 00:00:00 2001 From: Mr-Anyone <53135664+Mr-Anyone@users.noreply.github.com> Date: Mon, 11 Nov 2024 19:01:57 -0800 Subject: [PATCH] following conventions after reading on a few pr --- .../thunderscope/gl/layers/gl_draw_polygon_obstacle.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/software/thunderscope/gl/layers/gl_draw_polygon_obstacle.py b/src/software/thunderscope/gl/layers/gl_draw_polygon_obstacle.py index b9384b48fc..0f703a9de8 100644 --- a/src/software/thunderscope/gl/layers/gl_draw_polygon_obstacle.py +++ b/src/software/thunderscope/gl/layers/gl_draw_polygon_obstacle.py @@ -6,6 +6,7 @@ from proto.import_all_protos import * from software.py_constants import * +from software.thunderscope.gl.helpers.observable_list import ObservableList from software.thunderscope.proto_unix_io import ProtoUnixIO from software.thunderscope.gl.layers.gl_layer import GLLayer @@ -37,7 +38,7 @@ def __init__( self.obstacles: List[Obstacle] = [] # used for keeping track and rendering multiple polygons - self.rendering_polygons: List[GLPolygon] = [] + self.rendering_polygons: ObservableList = ObservableList(self._graphics_changed) def keyPressEvent(self, event: QtGui.QKeyEvent) -> None: """Responding to key events that are going to push obstacles to the stack or add point @@ -57,7 +58,7 @@ def clear_polygons(self): for polygon in self.rendering_polygons: polygon.hide() - self.rendering_polygons.clear() + self.rendering_polygons.resize(0, lambda: {}) self.current_polygon.hide() self.current_polygon = GLPolygon(parent_item=self, line_width=2)