Prechádzať zdrojové kódy

change template and fix bug

Alex Sidorov 1 rok pred
rodič
commit
6ce06f931a

+ 26 - 49
docs/template_propusk.html

@@ -1,60 +1,37 @@
-<!DOCTYPE html>
-<html lang="en">
+<html lang="ru">
 
 <head>
     <meta charset="UTF-8">
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
-    <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <title>Document</title>
+    <style>
+        * {
+            margin: 0;
+            padding: 0;
+        }
+    </style>
 </head>
 
-<body style="padding: 0; margin: 0; font-size: 12pt">
+<body>
     {% for _ in range(2) %}
     <table>
-        <tbody>
-            <tr>
-                <td><b>Временный пропуск №:</b> {{ id_propusk }}</td>
-                <td rowspan="12">
-                    <img src="{{ face_photo }}" width="300" height="400"/>
-                </td>
-            </tr>
-            <tr>
-                <td><b>Дата выдачи:</b> {{ date_from }}</td>
-                
-            </tr>
-            <tr>
-                <td><b>Действителен до:</b> {{ date_to }}</td>
-            </tr>
-            <tr>
-                <td><b>Выдал:</b> {{ personal }}</td>
-            </tr>
-            <tr>
-                <td>
-                    <p style="font-size: 12pt;">__________________________________</p>
-                    <p style="font-size: 10pt !important;">&nbsp;&nbsp;Подпись сотрудника бюро пропусков</p>
-                    <p style="font-size: 10pt !important;">&nbsp;&nbsp;Печать</p>
-                </td>
-            </tr>
-            <tr>
-                <td><b>Место выдачи:</b> {{ place }}</td>
-            </tr>
-            <tr>
-                <td><b>Принимающий:</b></td>
-            </tr>
-            <tr>
-                <td>{{ receiving_man }}</td>
-            </tr>
-            <tr>
-                <td><b>Цель визита:</b></td>
-            </tr>
-            <tr> 
-                <td>{{ purpose_visite }}</td></tr>
-            <tr>
-                <td><b>Время выхода: __________________</b></td>
-            </tr>
-        </tbody>
+        <tr>
+            <td colspan="2">
+                <img src="{{ face_photo }}" width="800" height="350"/>
+            </td>
+        </tr>
+        <tr>
+            <td><b>Временный пропуск №:</b> {{ id_propusk }}</td>
+            <td><b>Место выдачи:</b> {{ place }}</td>
+        </tr>
+        <tr>
+            <td><b>Дата выдачи:</b> {{ date_from }}</td>
+            <td><b>Принимающий:</b><br> {{ receiving_man }}</td>
+        </tr>
+        <tr>
+            <td><b>Действителен до:</b> {{ date_to }}</td>
+            <td><b>Цель визита:</b><br> {{ purpose_visite }}</td>
+        </tr>
     </table>
-    <hr>
+    <hr />
     {% endfor %}
 </body>
 

+ 61 - 0
docs/template_propusk_back_two.html

@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+    <meta charset="UTF-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+</head>
+
+<body style="padding: 0; margin: 0; font-size: 12pt">
+    {% for _ in range(2) %}
+    <table>
+        <tbody>
+            <tr>
+                <td><b>Временный пропуск №:</b> {{ id_propusk }}</td>
+                <td rowspan="12">
+                    <img src="{{ face_photo }}" width="300" height="400"/>
+                </td>
+            </tr>
+            <tr>
+                <td><b>Дата выдачи:</b> {{ date_from }}</td>
+                
+            </tr>
+            <tr>
+                <td><b>Действителен до:</b> {{ date_to }}</td>
+            </tr>
+            <tr>
+                <td><b>Выдал:</b> {{ personal }}</td>
+            </tr>
+            <tr>
+                <td>
+                    <p style="font-size: 12pt;">__________________________________</p>
+                    <p style="font-size: 10pt !important;">&nbsp;&nbsp;Подпись сотрудника бюро пропусков</p>
+                    <p style="font-size: 10pt !important;">&nbsp;&nbsp;Печать</p>
+                </td>
+            </tr>
+            <tr>
+                <td><b>Место выдачи:</b> {{ place }}</td>
+            </tr>
+            <tr>
+                
+            </tr>
+            <tr>
+                <td></td>
+            </tr>
+            <tr>
+                
+            </tr>
+            <tr> 
+                <td></td></tr>
+            <tr>
+                <td><b>Время выхода: __________________</b></td>
+            </tr>
+        </tbody>
+    </table>
+    <hr>
+    {% endfor %}
+</body>
+
+</html>

+ 2 - 1
module/cam/IPCam.py

@@ -55,9 +55,10 @@ class IPCam(Thread):
             
                 h, w, ch = color_frame.shape
                 img = QImage(color_frame.data, w, h, ch * w, QImage.Format_RGB888)
-                self.__scaled_img = QPixmap.fromImage(img.scaled(640, 480, Qt.KeepAspectRatio))
+                self.__scaled_img = QPixmap.fromImage(img.scaled(h, w, Qt.KeepAspectRatio))
 
                 self.qLabel.setPixmap(self.__scaled_img)
+                
             # "http://admin:admin102030@192.168.1.108/cgi-bin/snapshot.cgi?2"\
             
         except ConnectionError:

+ 3 - 2
window/DialogHistory.py

@@ -79,11 +79,12 @@ class DialogHistory(Ui_DialogHistory, QDialog):
 
             pdm = PropuskDataMethods(*row)
             path_photo = os.path.join(os.environ.get('PHOTO_DIR'), pdm.get_value("face_photo"))
-            pdm.set_value("face_photo", rotate_image(path_photo))
+            # pdm.set_value("face_photo", rotate_image(path_photo))
+            pdm.set_value("face_photo", path_photo)
             
             render_text = str(TemplatePropusk(pdm._propusk_data.__dict__,
                                               os.path.join(os.path.dirname(
                                                   os.path.abspath(__package__)), 'docs')
                                               ))
-            logger.info(render_text)
+            # logger.info(render_text)
             self.browser.setText(render_text)

+ 14 - 8
window/MainWindow.py

@@ -157,10 +157,11 @@ class MainWindow(QMainWindow, Ui_MainWindow):
                 raise ValueError('Нет записи о камерах')
 
     def _init_widget_cam(self) -> None:
-          
+        
         self.stacked_widget = PStackedWidget(self.groupBox_2, self.__mode)
         self.stacked_widget.setObjectName(u'stacked_widget')
         self.verticalLayout_4.addWidget(self.stacked_widget)
+        
 
     @Slot()
     def _start_cam_photo(self) -> None:
@@ -253,15 +254,20 @@ class MainWindow(QMainWindow, Ui_MainWindow):
         self.number_propusk.clear()
         self.date_from.setDate(QDate().currentDate())
         self.date_to.setDate(QDate().currentDate())
-        self._init_widget_cam()
+        
+        if hasattr(self, 'stacked_widget'):
+            self.__stop_cam()
+            self.stacked_widget.to_image()
+            
+        # self._init_widget_cam()
         self.receiving_man.clear()
         self.purpose_visite.clear()
-        self.stacked_widget.to_image()
-
-        if hasattr(self, "face_wwc"):
-            delattr(self, "face_wwc")
+        
+        # self.__stop_cam()
 
     def __stop_cam(self):
-        self.__wwc.stop_cam()  
-        del self.__wwc
+        if hasattr(self, '__wwc'):
+            self.__wwc.stop_cam()
+            del self.__wwc
+            
         self.stacked_widget.to_image()