Compare commits
3 Commits
dev-linux
...
f2a002a249
| Author | SHA1 | Date | |
|---|---|---|---|
| f2a002a249 | |||
| d86a6429f7 | |||
| a1c608f279 |
@@ -1,31 +1,97 @@
|
||||
# import gphoto2 as gp
|
||||
import numpy as np
|
||||
import cv2
|
||||
|
||||
from PySide6.QtCore import QObject, QThread, Signal
|
||||
from ..core.base import BaseImageSource, BaseControlSource
|
||||
from PySide6.QtGui import QImage, QPixmap
|
||||
|
||||
# try:
|
||||
# import gphoto2 as gp
|
||||
# except:
|
||||
from . import mock_gphoto as gp
|
||||
|
||||
class CameraWorker(QObject):
|
||||
frameReady = Signal(QPixmap)
|
||||
errorOccurred = Signal(str)
|
||||
|
||||
def __init__(self, fps: int = 15, parent=None):
|
||||
super().__init__(parent)
|
||||
self.fps = fps
|
||||
self.running = False
|
||||
self.camera = None
|
||||
|
||||
def start_camera(self):
|
||||
"""Uruchom kamerę i zacznij pobierać klatki"""
|
||||
try:
|
||||
self.camera = gp.Camera() # type: ignore
|
||||
self.camera.init()
|
||||
self.running = True
|
||||
self._capture_loop()
|
||||
except gp.GPhoto2Error as e:
|
||||
self.errorOccurred.emit(f"Błąd inicjalizacji kamery: {e}")
|
||||
|
||||
def stop_camera(self):
|
||||
"""Zatrzymaj pobieranie"""
|
||||
self.running = False
|
||||
if self.camera:
|
||||
try:
|
||||
self.camera.exit()
|
||||
except gp.GPhoto2Error:
|
||||
pass
|
||||
self.camera = None
|
||||
|
||||
def _capture_loop(self):
|
||||
"""Pętla odczytu klatek w osobnym wątku"""
|
||||
import time
|
||||
delay = 1.0 / self.fps
|
||||
|
||||
while self.running:
|
||||
try:
|
||||
file = self.camera.capture_preview() # type: ignore
|
||||
data = file.get_data_and_size()
|
||||
frame = np.frombuffer(data, dtype=np.uint8)
|
||||
frame = cv2.imdecode(frame, cv2.IMREAD_COLOR)
|
||||
|
||||
if frame is not None:
|
||||
rgb_image = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
||||
h, w, ch = rgb_image.shape
|
||||
qimg = QImage(rgb_image.data, w, h, ch * w, QImage.Format.Format_RGB888)
|
||||
pixmap = QPixmap.fromImage(qimg)
|
||||
self.frameReady.emit(pixmap)
|
||||
|
||||
except gp.GPhoto2Error as e:
|
||||
self.errorOccurred.emit(f"Błąd odczytu LiveView: {e}")
|
||||
break
|
||||
except Exception as e:
|
||||
self.errorOccurred.emit(f"Nieoczekiwany błąd: {e}")
|
||||
break
|
||||
|
||||
time.sleep(delay)
|
||||
|
||||
|
||||
class CameraController(QObject):
|
||||
new_frame = Signal(object)
|
||||
frameReady = Signal(QPixmap)
|
||||
errorOccurred = Signal(str)
|
||||
|
||||
def __init__(self, image_source: BaseImageSource, control_source: BaseControlSource, parent=None):
|
||||
def __init__(self, fps: int = 15, parent=None):
|
||||
super().__init__(parent)
|
||||
self.image_source = image_source
|
||||
self.control_source = control_source
|
||||
self.camera_thread = QThread()
|
||||
self.worker = CameraWorker(fps)
|
||||
self.worker.moveToThread(self.camera_thread )
|
||||
|
||||
self.camera_thread = QThread()
|
||||
self.moveToThread(self.camera_thread)
|
||||
# sygnały z workera
|
||||
self.worker.frameReady.connect(self.frameReady)
|
||||
self.worker.errorOccurred.connect(self.errorOccurred)
|
||||
|
||||
self.image_source.moveToThread(self.camera_thread)
|
||||
self.control_source.moveToThread(self.camera_thread)
|
||||
|
||||
self.image_source.new_frame.connect(self.new_frame)
|
||||
self.image_source.errorOccurred.connect(self.errorOccurred)
|
||||
self.control_source.errorOccurred.connect(self.errorOccurred)
|
||||
# sygnały start/stop
|
||||
self.camera_thread.started.connect(self.worker.start_camera)
|
||||
|
||||
def start(self):
|
||||
"""Start kamery w osobnym wątku"""
|
||||
self.camera_thread.start()
|
||||
self.image_source.start()
|
||||
|
||||
def stop(self):
|
||||
self.image_source.stop()
|
||||
"""Stop kamery i zakończenie wątku"""
|
||||
self.worker.stop_camera()
|
||||
self.camera_thread.quit()
|
||||
self.camera_thread.wait()
|
||||
|
||||
@@ -6,8 +6,7 @@ from ui.widgets.color_list_widget import ColorListWidget
|
||||
from ui.widgets.thumbnail_list_widget import ThumbnailListWidget
|
||||
from ui.widgets.split_view_widget import SplitView
|
||||
from .camera_controller import CameraController
|
||||
from ..core.gphoto_adapter import GPhotoImageSource, GPhotoControlSource
|
||||
import gphoto2 as gp
|
||||
|
||||
|
||||
class MainController:
|
||||
def __init__(self, view):
|
||||
@@ -16,11 +15,7 @@ class MainController:
|
||||
self.media_repo = MediaRepository(self.db)
|
||||
self.media_repo.sync_media()
|
||||
|
||||
camera = gp.Camera()
|
||||
camera.init()
|
||||
stream = GPhotoImageSource(camera=camera, fps=15)
|
||||
controll = GPhotoControlSource(camera=camera)
|
||||
self.camera_controller = CameraController(stream, controll)
|
||||
self.camera_controller = CameraController()
|
||||
|
||||
self.view = view
|
||||
self.color_list: ColorListWidget = view.color_list_widget
|
||||
@@ -35,7 +30,7 @@ class MainController:
|
||||
self.thumbnail_list.selectedThumbnail.connect(self.on_thumbnail_selected)
|
||||
|
||||
self.camera_controller.errorOccurred.connect(self.split_view.widget_start.set_info_text)
|
||||
self.camera_controller.new_frame.connect(self.split_view.set_live_image)
|
||||
self.camera_controller.frameReady.connect(self.split_view.set_live_image)
|
||||
self.split_view.widget_start.camera_start_btn.clicked.connect(self.camera_controller.start)
|
||||
|
||||
def start_camera(self):
|
||||
|
||||
26
core/base.py
26
core/base.py
@@ -1,26 +0,0 @@
|
||||
from PySide6.QtCore import QObject, Signal
|
||||
from PySide6.QtGui import QPixmap
|
||||
|
||||
|
||||
class BaseImageSource(QObject):
|
||||
new_frame = Signal(QPixmap)
|
||||
errorOccurred = Signal(str)
|
||||
|
||||
def start(self):
|
||||
raise NotImplementedError
|
||||
|
||||
def stop(self):
|
||||
raise NotImplementedError
|
||||
|
||||
class BaseControlSource(QObject):
|
||||
errorOccurred = Signal(str)
|
||||
parameterChanged = Signal(str, object)
|
||||
|
||||
def set_parameter(self, name: str, value):
|
||||
raise NotImplementedError
|
||||
|
||||
def get_parameter(self, name: str):
|
||||
raise NotImplementedError
|
||||
|
||||
def list_parameters(self) -> dict:
|
||||
raise NotImplementedError
|
||||
@@ -1,69 +0,0 @@
|
||||
import cv2
|
||||
import gphoto2 as gp
|
||||
|
||||
from controllers.camera_controller import CameraController
|
||||
from .gphoto_adapter import GPhotoImageSource, GPhotoControlSource
|
||||
from .opencv_adapter import OpenCVImageSource, OpenCVControlSource
|
||||
|
||||
|
||||
class CameraManager:
|
||||
def __init__(self):
|
||||
self.devices = [] # lista wykrytych kamer
|
||||
|
||||
def detect_devices(self):
|
||||
self.devices.clear()
|
||||
|
||||
# --- Wykrywanie webcamów / grabberów HDMI
|
||||
for index in range(5): # sprawdź kilka indeksów
|
||||
cap = cv2.VideoCapture(index)
|
||||
if cap.isOpened():
|
||||
self.devices.append({
|
||||
"id": f"opencv:{index}",
|
||||
"name": f"Webcam / HDMI Grabber #{index}",
|
||||
"type": "opencv",
|
||||
"index": index
|
||||
})
|
||||
cap.release()
|
||||
|
||||
# --- Wykrywanie kamer gphoto2
|
||||
cameras = gp.Camera.autodetect() # type: ignore
|
||||
for i, (name, addr) in enumerate(cameras):
|
||||
self.devices.append({
|
||||
"id": f"gphoto:{i}",
|
||||
"name": f"{name} ({addr})",
|
||||
"type": "gphoto",
|
||||
"addr": addr
|
||||
})
|
||||
|
||||
return self.devices
|
||||
|
||||
def create_controller(self, device_id, hybrid_with=None):
|
||||
"""
|
||||
Tworzy CameraController na podstawie id urządzenia.
|
||||
Można podać hybrid_with="opencv" albo "gphoto" żeby zbudować hybrydę.
|
||||
"""
|
||||
device = next((d for d in self.devices if d["id"] == device_id), None)
|
||||
if not device:
|
||||
raise ValueError(f"Nie znaleziono urządzenia {device_id}")
|
||||
|
||||
# Webcam / grabber
|
||||
if device["type"] == "opencv":
|
||||
cap = cv2.VideoCapture(device["index"])
|
||||
img = OpenCVImageSource(device["index"])
|
||||
ctrl = OpenCVControlSource(cap)
|
||||
return CameraController(img, ctrl)
|
||||
|
||||
# GPhoto camera
|
||||
elif device["type"] == "gphoto":
|
||||
cam = gp.Camera() # type: ignore
|
||||
cam.init()
|
||||
img = GPhotoImageSource(cam)
|
||||
ctrl = GPhotoControlSource(cam)
|
||||
return CameraController(img, ctrl)
|
||||
|
||||
# Hybrydowy tryb
|
||||
elif device["type"] == "hybrid":
|
||||
raise NotImplementedError("Tu możesz połączyć OpenCV + GPhoto w hybrydę")
|
||||
|
||||
else:
|
||||
raise ValueError(f"Nieobsługiwany typ urządzenia: {device['type']}")
|
||||
@@ -1,84 +0,0 @@
|
||||
import numpy as np
|
||||
import cv2
|
||||
|
||||
from PySide6.QtCore import QObject, QThread, Signal, QTimer
|
||||
from PySide6.QtGui import QImage, QPixmap
|
||||
|
||||
from .base import BaseImageSource, BaseControlSource
|
||||
|
||||
import gphoto2 as gp
|
||||
|
||||
# try:
|
||||
# import gphoto2 as gp
|
||||
# except:
|
||||
# from . import mock_gphoto as gp
|
||||
|
||||
class GPhotoImageSource(BaseImageSource):
|
||||
|
||||
def __init__(self, camera: gp.Camera, fps=10, parent=None): # type: ignore
|
||||
super().__init__(parent)
|
||||
self.camera = camera
|
||||
self.fps = fps
|
||||
self.timer = None
|
||||
|
||||
def start(self):
|
||||
self.timer = QTimer()
|
||||
self.timer.timeout.connect(self._grab_frame)
|
||||
self.timer.start(int(1000 / self.fps))
|
||||
|
||||
def stop(self):
|
||||
if self.timer:
|
||||
self.timer.stop()
|
||||
|
||||
def _grab_frame(self):
|
||||
try:
|
||||
file = self.camera.capture_preview()
|
||||
data = file.get_data_and_size()
|
||||
frame = np.frombuffer(data, dtype=np.uint8)
|
||||
frame = cv2.imdecode(frame, cv2.IMREAD_COLOR)
|
||||
if frame is None:
|
||||
return
|
||||
|
||||
rgb_image = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
||||
h, w, ch = rgb_image.shape
|
||||
qimg = QImage(rgb_image.data, w, h, ch * w, QImage.Format.Format_RGB888)
|
||||
pixmap = QPixmap.fromImage(qimg)
|
||||
self.new_frame.emit(pixmap)
|
||||
except gp.GPhoto2Error as e:
|
||||
self.errorOccurred.emit(f"GPhoto2 error: {e}")
|
||||
|
||||
|
||||
class GPhotoControlSource(BaseControlSource):
|
||||
|
||||
def __init__(self, camera: gp.Camera, parent=None): # type: ignore
|
||||
super().__init__(parent)
|
||||
self.camera = camera
|
||||
|
||||
def set_parameter(self, name, value):
|
||||
try:
|
||||
config = self.camera.get_config()
|
||||
child = config.get_child_by_name(name)
|
||||
child.set_value(value)
|
||||
self.camera.set_config(config)
|
||||
self.parameterChanged.emit(name, value)
|
||||
except gp.GPhoto2Error as e:
|
||||
self.errorOccurred.emit(str(e))
|
||||
|
||||
def get_parameter(self, name):
|
||||
try:
|
||||
config = self.camera.get_config()
|
||||
child = config.get_child_by_name(name)
|
||||
return child.get_value()
|
||||
except gp.GPhoto2Error as e:
|
||||
self.errorOccurred.emit(str(e))
|
||||
return None
|
||||
|
||||
def list_parameters(self):
|
||||
params = {}
|
||||
try:
|
||||
config = self.camera.get_config()
|
||||
for child in config.get_children():
|
||||
params[child.get_name()] = child.get_value()
|
||||
except gp.GPhoto2Error as e:
|
||||
self.errorOccurred.emit(str(e))
|
||||
return params
|
||||
@@ -1,64 +0,0 @@
|
||||
import cv2
|
||||
import numpy as np
|
||||
|
||||
class GPhoto2Error(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class CameraFileMock:
|
||||
"""Mock obiektu zwracanego przez gphoto2.Camera.capture_preview()"""
|
||||
|
||||
def __init__(self, frame: np.ndarray):
|
||||
# Kodowanie do JPEG, żeby symulować prawdziwe dane z kamery
|
||||
success, buf = cv2.imencode(".jpg", frame)
|
||||
if not success:
|
||||
raise GPhoto2Error("Nie udało się zakodować ramki testowej.")
|
||||
self._data = buf.tobytes()
|
||||
|
||||
def get_data_and_size(self):
|
||||
return self._data
|
||||
return self._data, len(self._data)
|
||||
|
||||
|
||||
class Camera:
|
||||
def __init__(self):
|
||||
self._frame_counter = 0
|
||||
self._running = False
|
||||
|
||||
def init(self):
|
||||
self._running = True
|
||||
print("[my_gphoto] Kamera MOCK zainicjalizowana")
|
||||
|
||||
def exit(self):
|
||||
self._running = False
|
||||
print("[my_gphoto] Kamera MOCK wyłączona")
|
||||
|
||||
def capture_preview(self):
|
||||
if not self._running:
|
||||
raise GPhoto2Error("Kamera MOCK nie jest uruchomiona")
|
||||
|
||||
# przykład 1: wczytaj stały obrazek z pliku
|
||||
# frame = cv2.imread("test_frame.jpg")
|
||||
# if frame is None:
|
||||
# raise GPhoto2Error("Nie znaleziono test_frame.jpg")
|
||||
|
||||
# przykład 2: wygeneruj kolorową planszę
|
||||
h, w = 480, 640
|
||||
color = (self._frame_counter % 255, 100, 200)
|
||||
frame = np.full((h, w, 3), color, dtype=np.uint8)
|
||||
|
||||
# dodanie napisu
|
||||
text = "OBRAZ TESTOWY"
|
||||
font = cv2.FONT_HERSHEY_SIMPLEX
|
||||
scale = 1.5
|
||||
thickness = 3
|
||||
color_text = (255, 255, 255)
|
||||
|
||||
(text_w, text_h), _ = cv2.getTextSize(text, font, scale, thickness)
|
||||
x = (w - text_w) // 2
|
||||
y = (h + text_h) // 2
|
||||
cv2.putText(frame, text, (x, y), font, scale, color_text, thickness, cv2.LINE_AA)
|
||||
|
||||
|
||||
self._frame_counter += 1
|
||||
return CameraFileMock(frame)
|
||||
@@ -1,83 +0,0 @@
|
||||
from PySide6.QtCore import QObject, Signal, QTimer
|
||||
from PySide6.QtGui import QImage, QPixmap
|
||||
import cv2
|
||||
import numpy as np
|
||||
|
||||
|
||||
from .base import BaseImageSource, BaseControlSource
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class OpenCVImageSource(BaseImageSource):
|
||||
|
||||
def __init__(self, device_index=0, fps=30, parent=None):
|
||||
super().__init__(parent)
|
||||
self.device_index = device_index
|
||||
self.fps = fps
|
||||
self.cap = None
|
||||
self.timer = None
|
||||
|
||||
def start(self):
|
||||
self.cap = cv2.VideoCapture(self.device_index)
|
||||
if not self.cap.isOpened():
|
||||
self.errorOccurred.emit(f"Nie mogę otworzyć kamery {self.device_index}")
|
||||
return
|
||||
|
||||
self.timer = QTimer()
|
||||
self.timer.timeout.connect(self._grab_frame)
|
||||
self.timer.start(int(1000 / self.fps))
|
||||
|
||||
def stop(self):
|
||||
if self.timer:
|
||||
self.timer.stop()
|
||||
if self.cap:
|
||||
self.cap.release()
|
||||
|
||||
def _grab_frame(self):
|
||||
if self.cap is None:
|
||||
self.errorOccurred.emit(f"Kamera niezaincjalizowana!")
|
||||
return
|
||||
|
||||
ret, frame = self.cap.read()
|
||||
if not ret:
|
||||
self.errorOccurred.emit("Brak obrazu z kamery OpenCV")
|
||||
return
|
||||
|
||||
rgb_image = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
||||
h, w, ch = rgb_image.shape
|
||||
qimg = QImage(rgb_image.data, w, h, ch * w, QImage.Format.Format_RGB888)
|
||||
pixmap = QPixmap.fromImage(qimg)
|
||||
self.new_frame.emit(pixmap)
|
||||
|
||||
|
||||
class OpenCVControlSource(BaseControlSource):
|
||||
|
||||
def __init__(self, cap: cv2.VideoCapture, parent=None):
|
||||
super().__init__(parent)
|
||||
self.cap = cap
|
||||
|
||||
def set_parameter(self, name, value):
|
||||
prop_id = getattr(cv2, name, None)
|
||||
if prop_id is None:
|
||||
self.errorOccurred.emit(f"Nieznany parametr {name}")
|
||||
return
|
||||
self.cap.set(prop_id, value)
|
||||
self.parameterChanged.emit(name, value)
|
||||
|
||||
def get_parameter(self, name):
|
||||
prop_id = getattr(cv2, name, None)
|
||||
if prop_id is None:
|
||||
self.errorOccurred.emit(f"Nieznany parametr {name}")
|
||||
return None
|
||||
return self.cap.get(prop_id)
|
||||
|
||||
def list_parameters(self):
|
||||
return {
|
||||
"CAP_PROP_BRIGHTNESS": self.cap.get(cv2.CAP_PROP_BRIGHTNESS),
|
||||
"CAP_PROP_CONTRAST": self.cap.get(cv2.CAP_PROP_CONTRAST),
|
||||
"CAP_PROP_SATURATION": self.cap.get(cv2.CAP_PROP_SATURATION),
|
||||
"CAP_PROP_GAIN": self.cap.get(cv2.CAP_PROP_GAIN),
|
||||
"CAP_PROP_EXPOSURE": self.cap.get(cv2.CAP_PROP_EXPOSURE),
|
||||
}
|
||||
4
main.py
4
main.py
@@ -1,6 +1,7 @@
|
||||
import sys
|
||||
from PySide6.QtWidgets import QApplication
|
||||
|
||||
from ui.main_palette import set_dark_theme
|
||||
from ui.main_window import MainWindow
|
||||
from controllers.main_controller import MainController
|
||||
|
||||
@@ -8,7 +9,8 @@ from controllers.main_controller import MainController
|
||||
|
||||
def main():
|
||||
app = QApplication(sys.argv)
|
||||
app.setStyle("Fusion")
|
||||
set_dark_theme(app)
|
||||
# app.setStyle("Fusion")
|
||||
window = MainWindow()
|
||||
controller = MainController(window)
|
||||
controller.load_colors()
|
||||
|
||||
4
ui/icons/flip-horizontal-svgrepo-com.svg
Normal file
4
ui/icons/flip-horizontal-svgrepo-com.svg
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.079 3.46209C15.3762 3.17355 15.851 3.18054 16.1396 3.47771L19.538 6.9777C19.8205 7.26871 19.8205 7.73162 19.538 8.02263L16.1396 11.5226C15.851 11.8198 15.3762 11.8268 15.079 11.5382C14.7819 11.2497 14.7749 10.7749 15.0634 10.4777L17.2263 8.25015L4.99989 8.25015C4.58567 8.25015 4.24989 7.91437 4.24989 7.50015C4.24989 7.08594 4.58567 6.75015 4.99989 6.75015L17.2263 6.75015L15.0634 4.52264C14.7749 4.22546 14.7819 3.75064 15.079 3.46209ZM8.92071 12.4618C9.21788 12.7504 9.22488 13.2252 8.93633 13.5224L6.77327 15.7501L18.9999 15.7501C19.4141 15.7501 19.7499 16.0859 19.7499 16.5001C19.7499 16.9143 19.4141 17.2501 18.9999 17.2501L6.77366 17.2501L8.93633 19.4774C9.22488 19.7746 9.21788 20.2494 8.92071 20.538C8.62353 20.8265 8.14871 20.8195 7.86016 20.5224L4.46177 17.0224C4.17922 16.7314 4.17922 16.2685 4.46177 15.9774L7.86016 12.4775C8.14871 12.1803 8.62353 12.1733 8.92071 12.4618Z" fill="#000000"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
5
ui/icons/flip-vertical-svgrepo-com.svg
Normal file
5
ui/icons/flip-vertical-svgrepo-com.svg
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.49976 4.25001C7.91398 4.25001 8.24976 4.5858 8.24976 5.00001L8.24976 17.2266L10.4775 15.0636C10.7747 14.775 11.2495 14.782 11.538 15.0792C11.8266 15.3763 11.8196 15.8512 11.5224 16.1397L8.02243 19.5381C7.73142 19.8207 7.26851 19.8207 6.9775 19.5381L3.47751 16.1397C3.18034 15.8512 3.17335 15.3763 3.4619 15.0792C3.75044 14.782 4.22527 14.775 4.52244 15.0636L6.74976 17.2262L6.74976 5.00001C6.74976 4.5858 7.08555 4.25001 7.49976 4.25001Z" fill="#000000"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.9773 4.4619C16.2683 4.17934 16.7312 4.17934 17.0222 4.4619L20.5222 7.86029C20.8193 8.14884 20.8263 8.62366 20.5378 8.92083C20.2492 9.21801 19.7744 9.225 19.4772 8.93645L17.2497 6.7736L17.2497 19C17.2497 19.4142 16.9139 19.75 16.4997 19.75C16.0855 19.75 15.7497 19.4142 15.7497 19L15.7497 6.77358L13.5222 8.93645C13.225 9.225 12.7502 9.21801 12.4616 8.92083C12.1731 8.62366 12.1801 8.14884 12.4773 7.86029L15.9773 4.4619Z" fill="#000000"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
40
ui/icons/horizontal-stacks-svgrepo-com.svg
Normal file
40
ui/icons/horizontal-stacks-svgrepo-com.svg
Normal file
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
|
||||
<svg
|
||||
fill="#000000"
|
||||
width="800px"
|
||||
height="800px"
|
||||
viewBox="0 0 16 16"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
sodipodi:docname="horizontal-stacks-svgrepo-com.svg"
|
||||
inkscape:version="1.4.2 (f4327f4, 2025-05-13)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs
|
||||
id="defs1" />
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:zoom="0.98875"
|
||||
inkscape:cx="579.5196"
|
||||
inkscape:cy="342.35145"
|
||||
inkscape:window-width="3440"
|
||||
inkscape:window-height="1369"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg1" />
|
||||
<path
|
||||
d="M 13.5,14.82 V 1.18 C 13.5,0.53 12.97,0 12.32,0 H 9.8 C 9.15,0 8.62,0.53 8.62,1.18 V 14.82 C 8.62,15.47 9.15,16 9.8,16 h 2.52 c 0.65,0 1.18,-0.53 1.18,-1.18 z M 9.88,14.75 V 1.25 h 2.37 v 13.5 z m -2.5,0.07 V 1.18 C 7.38,0.53 6.85,0 6.2,0 H 3.68 C 3.03,0 2.5,0.53 2.5,1.18 V 14.82 C 2.5,15.47 3.03,16 3.68,16 H 6.2 c 0.65,0 1.18,-0.53 1.18,-1.18 z M 3.75,14.75 V 1.25 h 2.38 v 13.5 z"
|
||||
id="path1" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
4
ui/icons/rotate-ccw-svgrepo-com.svg
Normal file
4
ui/icons/rotate-ccw-svgrepo-com.svg
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M12.5 20.5C17.1944 20.5 21 16.6944 21 12C21 7.30558 17.1944 3.5 12.5 3.5C7.80558 3.5 4 7.30558 4 12C4 13.5433 4.41128 14.9905 5.13022 16.238M1.5 15L5.13022 16.238M6.82531 12.3832L5.47107 16.3542L5.13022 16.238" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 533 B |
4
ui/icons/rotate-cw-svgrepo-com.svg
Normal file
4
ui/icons/rotate-cw-svgrepo-com.svg
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M11.5 20.5C6.80558 20.5 3 16.6944 3 12C3 7.30558 6.80558 3.5 11.5 3.5C16.1944 3.5 20 7.30558 20 12C20 13.5433 19.5887 14.9905 18.8698 16.238M22.5 15L18.8698 16.238M17.1747 12.3832L18.5289 16.3542L18.8698 16.238" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 534 B |
2
ui/icons/vertical-stacks-svgrepo-com.svg
Normal file
2
ui/icons/vertical-stacks-svgrepo-com.svg
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg fill="#000000" width="800px" height="800px" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M14.82 2.5H1.18C.53 2.5 0 3.03 0 3.68V6.2c0 .65.53 1.18 1.18 1.18h13.64c.65 0 1.18-.53 1.18-1.18V3.68c0-.65-.53-1.18-1.18-1.18zm-.07 3.62H1.25V3.75h13.5v2.37zm.07 2.5H1.18C.53 8.62 0 9.15 0 9.8v2.52c0 .65.53 1.18 1.18 1.18h13.64c.65 0 1.18-.53 1.18-1.18V9.8c0-.65-.53-1.18-1.18-1.18zm-.07 3.63H1.25V9.87h13.5v2.38z"/></svg>
|
||||
|
After Width: | Height: | Size: 556 B |
48
ui/main_palette.py
Normal file
48
ui/main_palette.py
Normal file
@@ -0,0 +1,48 @@
|
||||
import sys
|
||||
from PySide6.QtWidgets import QApplication
|
||||
from PySide6.QtGui import QPalette, QColor
|
||||
from PySide6.QtCore import Qt
|
||||
|
||||
def set_dark_theme(app: QApplication):
|
||||
"""Definiuje i stosuje ciemną paletę kolorów do aplikacji."""
|
||||
|
||||
# 1. Upewnij się, że styl jest ustawiony na "Fusion"
|
||||
app.setStyle('Fusion')
|
||||
|
||||
# 2. Definicja kolorów dla ciemnego motywu
|
||||
palette = QPalette()
|
||||
|
||||
# Kolory tła
|
||||
DARK_GRAY = QColor(45, 45, 45) # Ogólne tło okien i widżetów (Base, Window)
|
||||
LIGHT_GRAY = QColor(53, 53, 53) # Tło elementów, np. toolbara, menu (Window)
|
||||
VERY_DARK_GRAY = QColor(32, 32, 32) # Kolor tła dla kontrolek (Button)
|
||||
|
||||
# Kolory tekstu i obramowań
|
||||
WHITE = QColor(200, 200, 200) # Główny kolor tekstu (Text, WindowText)
|
||||
HIGHLIGHT = QColor(66, 135, 245) # Kolor podświetlenia (Highlight)
|
||||
|
||||
# Ustawienie głównej palety
|
||||
# palette.setColor(QPalette.ColorRole.Window, LIGHT_GRAY)
|
||||
palette.setColor(QPalette.ColorRole.Window, VERY_DARK_GRAY)
|
||||
palette.setColor(QPalette.ColorRole.WindowText, WHITE)
|
||||
palette.setColor(QPalette.ColorRole.Base, DARK_GRAY)
|
||||
palette.setColor(QPalette.ColorRole.AlternateBase, LIGHT_GRAY)
|
||||
palette.setColor(QPalette.ColorRole.ToolTipBase, WHITE)
|
||||
palette.setColor(QPalette.ColorRole.ToolTipText, WHITE)
|
||||
palette.setColor(QPalette.ColorRole.Text, WHITE)
|
||||
palette.setColor(QPalette.ColorRole.Button, VERY_DARK_GRAY)
|
||||
palette.setColor(QPalette.ColorRole.ButtonText, WHITE)
|
||||
palette.setColor(QPalette.ColorRole.BrightText, Qt.GlobalColor.red)
|
||||
palette.setColor(QPalette.ColorRole.Link, QColor(42, 130, 218))
|
||||
palette.setColor(QPalette.ColorRole.PlaceholderText, QColor(150, 150, 150))
|
||||
|
||||
# Kolory zaznaczenia/interakcji
|
||||
palette.setColor(QPalette.ColorRole.Highlight, HIGHLIGHT)
|
||||
palette.setColor(QPalette.ColorRole.HighlightedText, Qt.GlobalColor.black)
|
||||
|
||||
# Kontrolki wyłączone (Disabled)
|
||||
# palette.setColor(QPalette.ColorRole.Disabled, QPalette.ColorGroup.Active, QPalette.ColorRole.Text, QColor(127, 127, 127))
|
||||
# palette.setColor(QPalette.ColorRole.Disabled, QPalette.ColorGroup.Active, QPalette.ColorRole.ButtonText, QColor(127, 127, 127))
|
||||
|
||||
# 3. Zastosowanie palety do aplikacji
|
||||
app.setPalette(palette)
|
||||
@@ -10,6 +10,7 @@ from ui.widgets.placeholder_widget import PlaceholderWidget
|
||||
from ui.widgets.color_list_widget import ColorListWidget
|
||||
from ui.widgets.thumbnail_list_widget import ThumbnailListWidget
|
||||
from ui.widgets.split_view_widget import SplitView
|
||||
from ui.view_settings_dialog import ViewSettingsDialog
|
||||
|
||||
class MainWindow(QMainWindow):
|
||||
def __init__(self):
|
||||
@@ -42,6 +43,13 @@ class MainWindow(QMainWindow):
|
||||
histogram_view = PlaceholderWidget("Histogram View", "#FF5733")
|
||||
histogram_view.setFixedHeight(200)
|
||||
|
||||
self.view_settings_button = QPushButton("Ustawienia widoku")
|
||||
control_layout.addWidget(self.view_settings_button)
|
||||
|
||||
self.view_settings_dialog = ViewSettingsDialog(self)
|
||||
self.view_settings_button.clicked.connect(self.view_settings_dialog.show)
|
||||
|
||||
|
||||
self.color_list_widget = ColorListWidget(self.control_widget)
|
||||
|
||||
self.record_button = QPushButton("Nagraj Wideo")
|
||||
|
||||
30
ui/view_settings_dialog.py
Normal file
30
ui/view_settings_dialog.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from PySide6.QtWidgets import QDialog, QHBoxLayout ,QVBoxLayout, QPushButton
|
||||
from PySide6.QtCore import Qt
|
||||
|
||||
|
||||
|
||||
class ViewSettingsDialog(QDialog):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.setWindowTitle("Ustawienia widoku")
|
||||
self.setFixedSize(300, 200)
|
||||
|
||||
self.setWindowFlags(self.windowFlags() | Qt.WindowStaysOnTopHint)
|
||||
|
||||
self.setup_ui()
|
||||
|
||||
def setup_ui(self):
|
||||
self.main_layout = QVBoxLayout(self)
|
||||
|
||||
self.btn_layout = QHBoxLayout()
|
||||
self.btn_layout.addStretch()
|
||||
|
||||
self.ok_button = QPushButton("OK")
|
||||
self.ok_button.clicked.connect(self.accept)
|
||||
self.btn_layout.addWidget(self.ok_button)
|
||||
|
||||
self.cancel_button = QPushButton("Anuluj")
|
||||
self.cancel_button.clicked.connect(self.reject)
|
||||
self.btn_layout.addWidget(self.cancel_button)
|
||||
|
||||
self.main_layout.addLayout(self.btn_layout)
|
||||
@@ -1,9 +1,10 @@
|
||||
from PySide6.QtWidgets import QGraphicsView, QGraphicsScene, QGraphicsPixmapItem, QApplication, QMainWindow, QWidget, QVBoxLayout, QSplitter, QStackedWidget, QPushButton, QLabel
|
||||
from PySide6.QtGui import QPixmap, QWheelEvent, QPainter, QBrush, QColor
|
||||
from PySide6.QtCore import Qt
|
||||
from PySide6.QtWidgets import QGraphicsView, QGraphicsScene, QGraphicsPixmapItem, QApplication, QMainWindow, QWidget, QVBoxLayout, QSplitter, QStackedWidget, QPushButton, QLabel, QToolButton
|
||||
from PySide6.QtGui import QEnterEvent, QPixmap, QWheelEvent, QPainter, QBrush, QColor, QIcon
|
||||
from PySide6.QtCore import Qt, QSize, Signal, QEvent
|
||||
import sys
|
||||
from ui.widgets.placeholder_widget import PlaceholderWidget
|
||||
|
||||
|
||||
class ZoomableImageView(QGraphicsView):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
@@ -11,18 +12,21 @@ class ZoomableImageView(QGraphicsView):
|
||||
# Scena i element obrazu
|
||||
self._scene = QGraphicsScene(self)
|
||||
self.setScene(self._scene)
|
||||
self._scene.setBackgroundBrush(QBrush(QColor(20, 20, 20))) # ciemne tło
|
||||
self._scene.setBackgroundBrush(
|
||||
QBrush(QColor(20, 20, 20))) # ciemne tło
|
||||
|
||||
self._pixmap_item = QGraphicsPixmapItem()
|
||||
self._scene.addItem(self._pixmap_item)
|
||||
|
||||
# Ustawienia widoku
|
||||
self.setDragMode(QGraphicsView.DragMode.ScrollHandDrag) # przesuwanie myszą
|
||||
# przesuwanie myszą
|
||||
self.setDragMode(QGraphicsView.DragMode.ScrollHandDrag)
|
||||
self.setRenderHint(QPainter.RenderHint.Antialiasing)
|
||||
self.setRenderHint(QPainter.RenderHint.SmoothPixmapTransform)
|
||||
|
||||
# Wyłączenie suwaków
|
||||
self.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
|
||||
self.setHorizontalScrollBarPolicy(
|
||||
Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
|
||||
self.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff)
|
||||
# Parametry zoomu
|
||||
self._zoom_factor = 1.25
|
||||
@@ -53,6 +57,7 @@ class ZoomableImageView(QGraphicsView):
|
||||
return
|
||||
super().wheelEvent(event) # normalne przewijanie
|
||||
|
||||
|
||||
class CameraPlaceholder(QWidget):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
@@ -91,11 +96,13 @@ class CameraPlaceholder(QWidget):
|
||||
self.camera_start_btn.setStyleSheet(style_sheet)
|
||||
|
||||
self.info_label = QLabel("Kliknij, aby uruchomić kamerę")
|
||||
self.info_label.setStyleSheet("background-color: transparent; color: #CECECE; font-size: 18px;")
|
||||
self.info_label.setStyleSheet(
|
||||
"background-color: transparent; color: #CECECE; font-size: 18px;")
|
||||
self.info_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
||||
|
||||
layout.addStretch()
|
||||
layout.addWidget(self.camera_start_btn, alignment=Qt.AlignmentFlag.AlignCenter)
|
||||
layout.addWidget(self.camera_start_btn,
|
||||
alignment=Qt.AlignmentFlag.AlignCenter)
|
||||
layout.addWidget(self.info_label)
|
||||
layout.addStretch()
|
||||
self.setLayout(layout)
|
||||
@@ -103,6 +110,112 @@ class CameraPlaceholder(QWidget):
|
||||
def set_info_text(self, text: str):
|
||||
self.info_label.setText(text)
|
||||
|
||||
|
||||
class ViewWithOverlay(QWidget):
|
||||
toggleOrientation = Signal()
|
||||
swapViews = Signal()
|
||||
rotateCW = Signal()
|
||||
rotateCCW = Signal()
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
layout = QVBoxLayout(self)
|
||||
layout.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
self.viewer = ZoomableImageView()
|
||||
layout.addWidget(self.viewer)
|
||||
|
||||
icon_size = QSize(32, 32)
|
||||
btn_size = (48, 48)
|
||||
btn_style = """
|
||||
background-color: rgba(255, 255, 255, 0.5);
|
||||
border-radius: 8px;
|
||||
border: 2px solid #1f1f1f;
|
||||
"""
|
||||
|
||||
|
||||
self.cw_btn = QToolButton(self)
|
||||
self.cw_btn.setIcon(QIcon("ui/icons/rotate-cw-svgrepo-com.svg"))
|
||||
self.cw_btn.setIconSize(icon_size)
|
||||
self.cw_btn.setStyleSheet(btn_style)
|
||||
self.cw_btn.setFixedSize(*btn_size)
|
||||
move_x = self.cw_btn.width() + 10
|
||||
self.cw_btn.move(self.width() - move_x, 10)
|
||||
self.cw_btn.clicked.connect(self.rotateCW)
|
||||
|
||||
self.ccw_btn = QToolButton(self)
|
||||
self.ccw_btn.setIcon(QIcon("ui/icons/rotate-ccw-svgrepo-com.svg"))
|
||||
self.ccw_btn.setIconSize(icon_size)
|
||||
self.ccw_btn.setStyleSheet(btn_style)
|
||||
self.ccw_btn.setFixedSize(*btn_size)
|
||||
move_x += self.ccw_btn.width() + 10
|
||||
self.ccw_btn.move(self.width() - move_x, 10)
|
||||
self.ccw_btn.clicked.connect(self.rotateCCW)
|
||||
|
||||
self.flip_btn = QToolButton(self)
|
||||
# self.flip_btn.setIcon(QIcon("ui/icons/flip-vertical-svgrepo-com.svg"))
|
||||
self.flip_btn.setIconSize(icon_size)
|
||||
self.flip_btn.setStyleSheet(btn_style)
|
||||
self.flip_btn.setFixedSize(*btn_size)
|
||||
move_x += self.flip_btn.width() + 10
|
||||
self.flip_btn.move(self.width() - move_x, 10)
|
||||
self.flip_btn.clicked.connect(self.swapViews)
|
||||
|
||||
self.orient_btn = QToolButton(self)
|
||||
# self.orient_btn.setIcon(QIcon("ui/icons/horizontal-stacks-svgrepo-com.svg"))
|
||||
self.orient_btn.setIconSize(icon_size)
|
||||
self.orient_btn.setStyleSheet(btn_style)
|
||||
self.orient_btn.setFixedSize(*btn_size)
|
||||
move_x += self.orient_btn.width() + 10
|
||||
self.orient_btn.move(self.width() - move_x, 10)
|
||||
self.orient_btn.clicked.connect(self.toggleOrientation)
|
||||
|
||||
|
||||
self.cw_btn.raise_()
|
||||
self.ccw_btn.raise_()
|
||||
self.flip_btn.raise_()
|
||||
self.orient_btn.raise_()
|
||||
|
||||
self.toggle_orientation(Qt.Orientation.Vertical)
|
||||
|
||||
def set_image(self, pixmap: QPixmap):
|
||||
self.viewer.set_image(pixmap)
|
||||
|
||||
def resizeEvent(self, event):
|
||||
super().resizeEvent(event)
|
||||
# Aktualizacja pozycji przycisku przy zmianie rozmiaru
|
||||
move_x = self.cw_btn.width() + 10
|
||||
self.cw_btn.move(self.width() - move_x, 10)
|
||||
move_x += self.ccw_btn.width() + 10
|
||||
self.ccw_btn.move(self.width() - move_x, 10)
|
||||
move_x += self.flip_btn.width() + 10
|
||||
self.flip_btn.move(self.width() - move_x, 10)
|
||||
move_x += self.orient_btn.width() + 10
|
||||
self.orient_btn.move(self.width() - move_x, 10)
|
||||
|
||||
def toggle_orientation(self, orientation):
|
||||
if orientation == Qt.Orientation.Vertical:
|
||||
self.flip_btn.setIcon(QIcon("ui/icons/flip-vertical-svgrepo-com.svg"))
|
||||
self.orient_btn.setIcon(QIcon("ui/icons/horizontal-stacks-svgrepo-com.svg"))
|
||||
else:
|
||||
self.flip_btn.setIcon(QIcon("ui/icons/flip-horizontal-svgrepo-com.svg"))
|
||||
self.orient_btn.setIcon(QIcon("ui/icons/vertical-stacks-svgrepo-com.svg"))
|
||||
|
||||
def enterEvent(self, event: QEnterEvent) -> None:
|
||||
self.orient_btn.show()
|
||||
self.flip_btn.show()
|
||||
self.ccw_btn.show()
|
||||
self.cw_btn.show()
|
||||
return super().enterEvent(event)
|
||||
|
||||
def leaveEvent(self, event: QEvent) -> None:
|
||||
self.orient_btn.hide()
|
||||
self.flip_btn.hide()
|
||||
self.ccw_btn.hide()
|
||||
self.cw_btn.hide()
|
||||
return super().leaveEvent(event)
|
||||
|
||||
|
||||
class SplitView(QSplitter):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
@@ -110,9 +223,11 @@ class SplitView(QSplitter):
|
||||
self.setOrientation(Qt.Orientation.Vertical)
|
||||
|
||||
self.widget_start = CameraPlaceholder()
|
||||
self.widget_live = ZoomableImageView()
|
||||
# self.widget_live = ZoomableImageView()
|
||||
self.widget_live = ViewWithOverlay()
|
||||
# self.widget_live = PlaceholderWidget("Camera View", "#750466")
|
||||
self.widget_ref = ZoomableImageView()
|
||||
# self.widget_ref = ZoomableImageView()
|
||||
self.widget_ref = ViewWithOverlay()
|
||||
# self.widget_ref = PlaceholderWidget("Image View", "#007981")
|
||||
|
||||
self.stack = QStackedWidget()
|
||||
@@ -129,18 +244,31 @@ class SplitView(QSplitter):
|
||||
# pixmap.fill(Qt.GlobalColor.lightGray)
|
||||
self.widget_live.set_image(pixmap)
|
||||
|
||||
self.widget_live.toggleOrientation.connect(self.toggle_orientation)
|
||||
self.widget_ref.toggleOrientation.connect(self.toggle_orientation)
|
||||
self.widget_live.swapViews.connect(self.swap_views)
|
||||
self.widget_ref.swapViews.connect(self.swap_views)
|
||||
|
||||
def toggle_orientation(self):
|
||||
if self.orientation() == Qt.Orientation.Vertical:
|
||||
self.setOrientation(Qt.Orientation.Horizontal)
|
||||
self.setSizes([self.width()//2, self.width()//2])
|
||||
self.widget_live.toggle_orientation(Qt.Orientation.Horizontal)
|
||||
self.widget_ref.toggle_orientation(Qt.Orientation.Horizontal)
|
||||
else:
|
||||
self.setOrientation(Qt.Orientation.Vertical)
|
||||
self.setSizes([self.height()//2, self.height()//2])
|
||||
|
||||
# def set_live_image(self, path_image: str):
|
||||
# """Ustawienie obrazu na żywo"""
|
||||
# pixmap = QPixmap(path_image)
|
||||
# self.widget_live.set_image(pixmap)
|
||||
self.widget_live.toggle_orientation(Qt.Orientation.Vertical)
|
||||
self.widget_ref.toggle_orientation(Qt.Orientation.Vertical)
|
||||
|
||||
def swap_views(self):
|
||||
"""Zamiana widoków miejscami"""
|
||||
index_live = self.indexOf(self.stack)
|
||||
index_ref = self.indexOf(self.widget_ref)
|
||||
sizes = self.sizes()
|
||||
self.insertWidget(index_live, self.widget_ref)
|
||||
self.insertWidget(index_ref, self.stack)
|
||||
self.setSizes(sizes)
|
||||
|
||||
def set_live_image(self, pixmap: QPixmap):
|
||||
"""Ustawienie obrazu na żywo"""
|
||||
@@ -159,6 +287,3 @@ class SplitView(QSplitter):
|
||||
self.stack.setCurrentWidget(self.widget_live)
|
||||
else:
|
||||
self.stack.setCurrentWidget(self.widget_start)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user