From e494fac5dd4e8d176369fc58c66423174a8ca56b Mon Sep 17 00:00:00 2001 From: appleb_m Date: Wed, 10 Dec 2025 14:01:30 +0100 Subject: [PATCH] GUI: added camera selection to gonio_camera_thread initialization --- gui/src/aaregui/main_window.py | 3 ++- gui/src/aaregui/threads/axis_video_thread.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gui/src/aaregui/main_window.py b/gui/src/aaregui/main_window.py index 8bdaed3c..29ac523a 100644 --- a/gui/src/aaregui/main_window.py +++ b/gui/src/aaregui/main_window.py @@ -127,7 +127,8 @@ class MainWindow(QMainWindow): self.beamline_view_layout.addWidget(self.beamline_view) self.gonio_view = VideoGraphicsView() - self.gonio_camera_thread = VideoThread(ip="axis-accc8ed2972e.psi.ch") + #TODO add option to change cameras for gonio_camera_thread + self.gonio_camera_thread = VideoThread(ip="axis-accc8ed2972e.psi.ch", camera=3) self.gonio_camera_thread.frame_ready.connect(self.gonio_view.update_frame) self.gonio_camera_thread.frame_ready.connect(self.beamline_view_1_combined.update_frame) self.gonio_camera_thread.start() diff --git a/gui/src/aaregui/threads/axis_video_thread.py b/gui/src/aaregui/threads/axis_video_thread.py index b858cdd4..aaf4282c 100644 --- a/gui/src/aaregui/threads/axis_video_thread.py +++ b/gui/src/aaregui/threads/axis_video_thread.py @@ -10,19 +10,20 @@ class VideoThread(QThread): frame_ready = Signal(QImage) error_occurred = Signal(str) - def __init__(self, ip: str): + def __init__(self, ip: str, camera = 1): super().__init__() self.camera_ip = ip self.running = False self.session = None self.last_good_frame = None + self.camera: int = camera def set_camera_ip(self, ip: str): self.camera_ip = ip def run(self): # MJPEG URL - mjpeg_url = f"http://{self.camera_ip}/axis-cgi/mjpg/video.cgi?resolution=1280x720&fps=10" + mjpeg_url = f"http://{self.camera_ip}/axis-cgi/mjpg/video.cgi?resolution=1280x720&fps=20&compression=30&camera={self.camera}" # Create a session for connection reuse self.session = requests.Session()