GUI: added camera selection to gonio_camera_thread initialization

This commit is contained in:
appleb_m
2025-12-10 14:01:30 +01:00
parent 0ed2f85faa
commit e494fac5dd
2 changed files with 5 additions and 3 deletions
+2 -1
View File
@@ -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()
+3 -2
View File
@@ -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()