|
@@ -2,13 +2,14 @@
|
|
|
from PySide6.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLineEdit, QComboBox, QPushButton, QMessageBox
|
|
|
from widgets.PStackedWidget import PStackedWidget
|
|
|
from module.cam import IPCam, USBCam, get_list_name_cam
|
|
|
-
|
|
|
+from logger import logger
|
|
|
|
|
|
class PCamChecked(QWidget):
|
|
|
def __init__(self, parent=None, mode: str = 'video') -> None:
|
|
|
super().__init__(parent)
|
|
|
|
|
|
self.__mode = mode
|
|
|
+ self.__wwc = None
|
|
|
|
|
|
self.vLayout = QVBoxLayout(self)
|
|
|
self.vLayout.setObjectName(u'vLayout')
|
|
@@ -39,7 +40,7 @@ class PCamChecked(QWidget):
|
|
|
self.btn_stop = QPushButton(self)
|
|
|
self.btn_stop.setObjectName('btn_stop')
|
|
|
self.btn_stop.setText('Остановить')
|
|
|
- self.btn_stop.clicked.connect(self.__stop_cam)
|
|
|
+ self.btn_stop.clicked.connect(self.stop_cam)
|
|
|
self.hLayout.addWidget(self.btn_stop)
|
|
|
|
|
|
self.vLayout.addLayout(self.hLayout)
|
|
@@ -53,26 +54,26 @@ class PCamChecked(QWidget):
|
|
|
case _: return None
|
|
|
|
|
|
def __start_cam(self) -> None:
|
|
|
-
|
|
|
match self.__mode:
|
|
|
case 'video':
|
|
|
self.pStackedWidget.to_video()
|
|
|
self.__wwc = USBCam(self.pStackedWidget.video,
|
|
|
self.line_cam.currentText())
|
|
|
self.__wwc.start_cam()
|
|
|
+ logger.info("Start USB cam")
|
|
|
case 'snapshot':
|
|
|
self.pStackedWidget.to_video()
|
|
|
self.__wwc = IPCam()
|
|
|
self.__wwc.qLabel = self.pStackedWidget.video
|
|
|
self.__wwc.lnk_connect = self.line_cam.text()
|
|
|
self.__wwc.start()
|
|
|
+ logger.info("Start IP cam")
|
|
|
|
|
|
case _: return None
|
|
|
|
|
|
- def __stop_cam(self):
|
|
|
+ def stop_cam(self):
|
|
|
+ logger.info("Stop cam")
|
|
|
self.__wwc.stop_cam()
|
|
|
- del self.__wwc
|
|
|
+ self.__wwc = None
|
|
|
self.pStackedWidget.to_image()
|
|
|
-
|
|
|
- def __del__(self) -> None:
|
|
|
- self.__stop_cam
|
|
|
+
|