Formatting

This commit is contained in:
Ruben van de Ven 2024-10-07 10:09:37 +02:00
parent 2495d65c3c
commit 7af3499302

View file

@ -86,10 +86,10 @@ class DetectedObject:
self.canvas = canvas
# TODO handle variability
self.v = self.canvas.params.object_velocity
self.t = 40 # top
self.l = 0 # left
self.w = 10 # width
self.h = 20 # height
self.t = (self.canvas.height - self.h)/2 # top
self.shape = pyglet.shapes.Rectangle(self.l, self.t, self.w, self.h, color=(255, 22, 20), batch=self.canvas.batch_figures)
# rectangle.opacity = 128
@ -171,8 +171,6 @@ class Canvas:
self.fps_display.label.y = self.window.height - 17
self.fps_display.label.bold = False
self.fps_display.label.font_size = 10
self.label_time = pyglet.text.Label("t", x=20, y=self.height - 17, color=(255,255,255,255))
self.batch_figures = pyglet.graphics.Batch()
self.batch_bounding_boxes = pyglet.graphics.Batch()
@ -185,7 +183,7 @@ class Canvas:
'tracks': pyglet.text.Label("", x=120, y=30, color=(255,255,255,255), batch=self.batch_info),
}
for i, field in enumerate(dataclasses.fields(self.params)):
self.labels[field.name] = pyglet.text.Label(f"{field.name}: {field.default}", x=20, y=30 + 15*(i+1), color=(255,255,255,255), batch=self.batch_info)
self.labels[field.name] = pyglet.text.Label(f"{field.name}: {field.default}", x=20, y=30 + 20*(i+1), color=(255,255,255,255), batch=self.batch_info)
# TODO: Add a number next to the box using pyglet.graphics.Group()
self.track_shapes = MissingDict(self.getTrackBboxShapes)
@ -222,14 +220,11 @@ class Canvas:
self.event_loop.run()
def on_draw(self):
# print(time.monotonic())
self.label_time.text = f"{time.monotonic()}"
self.window.clear()
self.batch_figures.draw()
self.batch_bounding_boxes.draw()
self.batch_info.draw()
self.fps_display.draw()
self.label_time.draw()
def on_close(self):
logger.info('closing')