mirror of https://gitlab.com/pamhyr/pamhyr2
Geometry: Add import exception handler.
parent
ef583fc9bb
commit
2d17d8cfe4
|
|
@ -21,7 +21,7 @@ from PyQt5.QtCore import (
|
||||||
)
|
)
|
||||||
|
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QApplication, QMessageBox,
|
QApplication, QMessageBox, QLabel,
|
||||||
)
|
)
|
||||||
|
|
||||||
_translate = QCoreApplication.translate
|
_translate = QCoreApplication.translate
|
||||||
|
|
@ -34,6 +34,7 @@ _translate = QCoreApplication.translate
|
||||||
def exception_message_box(exception):
|
def exception_message_box(exception):
|
||||||
msg = QMessageBox()
|
msg = QMessageBox()
|
||||||
msg.setIcon(QMessageBox.Critical)
|
msg.setIcon(QMessageBox.Critical)
|
||||||
|
msg.findChild(QLabel, "qt_msgbox_label").setFixedWidth(384)
|
||||||
|
|
||||||
msg.setText("Exception :")
|
msg.setText("Exception :")
|
||||||
msg.setInformativeText(f"{exception}")
|
msg.setInformativeText(f"{exception}")
|
||||||
|
|
|
||||||
|
|
@ -572,7 +572,7 @@ class Reach(SQLSubModel):
|
||||||
|
|
||||||
raise FileFormatError(
|
raise FileFormatError(
|
||||||
file_path_name,
|
file_path_name,
|
||||||
f"Geometry file extention ({ext}) unkown"
|
f"Geometry file extention ('.{ext}') unkown"
|
||||||
)
|
)
|
||||||
|
|
||||||
@timer
|
@timer
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from tools import trace, timer
|
from tools import trace, timer, logger_exception
|
||||||
|
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QMessageBox, QUndoCommand, QUndoStack,
|
QMessageBox, QUndoCommand, QUndoStack,
|
||||||
|
|
@ -214,6 +214,7 @@ class ImportCommand(QUndoCommand):
|
||||||
self._profiles = self._reach.import_geometry(self._filename)
|
self._profiles = self._reach.import_geometry(self._filename)
|
||||||
self._profiles.reverse()
|
self._profiles.reverse()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
logger_exception(e)
|
||||||
exception_message_box(e)
|
exception_message_box(e)
|
||||||
else:
|
else:
|
||||||
for profile in self._profiles:
|
for profile in self._profiles:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue