Quellcode durchsuchen

1 fixed PLineEdit
2 change template

Alex Sidorov vor 1 Jahr
Ursprung
Commit
51062391c2

+ 5 - 3
PropuskWidgets/PLineEdit.py

@@ -1,7 +1,6 @@
 from PySide6.QtWidgets import QLineEdit
 from PySide6.QtGui import QRegularExpressionValidator
 from datetime import datetime
-from PySide6.QtCore import Slot
 
 
 class PLineEdit(QLineEdit):
@@ -13,6 +12,7 @@ class PLineEdit(QLineEdit):
         
         self.setReadOnly(True)
         self.__create_id()
+        self.selectionChanged.connect(lambda: self.setSelection(0, 0))
         
     def clear(self) -> None:
         self.__create_id()
@@ -20,6 +20,8 @@ class PLineEdit(QLineEdit):
     def __create_id(self) -> None:
         self.setText(datetime.now().strftime("%Y%m%d%H%M%S"))
         
-    def mousePressEvent(self, event) -> None:
+    def mousePressEvent(self) -> None:
         self.__create_id()
-        return super().mousePressEvent(event)
+    
+    def get_value(self) -> None:
+        return int(self.text())

+ 1 - 1
docs/template_propusk.html

@@ -15,7 +15,7 @@
     <table>
         <tr>
             <td colspan="2">
-                <img src="{{ face_photo }}" width="800" height="350"/>
+                <img src="{{ face_photo }}" width="600" height="300"/>
             </td>
         </tr>
         <tr>

+ 5 - 17
window/MainWindow.py

@@ -45,17 +45,16 @@ class MainWindow(QMainWindow, Ui_MainWindow):
         self._init_widget_cam()
         
         self.stacked_widget.currentChanged.connect(
-            self.current_change_photo
+            self.__change_text_in_btn_start_cam
         )
 
     def open_history(self) -> None:
         DialogHistory(self).exec_()
 
-    def current_change_photo(self):
-        if self.stacked_widget.currentIndex() == os.environ.get('INDEX_CAMERA'):
-            self.btn_start_cam_photo.setText(stop_cam)
-        else:
-            self.btn_start_cam_photo.setText(start_cam)
+    def __change_text_in_btn_start_cam(self):
+        match self.stacked_widget.currentIndex():
+            case 0: self.btn_start_cam_photo.setText(start_cam)
+            case 1: self.btn_start_cam_photo.setText(stop_cam)
 
     def _init_menu_btn_action(self) -> None:
         self.action_open_history.triggered.connect(self.open_history)
@@ -111,12 +110,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
         ListPersonal(self).exec_()
         self._update_list_combobox()
 
-    @Slot()
     def _show_place_window(self) -> None:
         ListPlace(self).exec_()
         self._update_list_combobox()
 
-    @Slot()
     def _show_setting_cam_window(self) -> None:
         SettingCam(self).exec_()
         self._check_setting_cam()
@@ -167,8 +164,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
         self.stacked_widget.setObjectName(u'stacked_widget')
         self.verticalLayout_4.addWidget(self.stacked_widget)
         
-
-    @Slot()
     def _start_cam_photo(self) -> None:
         if self.__wwc is None:
             self.stacked_widget.to_video()
@@ -189,7 +184,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
                 self.__wwc.start()
             case _: return None
 
-    @Slot()
     def _take_image_face(self) -> None:
         self.__file_name = self.__wwc.cupture_image(self.stacked_widget.image)
             
@@ -197,7 +191,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
         self.stacked_widget.to_image()
         self.__stop_cam()
 
-    @Slot()
     def _print(self) -> None:
         if self.data_propusk is None:
             self._save()
@@ -218,14 +211,12 @@ class MainWindow(QMainWindow, Ui_MainWindow):
 
         Printer(str(render_text)).print()
 
-    @Slot()
     def _clear(self) -> None:
         if self.data_propusk is not None:
             self.data_propusk = None
 
         self._set_default_data()
 
-    @Slot()
     def _save(self) -> None:
         date_from = self.date_from.dateTime().toMSecsSinceEpoch() / 1000
         date_to = self.date_to.dateTime().toMSecsSinceEpoch() / 1000
@@ -256,11 +247,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
             self.__stop_cam()
             self.stacked_widget.to_image()
             
-        # self._init_widget_cam()
         self.receiving_man.clear()
         self.purpose_visite.clear()
-        
-        # self.__stop_cam()
 
     def __stop_cam(self):
         if self.__wwc is not None:

+ 0 - 4
window/ui_py/ui_DialogAbout.py

@@ -20,10 +20,6 @@ class Ui_DialogAbout(object):
         self.verticalLayout.setObjectName(u"verticalLayout")
         self.label = QLabel(DialogAbout)
         self.label.setObjectName(u"label")
-        font = QFont()
-        font.setPointSize(30)
-        font.setBold(True)
-        self.label.setFont(font)
         self.label.setAlignment(Qt.AlignCenter)
 
         self.verticalLayout.addWidget(self.label)

+ 11 - 11
window/ui_py/ui_MainWindow.py

@@ -19,7 +19,7 @@ from PropuskWidgets.PStackedWidget import PStackedWidget
 
 
 class Ui_MainWindow(object):
-    def setupUi(self, MainWindow, mode='video'):
+    def setupUi(self, MainWindow):
         if not MainWindow.objectName():
             MainWindow.setObjectName(u"MainWindow")
         MainWindow.setWindowModality(Qt.WindowModal)
@@ -33,10 +33,10 @@ class Ui_MainWindow(object):
         MainWindow.setBaseSize(QSize(864, 430))
         self.actionExit = QAction(MainWindow)
         self.actionExit.setObjectName(u"actionExit")
-        self.actionSave = QAction(MainWindow)
-        self.actionSave.setObjectName(u"actionSave")
-        self.actionLoad = QAction(MainWindow)
-        self.actionLoad.setObjectName(u"actionLoad")
+        # self.actionSave = QAction(MainWindow)
+        # self.actionSave.setObjectName(u"actionSave")
+        # self.actionLoad = QAction(MainWindow)
+        # self.actionLoad.setObjectName(u"actionLoad")
         self.actionExit_2 = QAction(MainWindow)
         self.actionExit_2.setObjectName(u"actionExit_2")
         self.setting_cam = QAction(MainWindow)
@@ -248,8 +248,8 @@ class Ui_MainWindow(object):
         self.menubar.addAction(self.menu.menuAction())
         self.menubar.addAction(self.menu_2.menuAction())
         self.menuFile.addSeparator()
-        self.menuFile.addAction(self.actionSave)
-        self.menuFile.addAction(self.actionLoad)
+        # self.menuFile.addAction(self.actionSave)
+        # self.menuFile.addAction(self.actionLoad)
         self.menuFile.addAction(self.btn_show_about)
         self.menuFile.addSeparator()
         self.menuFile.addAction(self.exit)
@@ -273,10 +273,10 @@ class Ui_MainWindow(object):
             "MainWindow", u"\u0412\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u043f\u0443\u0441\u043a", None))
         self.actionExit.setText(
             QCoreApplication.translate("MainWindow", u"Exit", None))
-        self.actionSave.setText(
-            QCoreApplication.translate("MainWindow", u"Save", None))
-        self.actionLoad.setText(
-            QCoreApplication.translate("MainWindow", u"Load", None))
+        # self.actionSave.setText(
+        #     QCoreApplication.translate("MainWindow", u"Save", None))
+        # self.actionLoad.setText(
+        #     QCoreApplication.translate("MainWindow", u"Load", None))
         self.actionExit_2.setText(
             QCoreApplication.translate("MainWindow", u"Exit", None))
         self.setting_cam.setText(QCoreApplication.translate(