-
-
+
-
+
- Добавить новые
+ Обновить
diff --git a/resources/forms/teacher_list.ui b/resources/forms/teacher_list.ui
index 5c07e19..c6c8d87 100644
--- a/resources/forms/teacher_list.ui
+++ b/resources/forms/teacher_list.ui
@@ -14,16 +14,6 @@
Список учителей
- -
-
-
- false
-
-
- false
-
-
-
-
@@ -43,13 +33,30 @@
- -
+
-
Добавить новых
+ -
+
+
+ false
+
+
+ false
+
+
+
+ -
+
+
+ Обновить
+
+
+
diff --git a/src/student_journal/bootstrap/entrypoint/qt.py b/src/student_journal/bootstrap/entrypoint/qt.py
index d43684a..813c951 100644
--- a/src/student_journal/bootstrap/entrypoint/qt.py
+++ b/src/student_journal/bootstrap/entrypoint/qt.py
@@ -1,3 +1,5 @@
+import logging
+import signal
import sys
from functools import partial
from types import TracebackType
@@ -6,27 +8,51 @@
from student_journal.adapters.error_locator import ErrorLocator
from student_journal.application.exceptions.base import ApplicationError
+from student_journal.application.exceptions.student import (
+ StudentIsNotAuthenticatedError,
+)
from student_journal.bootstrap.di.container import get_container_for_gui
from student_journal.presentation.widget.main_window import MainWindow
+logging.basicConfig(
+ level=logging.DEBUG,
+ format="%(asctime)s %(levelname)s %(name)s %(message)s",
+ datefmt="%Y-%m-%d %H:%M:%S",
+)
+
+
+def display_error_text(wnd: MainWindow, text: str) -> None:
+ msg = QMessageBox(wnd)
+ msg.setIcon(QMessageBox.Icon.Critical)
+ msg.setWindowTitle("Ошибка приложения")
+ msg.setText("Произошла ошибка!")
+ msg.setInformativeText(text)
+ msg.setStandardButtons(QMessageBox.StandardButton.Ok)
+ msg.exec()
+
def except_hook(
+ app: QApplication,
error_locator: ErrorLocator,
wnd: MainWindow,
_exc_type: type[Exception],
- exc_value: Exception,
+ exc_value: BaseException,
_exc_traceback: TracebackType,
) -> None:
match exc_value:
+ case StudentIsNotAuthenticatedError() as e:
+ text = error_locator.get_text(e)
+ display_error_text(wnd, text)
+ app.closeAllWindows()
+ wnd.show()
+ wnd.display_register()
+
case ApplicationError() as e:
- msg = QMessageBox(wnd)
- msg.setIcon(QMessageBox.Icon.Critical)
- msg.setWindowTitle("Ошибка приложения")
- msg.setText("Произошла ошибка!")
- msg.setInformativeText(error_locator.get_text(e))
- msg.setStandardButtons(QMessageBox.StandardButton.Ok)
- msg.exec()
- case _:
+ text = error_locator.get_text(e)
+ display_error_text(wnd, text)
+
+ case BaseException() as e:
+ logging.critical("Unhandled exception", exc_info=e)
sys.exit()
@@ -38,6 +64,7 @@ def main(_argv: list[str]) -> None:
main_wnd.show()
locator = container.get(ErrorLocator)
- sys.excepthook = partial(except_hook, locator, main_wnd)
+ sys.excepthook = partial(except_hook, app, locator, main_wnd)
+ signal.signal(signal.SIGINT, signal.SIG_DFL)
sys.exit(app.exec())
diff --git a/src/student_journal/presentation/ui/about_ui.py b/src/student_journal/presentation/ui/about_ui.py
index 55c6263..897c3dd 100644
--- a/src/student_journal/presentation/ui/about_ui.py
+++ b/src/student_journal/presentation/ui/about_ui.py
@@ -13,7 +13,6 @@ class Ui_About(object):
def setupUi(self, About):
About.setObjectName("About")
About.setWindowModality(QtCore.Qt.WindowModality.NonModal)
- About.resize(920, 557)
About.setWhatsThis("")
self.gridLayout = QtWidgets.QGridLayout(About)
self.gridLayout.setObjectName("gridLayout")
@@ -27,14 +26,9 @@ def setupUi(self, About):
self.textBrowser = QtWidgets.QTextBrowser(parent=About)
self.textBrowser.setObjectName("textBrowser")
self.gridLayout.addWidget(self.textBrowser, 1, 0, 1, 1)
- self.close_btn = QtWidgets.QPushButton(parent=About)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.close_btn.sizePolicy().hasHeightForWidth())
- self.close_btn.setSizePolicy(sizePolicy)
- self.close_btn.setObjectName("close_btn")
- self.gridLayout.addWidget(self.close_btn, 2, 0, 1, 1)
self.retranslateUi(About)
QtCore.QMetaObject.connectSlotsByName(About)
@@ -59,4 +53,3 @@ def retranslateUi(self, About):
"Разработано этими замечательными людьми и многообещающими мужчинами:
\n"
"- Любавский Илья
\n"
"- Роман Мельниченко