diff options
author | Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> | 2022-05-27 17:44:27 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-05-27 22:03:30 +0300 |
commit | 6eb1143e27d284200a672f957c8e5efbf87aafcc (patch) | |
tree | 9748228da511accd82eccd984c2b2ec22ded2133 /src/py/cam/cam_qt.py | |
parent | bb1cbd53d267d45bcb8a8336a9daef5339e28f1a (diff) |
py: cam: Convert ctx and state to classes
Convert ctx and state dicts to classes. No functional changes.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/py/cam/cam_qt.py')
-rw-r--r-- | src/py/cam/cam_qt.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/py/cam/cam_qt.py b/src/py/cam/cam_qt.py index 03096920..d638e9cc 100644 --- a/src/py/cam/cam_qt.py +++ b/src/py/cam/cam_qt.py @@ -176,8 +176,8 @@ class QtRenderer: def __init__(self, state): self.state = state - self.cm = state['cm'] - self.contexts = state['contexts'] + self.cm = state.cm + self.contexts = state.contexts def setup(self): self.app = QtWidgets.QApplication([]) @@ -185,7 +185,7 @@ class QtRenderer: windows = [] for ctx in self.contexts: - for stream in ctx['streams']: + for stream in ctx.streams: window = MainWindow(ctx, stream) window.show() windows.append(window) @@ -206,7 +206,7 @@ class QtRenderer: print('Exiting...') def readcam(self): - running = self.state['event_handler'](self.state) + running = self.state.event_handler() if not running: self.app.quit() @@ -223,7 +223,7 @@ class QtRenderer: wnd.handle_request(stream, fb) - self.state['request_prcessed'](ctx, req) + self.state.request_processed(ctx, req) def cleanup(self): for w in self.windows: @@ -254,7 +254,7 @@ class MainWindow(QtWidgets.QWidget): group.setLayout(groupLayout) controlsLayout.addWidget(group) - lab = QtWidgets.QLabel(ctx['id']) + lab = QtWidgets.QLabel(ctx.id) groupLayout.addWidget(lab) self.frameLabel = QtWidgets.QLabel() @@ -265,7 +265,7 @@ class MainWindow(QtWidgets.QWidget): group.setLayout(groupLayout) controlsLayout.addWidget(group) - camera = ctx['camera'] + camera = ctx.camera for k, v in camera.properties.items(): lab = QtWidgets.QLabel() @@ -308,4 +308,4 @@ class MainWindow(QtWidgets.QWidget): self.label.setPixmap(pix) self.frameLabel.setText('Queued: {}\nDone: {}\nFps: {:.2f}' - .format(ctx['reqs-queued'], ctx['reqs-completed'], ctx['fps'])) + .format(ctx.reqs_queued, ctx.reqs_completed, ctx.fps)) |