AlexSidorov 1 anno fa
parent
commit
ce87bc330a

+ 10 - 2
main.py

@@ -1,8 +1,8 @@
 from init_var import *
-import os
-import sys
+import os, sys, locale
 from logger import create_logger
 from PySide6.QtWidgets import QApplication
+from PySide6.QtCore import QLocale, QTranslator, QCoreApplication
 # from appdirs import user_data_dir 
 
 
@@ -21,6 +21,14 @@ def main():
     CleanerImage(os.environ.get('PHOTO_DIR')) \
         .clear()
     
+    translator = QTranslator(app)
+
+    path_lang = os.path.join(os.environ.get("ABSOLUTE_PATH"), "window", "lang")
+    if translator.load(QLocale(), 'propusk', '.', path_lang):
+        app.installTranslator(translator)
+    else:
+        # 
+        print(1)
     
     window = MainWindow()
     window.show()

+ 8 - 5
module/__init__.py

@@ -1,18 +1,21 @@
 from datetime import datetime
 import os
+from PySide6.QtWidgets import QApplication
 # from PySide6.QtWidgets import QMessageBox
 
 
-
 def create_filename(prefix: str = "propusk") -> str:
-    file_name = os.path.join(os.environ.get('PHOTO_DIR'), F"{prefix}_{datetime.now().timestamp()}")
-    
+    file_name = os.path.join(os.environ.get(
+        'PHOTO_DIR'), F"{prefix}_{datetime.now().timestamp()}")
+
     match prefix:
         case 'pdf':
             file_name = F"{file_name}.pdf"
-        case _ :
+        case _:
             file_name = F"{file_name}.jpg"
-        
+
     return file_name
 
 
+def translate(string: str) -> str:
+    return QApplication.translate('propusk', string)

+ 7 - 4
window/DialogCustomVariables.py

@@ -1,6 +1,7 @@
 from .ui_py.ui_DialogCustomVariables import Ui_DialogCustomVariables
 from PySide6.QtWidgets import QDialog, QFileDialog, QMessageBox
 from PySide6.QtCore import Qt
+from module import translate
 from module.MyMessageBox import show_dialog
 
 
@@ -24,11 +25,13 @@ class DialogCustomVariables(Ui_DialogCustomVariables, QDialog):
         )
 
     def _show_path_photo(self) -> None:
-        dir = str(QFileDialog.getExistingDirectory(None, "Выбрать директорию где будут храниться фоотографии"))
+        dir = str(QFileDialog.getExistingDirectory(None, translate(
+            'Photo directory')))
         self.path_photo.setText(dir)
 
     def _show_path_database(self) -> None:
-        dir = str(QFileDialog.getExistingDirectory(None, "Выбрать директорию где будет храниться база данных"))
+        dir = str(QFileDialog.getExistingDirectory(None, translate(
+            'Database directory')))
         self.path_db.setText(dir)
 
     def _save(self) -> None:
@@ -37,6 +40,6 @@ class DialogCustomVariables(Ui_DialogCustomVariables, QDialog):
             file.write(F"PHOTO_DIR={self.path_photo.text()} \n")
 
         show_dialog(QMessageBox.Icon.Information,
-                    "Успешно!",
-                    "Сохранения произошло успешно!")
+                    translate('Success'),
+                    translate('Save success'))
         self.close()

+ 27 - 23
window/DialogSettingCam.py

@@ -9,15 +9,16 @@ from logger import logger
 
 
 
-class SettingCam(QDialog, Ui_DialogSettingCam):
+class DialogSettingCam(QDialog, Ui_DialogSettingCam):
     def __init__(self, parent=None) -> None:
-        super(SettingCam, self).__init__(parent)
+        super(DialogSettingCam, self).__init__(parent)
         self.setAttribute(Qt.WA_DeleteOnClose)
         self.setupUi(self)
 
         self.widget = None
 
         self.__mode = self.mode_list.currentData()
+        self.tabWidget.setCurrentIndex(0)
         self.__load_cams_from_db()
 
         self.save_setting_cam.clicked.connect(self.__save_cams)
@@ -29,8 +30,8 @@ class SettingCam(QDialog, Ui_DialogSettingCam):
     def __change_type(self) -> None:
         if self.tabWidget.currentIndex() == 1:
             self.__mode = 'document'
-        # else:
-        #     self.__mode = 'video'     
+        else:
+            self.__mode = 'video'     
 
         self.__load_cams_from_db()
 
@@ -43,7 +44,8 @@ class SettingCam(QDialog, Ui_DialogSettingCam):
     def __recreate_widget(self, select_mode: str = 'video') -> None:            
         self.__del_widget()
         if self.tabWidget.currentIndex() == 0:
-            self.widget = create_widget_cam_shecked(mode=select_mode,
+            self.widget = create_widget_cam_shecked(
+                mode=select_mode,
                 name_object=u'widget',
                 obj=self.tab,
                 layout=self.verticalLayout)
@@ -55,17 +57,18 @@ class SettingCam(QDialog, Ui_DialogSettingCam):
 
 
     def __del_widget(self) -> None:
-        try:
-            self.widget.stop_cam()
-        except AttributeError as er:
-            logger.error(er)
-            
         if self.widget is not None:
+            try:
+                self.widget.stop_cam()
+            except AttributeError as er:
+                logger.error(er)
+            
             self.verticalLayout.removeWidget(self.widget)
             self.verticalLayout_3.removeWidget(self.widget)
         
         self.widget = None
 
+    @check_error_sql
     def __load_cams_from_db(self):
         with connect() as conn:
             result = conn.execute(cam_setting.select().where(
@@ -74,11 +77,13 @@ class SettingCam(QDialog, Ui_DialogSettingCam):
             if result:
                 self.__mode = result.mode
                 self.__recreate_widget(self.__mode)
+                logger.info(F'select mode cam {self.__mode}')
                 match self.__mode:
                     case 'video':
                         self.mode_list.setCurrentIndex(0)
                         self.widget.line_cam.setCurrentText(
                             result.selected_cam)
+
                     case 'snapshot':
                         self.mode_list.setCurrentIndex(1)
                         self.widget.line_cam.setText(result.selected_cam)
@@ -86,27 +91,26 @@ class SettingCam(QDialog, Ui_DialogSettingCam):
                         self.widget.line_cam.setCurrentText(
                             result.selected_cam)
                     case _: ...
+                
             else: self.__recreate_widget()
 
+    @check_error_sql
     def __save_cams(self) -> None:
         query = None
         with connect() as conn:
-            try:
-                result = conn.execute(cam_setting.select().where(
+            result = conn.execute(cam_setting.select().where(
                     cam_setting.c.type == self.tabWidget.currentIndex()
-                )).fetchone()
-                if result is None:
-                    query = cam_setting.insert().values(
+            )).fetchone()
+            if result is None:
+                query = cam_setting.insert().values(
                         type=self.tabWidget.currentIndex(),
                         mode=self.__mode,
                         selected_cam=self.widget.get_value())
-                else:
-                    query = cam_setting.update().where(
+            else:
+                query = cam_setting.update().where(
                         cam_setting.c.type == self.tabWidget.currentIndex()
                     ).values(mode=self.__mode, selected_cam=self.widget.get_value())
-                result = conn.execute(query)
-                show_dialog(QMessageBox.Icon.Information, '', 'Сохранено')
-                logger.info('Камера сохранена')
-            except OperationalError as er:
-                logger.error(er)
-                show_dialog(QMessageBox.Icon.Critical, 'Ошибка', 'Произошла ошибка! \nОбратитеcь к администратору')
+            result = conn.execute(query)
+            show_dialog(QMessageBox.Icon.Information, '', 'Сохранено')
+            logger.info(F'Камера сохранена {self.widget.get_value()}')
+            

+ 14 - 16
window/ListPersonal.py

@@ -1,4 +1,5 @@
 from .ui_py.ui_DialogListPersonal import Ui_DialogListPersonal
+from module import translate
 from module.WorkWithDB import connect, list_personal
 from module.MyMessageBox import show_dialog
 
@@ -6,7 +7,6 @@ from PySide6.QtWidgets import QDialog, QListWidgetItem, QMessageBox
 from PySide6.QtCore import Qt, Slot
 
 
-
 class ListPersonal(QDialog, Ui_DialogListPersonal):
     def __init__(self, update_listbox_func, parent=None) -> None:
         super(ListPersonal, self).__init__(parent)
@@ -20,19 +20,18 @@ class ListPersonal(QDialog, Ui_DialogListPersonal):
         self.list_personal_widget.itemSelectionChanged.connect(
             self._selected_item)
         self._load_data()
-        
 
     @Slot()
     def _save(self) -> None:
         if any([
-            self.lastname.text(),
-            self.firstname.text(),
-            self.middlename.text()]):
+                self.lastname.text(),
+                self.firstname.text(),
+                self.middlename.text()]):
             with connect() as conn:
                 insert_personal = list_personal.insert().values(
-                 lastname=self.lastname.text(),
-                 firstname=self.firstname.text(),
-                 middlename=self.middlename.text()
+                    lastname=self.lastname.text(),
+                    firstname=self.firstname.text(),
+                    middlename=self.middlename.text()
                 )
                 conn.execute(insert_personal)
 
@@ -40,11 +39,11 @@ class ListPersonal(QDialog, Ui_DialogListPersonal):
             self._load_data()
         else:
             show_dialog(
-                    QMessageBox.Warning,
-                    title="Пустые поля",
-                    massage="Заполните все поля!"
-                )
-            
+                QMessageBox.Warning,
+                title=translate('Empty fields'),
+                massage=translate('Fill in all fields!')
+            )
+
     def _clean_line_edit(self):
         self.lastname.clear()
         self.firstname.clear()
@@ -76,8 +75,8 @@ class ListPersonal(QDialog, Ui_DialogListPersonal):
             else:
                 show_dialog(
                     QMessageBox.Warning,
-                    title="Не выбран элемент списка",
-                    massage="Выбирите элемент списка перед тем как удалять!"
+                    title=translate('List item not selected'),
+                    massage=translate('Select a list item before deleting!')
                 )
 
         self._clean_line_edit()
@@ -115,4 +114,3 @@ class ListPersonal(QDialog, Ui_DialogListPersonal):
         item = QListWidgetItem(F"{lastname} {firstname} {middlename}")
         item.id = id
         return item
-    

+ 42 - 35
window/MainWindow.py

@@ -7,9 +7,8 @@ from PySide6.QtWidgets import QMainWindow, QMessageBox
 from sqlalchemy.exc import OperationalError
 
 from logger import logger
-from module import create_filename
-from module.cam import IPCam, USBCam, load_image
-from module.lang.ru import *
+from module import create_filename, translate
+from module.cam import IPCam, USBCam
 from module.MyMessageBox import show_dialog
 from module.Printer import Print
 from module.QRCode import make as make_qr
@@ -18,10 +17,11 @@ from module.WorkWithDB import *
 from module.wkhtmltopdf import get_path_wkhtmltopdf
 from module.ImageTool import rotate_image
 from widgets import PStackedWidget, create_widget_stacked
+from module.cam.USBCam import get_first_cam
 
 from .DialogAbout import DialogAbout
 from .DialogHistory import DialogHistory
-from .DialogSettingCam import SettingCam
+from .DialogSettingCam import DialogSettingCam
 from .ListPersonal import ListPersonal
 from .ListPlace import ListPlace
 from .ui_py.ui_MainWindow import Ui_MainWindow
@@ -30,13 +30,19 @@ vecrot_cam_from_db = [str, str, str]
 
 
 class MainWindow(QMainWindow, Ui_MainWindow):
+    __wwc: IPCam | USBCam = None
+    data_propusk: dict = None
+    stacked_face: PStackedWidget = None
+    __file_name_document: str = None
+    __file_name_face: str = None
+    __mode: str = 'video'
+    __cam_face: str = get_first_cam()
+    __cam_document: str = get_first_cam()
+
     def __init__(self, parent=None) -> None:
 
         super(MainWindow, self).__init__(parent)
         self.setupUi(self)
-        self.__wwc = None
-        self.data_propusk = None
-        self.stacked_face = None
 
         self.date_from.setDateTime(QDateTime().currentDateTime())
         self.date_to.setDateTime(QDateTime().currentDateTime())
@@ -97,7 +103,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
 
     def __show_setting_cam_window(self) -> None:
         self.__stop_cam()
-        SettingCam(self).exec_()
+        DialogSettingCam(self).exec_()
         self.__check_setting_cam()
         self.__create_widget_face_cam()
 
@@ -112,30 +118,30 @@ class MainWindow(QMainWindow, Ui_MainWindow):
 
     def __checked_rotate_document(self) -> bool:
         return self.rotate_image_document.isChecked()
-    
+
     def __check_setting_cam(self) -> None:
         try:
             self.__mode, self.__cam_face, self.__cam_document = self.__get_selected_cam()
         except ValueError:
-            logger.warning(warring_cams.get("title"))
+            logger.warning(translate('Cameras not configured'))
             if show_dialog(
                 QMessageBox.Warning,
-                warring_cams.get("title"),
-                warring_cams.get("body")
+                translate('Cameras not configured'),
+                translate('Set up the camera \nSettings -> Camera settings')
             ):
                 self.__show_setting_cam_window()
                 self.__check_setting_cam()
             else:
                 self.close()
         except TypeError:
-            logger.warning(warring_cams.get("title"))
+            logger.warning(translate('Cameras not configured'))
 
     def __check_wkhtmltopdf(self) -> None:
         if get_path_wkhtmltopdf() is None:
-            logger.critical('Не установлена программа wkhtmltopdf')
-            show_dialog(QMessageBox.Icon.Critical, 
-                            "Не найден wkhtmltopdf",
-                            "Не установлена программа wkhtmltopdf")
+            logger.critical(translate('wkhtmltopdf not installed'))
+            show_dialog(QMessageBox.Icon.Critical,
+                        translate("Not found wkhtmltopdf"),
+                        translate("wkhtmltopdf not installed"))
             sys.exit(0)
 
     def __update_list_combobox(self) -> None:
@@ -182,11 +188,11 @@ class MainWindow(QMainWindow, Ui_MainWindow):
             try:
                 return cam[0].mode, cam[0].selected_cam, cam[1].selected_cam
             except:
-                logger.error('Нет записи о камерах')
+                logger.error(translate('Missing camera records'))
                 if show_dialog(
                     QMessageBox.Icon.Critical,
-                    'Камера',
-                    'Отсутствуют записи о камерах'
+                    translate('Camera'),
+                    translate('Missing camera records')
                 ):
                     self.__show_setting_cam_window()
                     self.__check_setting_cam()
@@ -202,12 +208,12 @@ class MainWindow(QMainWindow, Ui_MainWindow):
         if self.__wwc is None:
             widget.to_video()
             self.__create_wwc(widget, cam)
-            self.btn_start_cam.setText(stop_cam)
+            self.btn_start_cam.setText(translate('Launch сamera'))
 
         else:
             self.__stop_cam()
             widget.to_image()
-            self.btn_start_cam.setText(start_cam)
+            self.btn_start_cam.setText(translate('Stop camera'))
 
     def __create_wwc(self, widget: PStackedWidget, cam: str) -> None:
         if self.__mode in 'snapshot':
@@ -215,9 +221,11 @@ class MainWindow(QMainWindow, Ui_MainWindow):
             self.__wwc.qLabel = widget.video
             self.__wwc.lnk_connect = cam
             self.__wwc.start()
-        else:
+        elif self.__mode in ('video', 'document'):
             self.__wwc = USBCam(widget.video, cam)
             self.__wwc.start_cam()
+        else:
+            logger.error(F"{translate('No corrected')}: {self.__mode}")
 
     def __take_image(self) -> None:
         if self.tabWidget.currentIndex() == 1:
@@ -229,7 +237,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
                 self.stacked_face.image)
             self.stacked_face.to_image()
 
-        self.btn_start_cam.setText(start_cam)
+        self.btn_start_cam.setText(translate('Launch сamera'))
 
         # self.__stop_cam()
 
@@ -288,11 +296,11 @@ class MainWindow(QMainWindow, Ui_MainWindow):
                     list_propusk.insert().values(**self.data_propusk)
                 )
 
-                show_dialog(QMessageBox.Icon.Information, '', 'Сохранено')
+                show_dialog(QMessageBox.Icon.Information, '', translate('Save success'))
             except OperationalError as er:
                 logger.error(er)
-                show_dialog(QMessageBox.Icon.Critical, 'Ошибка',
-                            'Произошла ошибка при сохранении! \n Обратитесь к администратору')
+                show_dialog(QMessageBox.Icon.Critical, translate('Error'),
+                            'An error occurred while saving! \n Please contact your administrator')
 
     def __set_default_data(self) -> None:
         self.number_propusk.clear()
@@ -302,10 +310,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
         if self.__wwc is not None:
             self.__stop_cam()
 
-        self.stacked_document.to_image()
-        self.stacked_face.to_image()
-        load_image(self.stacked_document, os.environ.get('NO_MEDIA_IMAGE'))
-        load_image(self.stacked_face, os.environ.get('NO_MEDIA_IMAGE'))
+        self.stacked_document.set_default_image()
+        self.stacked_face.set_default_image()
 
         self.receiving_man.clear()
         self.purpose_visite.clear()
@@ -315,10 +321,11 @@ class MainWindow(QMainWindow, Ui_MainWindow):
             self.__wwc.stop_cam()
             self.__wwc = None
 
-        self.btn_start_cam.setText(start_cam)
+        self.btn_start_cam.setText(translate('Launch сamera'))
 
     def __create_widget_face_cam(self) -> None:
-        self.gridLayout.removeWidget(self.stacked_face)
+        if self.stacked_face is not None:
+            self.gridLayout.removeWidget(self.stacked_face)
 
         self.stacked_face = create_widget_stacked(
             name_object=u'stacked_face',
@@ -332,6 +339,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
 
     def __change_text_btn(self) -> None:
         if self.stacked_face.currentIndex() == 0:
-            self.btn_start_cam.setText(stop_cam)
+            self.btn_start_cam.setText(translate('Stop camera'))
         else:
-            self.btn_start_cam.setText(start_cam)
+            self.btn_start_cam.setText(translate('Launch сamera'))

BIN
window/lang/propusk.ru_RU.qm


+ 312 - 0
window/lang/propusk.ru_RU.ts

@@ -0,0 +1,312 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="ru_RU" sourcelanguage="en_US">
+<context>
+    <name>propusk</name>
+    <message>
+        <source>File</source>
+        <translation>Файл</translation>
+    </message>
+
+    <message>
+        <source>Settings</source>
+        <translation>Настройки</translation>
+    </message>
+
+    <message>
+        <source>About</source>
+        <translation>О программе</translation>
+    </message>
+
+    <message>
+        <source>Exit</source>
+        <translation>Выход</translation>
+    </message>
+
+    <message>
+        <source>History</source>
+        <translation>История</translation>
+    </message>
+
+    <message>
+        <source>Pass history</source>
+        <translation>История пропусков</translation>
+    </message>
+
+    <message>
+        <source>Camera settings</source>
+        <translation>Настройки камеры</translation>
+    </message>
+
+    <message>
+        <source>Lists</source>
+        <translation>Списки</translation>
+    </message>
+
+    <message>
+        <source>List</source>
+        <translation>Список</translation>
+    </message>
+
+    <message>
+        <source>Employees</source>
+        <translation>Сотрудники</translation>
+    </message>
+
+    <message>
+        <source>Place of issue</source>
+        <translation>Место выдачи</translation>
+    </message>
+
+    <message>
+        <source>Name of place of issue</source>
+        <translation>Наименование места выдачи</translation>
+    </message>
+
+    <message>
+        <source>List of places of issue</source>
+        <translation>Список мест выдачи</translation>
+    </message>
+
+    <message>
+        <source>Update lists</source>
+        <translation>Обновить списки</translation>
+    </message>
+
+    <message>
+        <source>Flip document</source>
+        <translation>Переворачивать документ</translation>
+    </message>
+
+    <message>
+        <source>Do not flip the document</source>
+        <translation>Не переворачивать документ</translation>
+    </message>
+
+    <message>
+        <source>Information</source>
+        <translation>Информация</translation>
+    </message>
+
+    <message>
+        <source>Temporary pass</source>
+        <translation>Временный пропуск</translation>
+    </message>
+
+    <message>
+        <source>Date and time of issue</source>
+        <translation>Дата и время выдачи</translation>
+    </message>
+
+    <message>
+        <source>Valid until</source>
+        <translation>Действителен до</translation>
+    </message>
+
+    <message>
+        <source>Who issued</source>
+        <translation>Кто выдал</translation>
+    </message>
+
+    <message>
+        <source>Receiving</source>
+        <translation>Принимающий</translation>
+    </message>
+
+    <message>
+        <source>Purpose of the visit</source>
+        <translation>Цель визита</translation>
+    </message>
+
+    <message>
+        <source>Launch сamera</source>
+        <translation>Запустить камеру</translation>
+    </message>
+
+    <message>
+        <source>Stop camera</source>
+        <translation>Остановить камеру</translation>
+    </message>
+
+    <message>
+        <source>Take photo</source>
+        <translation>Сфотографировать</translation>
+    </message>
+
+    <message>
+        <source>Clear</source>
+        <translation>Отчистить</translation>
+    </message>
+
+    <message>
+        <source>Save</source>
+        <translation>Сохранить</translation>
+    </message>
+
+    <message>
+        <source>Save settings</source>
+        <translation>Сохранить настройки</translation>
+    </message>
+
+    <message>
+        <source>Load</source>
+        <translation>Загрузить</translation>
+    </message>
+
+    <message>
+        <source>Print</source>
+        <translation>Печать</translation>
+    </message>
+
+    <message>
+        <source>Face camera</source>
+        <translation>Камера для лица</translation>
+    </message>
+
+    <message>
+        <source>Document camera</source>
+        <translation>Камера для документа</translation>
+    </message>
+
+    <message>
+        <source>Control</source>
+        <translation>Управление</translation>
+    </message>
+
+    <message>
+        <source>Last name</source>
+        <translation>Фамилия</translation>
+    </message>
+
+    <message>
+        <source>First name</source>
+        <translation>Имя</translation>
+    </message>
+
+    <message>
+        <source>Middle name</source>
+        <translation>Отчество</translation>
+    </message>
+
+    <message>
+        <source>Update</source>
+        <translation>Обновить</translation>
+    </message>
+
+    <message>
+        <source>Delete</source>
+        <translation>Удалить</translation>
+    </message>
+
+    <message>
+        <source>List employees</source>
+        <translation>Список сотрудников</translation>
+    </message>
+
+    <message>
+        <source>USB Camera</source>
+        <translation>USB камера</translation>
+    </message>
+
+    <message>
+        <source>IP Camera</source>
+        <translation>IP камера</translation>
+    </message>
+
+    <message>
+        <source>Cameras not configured</source>
+        <translation>Камеры не настроины</translation>
+    </message>
+
+    <message>
+        <source>Set up the camera \nSettings -> Camera settings</source>
+        <translation>Настройте камеры \nНастройки -> Настройки камеры</translation>
+    </message>
+
+    <message>
+        <source>wkhtmltopdf not installed</source>
+        <translation>Не установлена программа wkhtmltopdf</translation>
+    </message>
+
+    <message>
+        <source>Not found wkhtmltopdf</source>
+        <translation>Не найден wkhtmltopdf</translation>
+    </message>
+
+    <message>
+        <source>Save success</source>
+        <translation>Сохранено</translation>
+    </message>
+
+    <message>
+        <source>Success</source>
+        <translation>Успешно</translation>
+    </message>
+
+    <message>
+        <source>Error</source>
+        <translation>Ошибка</translation>
+    </message>
+
+    <message>
+        <source>An error occurred while saving! \n Please contact your administrator</source>
+        <translation>Произошла ошибка при сохранении! \n Обратитесь к администратору</translation>
+    </message>
+
+    <message>
+        <source>No corrected</source>
+        <translation>Не корректный</translation>
+    </message>
+
+    <message>
+        <source>Missing camera records</source>
+        <translation>Отсутствуют записи о камерах</translation>
+    </message>
+
+    <message>
+        <source>Camera</source>
+        <translation>Камера</translation>
+    </message>
+
+    <message>
+        <source>Empty fields</source>
+        <translation>Пустые поля</translation>
+    </message>
+
+    <message>
+        <source>Fill in all fields!</source>
+        <translation>Заполните все поля!</translation>
+    </message>
+
+    <message>
+        <source>List item not selected</source>
+        <translation>Не выбран элемент списка</translation>
+    </message>
+
+    <message>
+        <source>Select a list item before deleting!</source>
+        <translation>Выберите элемент списка перед тем как удалять!</translation>
+    </message>
+
+    <message>
+        <source>Open directory</source>
+        <translation>Открыть директорию</translation>
+    </message>
+
+    <message>
+        <source>Photo directory</source>
+        <translation>Директория с фотографиями</translation>
+    </message>
+
+    <message>
+        <source>Database directory</source>
+        <translation>Директория с базой данных</translation>
+    </message>
+
+    <message>
+        <source>Initial settings</source>
+        <translation>Изначальные настройки</translation>
+    </message>
+
+</context>
+</TS>

+ 2 - 2
window/ui/MainWindow.ui

@@ -120,7 +120,7 @@
             <widget class="QDateTimeEdit" name="date_from">
              <property name="dateTime">
               <datetime>
-               <hour>9</hour>
+               <hour>6</hour>
                <minute>0</minute>
                <second>0</second>
                <year>1999</year>
@@ -396,7 +396,7 @@
      <x>0</x>
      <y>0</y>
      <width>1095</width>
-     <height>28</height>
+     <height>22</height>
     </rect>
    </property>
    <property name="mouseTracking">

+ 3 - 2
window/ui_py/ui_DialogAbout.py

@@ -10,6 +10,7 @@
 
 from PySide6.QtCore import (QCoreApplication, QMetaObject, QSize, Qt)
 from PySide6.QtWidgets import (QHBoxLayout, QLabel, QSizePolicy, QSpacerItem, QVBoxLayout)
+from module import translate
 
 class Ui_DialogAbout(object):
     def setupUi(self, DialogAbout):
@@ -71,8 +72,8 @@ class Ui_DialogAbout(object):
     # setupUi
 
     def retranslateUi(self, DialogAbout):
-        DialogAbout.setWindowTitle(QCoreApplication.translate("DialogAbout", u"\u041e \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435", None))
-        self.label.setText(QCoreApplication.translate("DialogAbout", u"Propusk", None))
+        DialogAbout.setWindowTitle(translate('About'))
+        self.label.setText(translate('Temporary pass'))
         self.version.setText(QCoreApplication.translate("DialogAbout", u"TextLabel", None))
         self.label_3.setText(QCoreApplication.translate("DialogAbout", u"Git:", None))
         self.label_4.setText(QCoreApplication.translate("DialogAbout", u"<a href=\"https://tj.kbsu.ru/AlexSidorov/propusk\">https://tj.kbsu.ru/AlexSidorov/propusk</a>", None))

+ 7 - 13
window/ui_py/ui_DialogCustomVariables.py

@@ -13,7 +13,7 @@ from PySide6.QtCore import (QCoreApplication, QMetaObject, QSize)
 from PySide6.QtWidgets import (QGroupBox, QHBoxLayout,
                                QLineEdit, QPushButton, QSizePolicy, QSpacerItem,
                                QVBoxLayout)
-
+from module import translate
 
 class Ui_DialogCustomVariables(object):
     def setupUi(self, DialogCustomVariables):
@@ -77,16 +77,10 @@ class Ui_DialogCustomVariables(object):
     # setupUi
 
     def retranslateUi(self, DialogCustomVariables):
-        DialogCustomVariables.setWindowTitle(QCoreApplication.translate(
-            "DialogCustomVariables", u"\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438", None))
-        self.groupBox.setTitle(QCoreApplication.translate(
-            "DialogCustomVariables", u"\u0414\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u0441 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044f\u043c\u0438", None))
-        self.btn_show_path_photo.setText(QCoreApplication.translate(
-            "DialogCustomVariables", u"\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u043f\u0443\u0442\u044c \u043a \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438", None))
-        self.groupBox_2.setTitle(QCoreApplication.translate(
-            "DialogCustomVariables", u"\u0414\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u0441 \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445", None))
-        self.btn_show_path_database.setText(QCoreApplication.translate(
-            "DialogCustomVariables", u"\u041e\u0442\u043a\u0440\u044b\u0442\u044c \u043f\u0443\u0442\u044c \u043a \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438", None))
-        self.btn_save.setText(QCoreApplication.translate(
-            "DialogCustomVariables", u"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c", None))
+        DialogCustomVariables.setWindowTitle(translate('Initial settings'))
+        self.groupBox.setTitle(translate('Photo directory'))
+        self.btn_show_path_photo.setText(translate('Open directory'))
+        self.groupBox_2.setTitle(translate('Database directory'))
+        self.btn_show_path_database.setText(translate('Open directory'))
+        self.btn_save.setText(translate('Save'))
     # retranslateUi

+ 3 - 5
window/ui_py/ui_DialogHistory.py

@@ -11,7 +11,7 @@
 from PySide6.QtCore import (QCoreApplication, QMetaObject)
 from PySide6.QtWidgets import (QGroupBox, QHBoxLayout,
                                QLineEdit, QListWidget, QTextBrowser, QVBoxLayout)
-
+from module import translate
 
 class Ui_DialogHistory(object):
     def setupUi(self, DialogHistory):
@@ -47,8 +47,6 @@ class Ui_DialogHistory(object):
     # setupUi
 
     def retranslateUi(self, DialogHistory):
-        DialogHistory.setWindowTitle(QCoreApplication.translate(
-            "DialogHistory", u"История пропусков", None))
-        self.groupBox.setTitle(QCoreApplication.translate(
-            "DialogHistory", u"\u0421\u043f\u0438\u0441\u043e\u043a", None))
+        DialogHistory.setWindowTitle(translate('Pass history'))
+        self.groupBox.setTitle(translate('List'))
     # retranslateUi

+ 10 - 19
window/ui_py/ui_DialogListPersonal.py

@@ -12,7 +12,7 @@ from PySide6.QtCore import (QCoreApplication, QMetaObject, QSize)
 from PySide6.QtWidgets import (QGridLayout, QGroupBox,
                                QHBoxLayout, QLabel, QLineEdit, QListWidget, QPushButton, QSizePolicy, QSpacerItem,
                                QVBoxLayout)
-
+from module import translate
 
 class Ui_DialogListPersonal(object):
     def setupUi(self, DialogListPersonal):
@@ -137,22 +137,13 @@ class Ui_DialogListPersonal(object):
     # setupUi
 
     def retranslateUi(self, DialogListPersonal):
-        DialogListPersonal.setWindowTitle(QCoreApplication.translate(
-            "DialogListPersonal", u"Список сотрудников", None))
-        self.groupBox.setTitle(QCoreApplication.translate(
-            "DialogListPersonal", u"\u0421\u043f\u0438\u0441\u043e\u043a \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u043e\u0432", None))
-        self.groupBox_2.setTitle(QCoreApplication.translate(
-            "DialogListPersonal", u"\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435", None))
-        self.label.setText(QCoreApplication.translate(
-            "DialogListPersonal", u"\u0424\u0430\u043c\u0438\u043b\u0438\u044f", None))
-        self.label_2.setText(QCoreApplication.translate(
-            "DialogListPersonal", u"\u0418\u043c\u044f", None))
-        self.label_3.setText(QCoreApplication.translate(
-            "DialogListPersonal", u"\u041e\u0442\u0447\u0435\u0442\u0432\u043e", None))
-        self.btn_save_personal.setText(QCoreApplication.translate(
-            "DialogListPersonal", u"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c", None))
-        self.btn_update_personal.setText(QCoreApplication.translate(
-            "DialogListPersonal", u"\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c", None))
-        self.btn_delete_personal.setText(QCoreApplication.translate(
-            "DialogListPersonal", u"\u0423\u0434\u0430\u043b\u0438\u0442\u044c", None))
+        DialogListPersonal.setWindowTitle(translate('List employees'))
+        self.groupBox.setTitle(translate('List employees'))
+        self.groupBox_2.setTitle(translate('Control'))
+        self.label.setText(translate('Last name'))
+        self.label_2.setText(translate('First name'))
+        self.label_3.setText(translate('Middle name'))
+        self.btn_save_personal.setText(translate('Save'))
+        self.btn_update_personal.setText(translate('Update'))
+        self.btn_delete_personal.setText(translate('Delete'))
     # retranslateUi

+ 8 - 15
window/ui_py/ui_DialogListPlace.py

@@ -12,7 +12,7 @@ from PySide6.QtCore import (QCoreApplication, QMetaObject, QSize)
 from PySide6.QtWidgets import (QGridLayout, QGroupBox,
                                QHBoxLayout, QLabel, QLineEdit, QListWidget, QPushButton, QSizePolicy, QSpacerItem,
                                QVBoxLayout)
-
+from module import translate
 
 class Ui_DialogListPlace(object):
     def setupUi(self, DialogListPlace):
@@ -92,18 +92,11 @@ class Ui_DialogListPlace(object):
     # setupUi
 
     def retranslateUi(self, DialogListPlace):
-        DialogListPlace.setWindowTitle(QCoreApplication.translate(
-            "DialogListPlace", u"Список мест выдачи", None))
-        self.groupBox.setTitle(QCoreApplication.translate(
-            "DialogListPlace", u"\u0421\u043f\u0438\u0441\u043e\u043a \u043c\u0435\u0441\u0442 \u0432\u044b\u0434\u0430\u0447\u0438", None))
-        self.groupBox_2.setTitle(QCoreApplication.translate(
-            "DialogListPlace", u"\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435", None))
-        self.label.setText(QCoreApplication.translate(
-            "DialogListPlace", u"\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u0435\u0441\u0442\u0430 \u0432\u044b\u0434\u0430\u0447\u0438:", None))
-        self.btn_save_place.setText(QCoreApplication.translate(
-            "DialogListPlace", u"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c", None))
-        self.btn_update_place.setText(QCoreApplication.translate(
-            "DialogListPlace", u"\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c", None))
-        self.btn_delete_place.setText(QCoreApplication.translate(
-            "DialogListPlace", u"\u0423\u0434\u0430\u043b\u0438\u0442\u044c", None))
+        DialogListPlace.setWindowTitle(translate('List of places of issue'))
+        self.groupBox.setTitle(translate('List of places of issue'))
+        self.groupBox_2.setTitle(translate('Control'))
+        self.label.setText(translate('Name of place of issue'))
+        self.btn_save_place.setText(translate('Save'))
+        self.btn_update_place.setText(translate('Update'))
+        self.btn_delete_place.setText(translate('Delete'))
     # retranslateUi

+ 9 - 11
window/ui_py/ui_DialogSettingCam.py

@@ -11,6 +11,7 @@
 from PySide6.QtCore import (QCoreApplication, QMetaObject)
 from PySide6.QtWidgets import (
     QComboBox, QPushButton, QTabWidget, QVBoxLayout, QWidget)
+from module import translate
 
 
 class Ui_DialogSettingCam(object):
@@ -53,22 +54,19 @@ class Ui_DialogSettingCam(object):
 
         self.retranslateUi(DialogSettingCam)
 
-        self.tabWidget.setCurrentIndex(0)
+        
 
         QMetaObject.connectSlotsByName(DialogSettingCam)
     # setupUi
 
     def retranslateUi(self, DialogSettingCam):
-        DialogSettingCam.setWindowTitle(QCoreApplication.translate(
-            "DialogSettingCam", u"\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043a\u0430\u043c\u0435\u0440\u044b", None))
+        DialogSettingCam.setWindowTitle(translate('Camera settings'))
 
-        self.mode_list.addItem('USB Camera', userData='video')
-        self.mode_list.addItem('IP Camera', userData='snapshot')
+        self.mode_list.addItem(translate('USB Camera'), userData='video')
+        self.mode_list.addItem(translate('IP Camera'), userData='snapshot')
+        self.mode_list.setCurrentIndex(0)
         
-        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QCoreApplication.translate(
-            "DialogSettingCam", u"\u041A\u0430\u043C\u0435\u0440\u0430 \u0434\u043B\u044F \u043B\u0438\u0446\u0430", None))
-        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QCoreApplication.translate(
-            "DialogSettingCam", u"\u041A\u0430\u043C\u0435\u0440\u0430 \u0434\u043B\u044F \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", None))
-        self.save_setting_cam.setText(QCoreApplication.translate(
-            "DialogSettingCam", u"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438", None))
+        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), translate('Face camera'))
+        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), translate('Document camera'))
+        self.save_setting_cam.setText(translate('Save settings'))
     # retranslateUi

+ 45 - 75
window/ui_py/ui_MainWindow.py

@@ -10,7 +10,7 @@
 
 from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
                             QMetaObject, QObject, QPoint, QRect,
-                            QSize, QTime, QUrl, Qt)
+                            QSize, QTime, Qt)
 from PySide6.QtGui import (QAction, QActionGroup)
 from PySide6.QtMultimediaWidgets import QVideoWidget
 from PySide6.QtWidgets import (QApplication, QComboBox, QDateTimeEdit, QFrame,
@@ -21,6 +21,7 @@ from PySide6.QtWidgets import (QApplication, QComboBox, QDateTimeEdit, QFrame,
                                QWidget)
 
 from widgets import PLineEdit, PStackedWidget
+from module import translate
 
 
 class Ui_MainWindow(object):
@@ -265,16 +266,15 @@ class Ui_MainWindow(object):
         self.rotate_image_document.setCheckable(True)
         self.rotate_image_document.setChecked(True)
         self.no_rotate_image_document = QAction(MainWindow)
-        self.no_rotate_image_document.setObjectName(u"no_rotate_image_document")
+        self.no_rotate_image_document.setObjectName(
+            u"no_rotate_image_document")
         self.no_rotate_image_document.setCheckable(True)
-        
+
         self.check_rotate = QActionGroup(MainWindow)
         self.check_rotate.setObjectName(u"check_rotate")
         self.check_rotate.addAction(self.rotate_image_document)
         self.check_rotate.addAction(self.no_rotate_image_document)
 
-        
-
         MainWindow.setCentralWidget(self.centralwidget)
         self.menubar = QMenuBar(MainWindow)
         self.menubar.setObjectName(u"menubar")
@@ -314,7 +314,7 @@ class Ui_MainWindow(object):
         self.menu_3.addAction(self.btn_show_personal_window)
         self.menu_3.addAction(self.btn_show_place_window)
         self.menu_3.addSeparator()
-        
+
         self.menu_3.addAction(self.update_list)
         self.menu_2.addAction(self.action_open_history)
         # self.menu_3.addActions(self.check_rotate)
@@ -325,73 +325,43 @@ class Ui_MainWindow(object):
     # setupUi
 
     def retranslateUi(self, MainWindow):
-        MainWindow.setWindowTitle(QCoreApplication.translate(
-            "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.actionExit_2.setText(
-            QCoreApplication.translate("MainWindow", u"Exit", None))
-        self.setting_cam.setText(QCoreApplication.translate(
-            "MainWindow", u"\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043a\u0430\u043c\u0435\u0440\u044b", None))
-        self.rotate_image_document.setText(QCoreApplication.translate(
-            "MainWindow", u"\u041F\u0435\u0440\u0435\u0432\u043E\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044C \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442", None))
-        self.no_rotate_image_document.setText(QCoreApplication.translate(
-            "MainWindow", u"\u041D\u0435 \u043F\u0435\u0440\u0435\u0432\u043E\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044C \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442", None))
-        
-        self.btn_show_personal_window.setText(QCoreApplication.translate(
-            "MainWindow", u"\u0421\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u0438", None))
-        self.btn_show_place_window.setText(QCoreApplication.translate(
-            "MainWindow", u"\u041c\u0435\u0441\u0442\u043e \u0432\u044b\u0434\u0430\u0447\u0438", None))
-        self.update_list.setText(QCoreApplication.translate(
-            "MainWindow", u"\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043a\u0438", None))
-        self.btn_show_about.setText(QCoreApplication.translate(
-            "MainWindow", u"\u041e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435", None))
-        self.exit.setText(QCoreApplication.translate(
-            "MainWindow", u"Exit", None))
-        self.action_open_history.setText(QCoreApplication.translate(
-            "MainWindow", u"\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u043e\u0432", None))
-        self.groupBox.setTitle(QCoreApplication.translate(
-            "MainWindow", u"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f:", None))
-        self.label.setText(QCoreApplication.translate(
-            "MainWindow", u"\u0412\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u043f\u0443\u0441\u043a \u2116:", None))
-
-        self.label_2.setText(QCoreApplication.translate(
-            "MainWindow", u"\u0414\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u0434\u0430\u0447\u0438:", None))
-        self.label_4.setText(QCoreApplication.translate(
-            "MainWindow", u"\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u0435\u043d\u0435 \u0434\u043e:", None))
-        self.label_3.setText(QCoreApplication.translate(
-            "MainWindow", u"\u0412\u044b\u0434\u0430\u043b:", None))
-        self.label_5.setText(QCoreApplication.translate(
-            "MainWindow", u"\u041c\u0435\u0441\u0442\u043e \u0432\u044b\u0434\u0430\u0447\u0438:", None))
-        self.label_6.setText(QCoreApplication.translate(
-            "MainWindow", u"\u041f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0438\u0439:", None))
-        self.label_7.setText(QCoreApplication.translate(
-            "MainWindow", u"\u0426\u0435\u043b\u044c \u0432\u0438\u0437\u0438\u0442\u0430:", None))
-
-        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QCoreApplication.translate(
-            "MainWindow", u"\u041A\u0430\u043C\u0435\u0440\u0430 \u0434\u043B\u044F \u043B\u0438\u0446\u0430", None))
-        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QCoreApplication.translate(
-            "MainWindow", u"\u041A\u0430\u043C\u0435\u0440\u0430 \u0434\u043B\u044F \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", None))
-        self.btn_start_cam.setText(QCoreApplication.translate(
-            "MainWindow", u"\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043a\u0430\u043c\u0435\u0440\u0443", None))
-        self.capturePhoto.setText(QCoreApplication.translate(
-            "MainWindow", u"\u0421\u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0440\u043e\u0432\u0430\u0442\u044c", None))
-        self.btn_clear.setText(QCoreApplication.translate(
-            "MainWindow", u"\u041e\u0442\u0447\u0438\u0441\u0442\u0438\u0442\u044c", None))
-        self.btn_save.setText(QCoreApplication.translate(
-            "MainWindow", u"\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c", None))
-        self.btn_print.setText(QCoreApplication.translate(
-            "MainWindow", u"\u041f\u0435\u0447\u0430\u0442\u044c", None))
-        self.menuFile.setTitle(
-            QCoreApplication.translate("MainWindow", u"File", None))
-        self.menu.setTitle(QCoreApplication.translate(
-            "MainWindow", u"\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438", None))
-        self.menu_3.setTitle(QCoreApplication.translate(
-            "MainWindow", u"\u0421\u043f\u0438\u0441\u043a\u0438", None))
-        self.menu_2.setTitle(QCoreApplication.translate(
-            "MainWindow", u"\u0418\u0441\u0442\u043e\u0440\u0438\u044f", None))
+
+        MainWindow.setWindowTitle(translate('Temporary pass'))
+        self.actionExit.setText(translate('Exit'))
+        self.actionSave.setText(translate('Save'))
+        self.actionLoad.setText(translate('Load'))
+        self.actionExit_2.setText(translate('Exit'))
+        self.setting_cam.setText(translate('Camera settings'))
+        self.rotate_image_document.setText(translate('Flip document'))
+        self.no_rotate_image_document.setText(
+            translate('Do not flip the document'))
+        self.btn_show_personal_window.setText(translate('Employees'))
+        self.btn_show_place_window.setText(translate('Place of issue'))
+        self.update_list.setText(translate('Update lists'))
+        self.btn_show_about.setText(translate('About'))
+        self.exit.setText(translate('Exit'))
+        self.action_open_history.setText(translate('Pass history'))
+        self.groupBox.setTitle(F"{translate('Information')}:")
+        self.label.setText(F"{translate('Temporary pass')} №:")
+
+        self.label_2.setText(F"{translate('Date and time of issue')}:")
+        self.label_4.setText(F"{translate('Valid until')}:")
+        self.label_3.setText(F"{translate('Who issued')}:")
+        self.label_5.setText(F"{translate('Place of issue')}:")
+        self.label_6.setText(F"{translate('Receiving')}:")
+        self.label_7.setText(F"{translate('Purpose of the visit')}")
+
+        self.tabWidget.setTabText(self.tabWidget.indexOf(
+            self.tab), translate('Face camera'))
+        self.tabWidget.setTabText(self.tabWidget.indexOf(
+            self.tab_2), translate('Document camera'))
+        self.btn_start_cam.setText(translate('Launch сamera'))
+        self.capturePhoto.setText(translate('Take photo'))
+        self.btn_clear.setText(translate('Clear'))
+        self.btn_save.setText(translate('Save'))
+        self.btn_print.setText(translate('Print'))
+        self.menuFile.setTitle(translate('File'))
+        self.menu.setTitle(translate('Settings'))
+        self.menu_3.setTitle(translate('Lists'))
+        self.menu_2.setTitle(translate('History'))
     # retranslateUi