diff --git a/CHANGELOG.md b/CHANGELOG.md index 835985ba..2724ce5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - Command line interface: Providing no input path - Scenario fails to be opened, if any of the dynamic obstacles does not contain a prediction - GUI: wrong usage of button +- Check for qt6 so that map conversions work under Ubuntu 20.04 ## [0.8.2] - 2024-07-22 diff --git a/crdesigner/ui/gui/utilities/errors.py b/crdesigner/ui/gui/utilities/errors.py index 6f917056..4b316c67 100644 --- a/crdesigner/ui/gui/utilities/errors.py +++ b/crdesigner/ui/gui/utilities/errors.py @@ -1,31 +1,26 @@ -try: - # required for Ubuntu 20.04 since there a system library is too old for pyqt6 and the import fails - # when not importing this, one can still use the map conversion - from PyQt6.QtWidgets import QMessageBox, QWidget +from PyQt6.QtWidgets import QMessageBox, QWidget - pyqt_available = True - def _message( - widget: QWidget, - title: str, - text: str, - buttons=QMessageBox.StandardButton.Ok, - default_button=QMessageBox.StandardButton.Ok, - ) -> QMessageBox.StandardButton: - messagebox = QMessageBox() - reply = messagebox.warning(widget, title, text, buttons, default_button) - messagebox.close() - return reply +def _message( + widget: QWidget, + title: str, + text: str, + buttons=QMessageBox.StandardButton.Ok, + default_button=QMessageBox.StandardButton.Ok, +) -> QMessageBox.StandardButton: + messagebox = QMessageBox() + reply = messagebox.warning(widget, title, text, buttons, default_button) + messagebox.close() + return reply - def error( - widget: QWidget, text: str, buttons=QMessageBox.StandardButton.Ok, default_button=QMessageBox.StandardButton.Ok - ) -> QMessageBox.StandardButton: - return _message(widget, "Error", text, buttons, default_button) - def warning( - widget: QWidget, text: str, buttons=QMessageBox.StandardButton.Ok, default_button=QMessageBox.StandardButton.Ok - ) -> QMessageBox.StandardButton: - return _message(widget, "Warning", text, buttons, default_button) +def error( + widget: QWidget, text: str, buttons=QMessageBox.StandardButton.Ok, default_button=QMessageBox.StandardButton.Ok +) -> QMessageBox.StandardButton: + return _message(widget, "Error", text, buttons, default_button) -except (ImportError, RuntimeError): - pyqt_available = False + +def warning( + widget: QWidget, text: str, buttons=QMessageBox.StandardButton.Ok, default_button=QMessageBox.StandardButton.Ok +) -> QMessageBox.StandardButton: + return _message(widget, "Warning", text, buttons, default_button)