From 2d17d8cfe44396992d9a682dd1d436f3eaa0293a Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Rouby <pierre-antoine.rouby@inrae.fr> Date: Mon, 13 May 2024 14:44:15 +0200 Subject: [PATCH] Geometry: Add import exception handler. --- src/Model/Except.py | 3 ++- src/Model/Geometry/Reach.py | 2 +- src/View/Geometry/UndoCommand.py | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Model/Except.py b/src/Model/Except.py index bd6b41ab..6687fee3 100644 --- a/src/Model/Except.py +++ b/src/Model/Except.py @@ -21,7 +21,7 @@ from PyQt5.QtCore import ( ) from PyQt5.QtWidgets import ( - QApplication, QMessageBox, + QApplication, QMessageBox, QLabel, ) _translate = QCoreApplication.translate @@ -34,6 +34,7 @@ _translate = QCoreApplication.translate def exception_message_box(exception): msg = QMessageBox() msg.setIcon(QMessageBox.Critical) + msg.findChild(QLabel, "qt_msgbox_label").setFixedWidth(384) msg.setText("Exception :") msg.setInformativeText(f"{exception}") diff --git a/src/Model/Geometry/Reach.py b/src/Model/Geometry/Reach.py index 04a75c91..812ddc51 100644 --- a/src/Model/Geometry/Reach.py +++ b/src/Model/Geometry/Reach.py @@ -572,7 +572,7 @@ class Reach(SQLSubModel): raise FileFormatError( file_path_name, - f"Geometry file extention ({ext}) unkown" + f"Geometry file extention ('.{ext}') unkown" ) @timer diff --git a/src/View/Geometry/UndoCommand.py b/src/View/Geometry/UndoCommand.py index 3f21577d..f1d181f5 100644 --- a/src/View/Geometry/UndoCommand.py +++ b/src/View/Geometry/UndoCommand.py @@ -19,7 +19,7 @@ import logging from copy import deepcopy -from tools import trace, timer +from tools import trace, timer, logger_exception from PyQt5.QtWidgets import ( QMessageBox, QUndoCommand, QUndoStack, @@ -214,6 +214,7 @@ class ImportCommand(QUndoCommand): self._profiles = self._reach.import_geometry(self._filename) self._profiles.reverse() except Exception as e: + logger_exception(e) exception_message_box(e) else: for profile in self._profiles: -- GitLab