refactor: update camera handling with mock implementation and improve signal connections
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
import gphoto2 as gp
|
||||
# import gphoto2 as gp
|
||||
import numpy as np
|
||||
import cv2
|
||||
|
||||
from PySide6.QtCore import QObject, QThread, Signal
|
||||
from PySide6.QtGui import QImage, QPixmap
|
||||
|
||||
|
||||
# try:
|
||||
# import gphoto2 as gp
|
||||
# except:
|
||||
from . import mock_gphoto as gp
|
||||
|
||||
class CameraWorker(QObject):
|
||||
frameReady = Signal(QPixmap)
|
||||
@@ -20,7 +23,7 @@ class CameraWorker(QObject):
|
||||
def start_camera(self):
|
||||
"""Uruchom kamerę i zacznij pobierać klatki"""
|
||||
try:
|
||||
self.camera = gp.Camera()
|
||||
self.camera = gp.Camera() # type: ignore
|
||||
self.camera.init()
|
||||
self.running = True
|
||||
self._capture_loop()
|
||||
@@ -81,7 +84,7 @@ class CameraController(QObject):
|
||||
self.worker.errorOccurred.connect(self.errorOccurred)
|
||||
|
||||
# sygnały start/stop
|
||||
self.camera_thread .started.connect(self.worker.start_camera)
|
||||
self.camera_thread.started.connect(self.worker.start_camera)
|
||||
|
||||
def start(self):
|
||||
"""Start kamery w osobnym wątku"""
|
||||
|
||||
Reference in New Issue
Block a user