-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'update-changelog' into 'develop'
Update changelog See merge request cps/commonroad/commonroad-scenario-designer!448
- Loading branch information
Showing
2 changed files
with
22 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |