-
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 'feature/pyqt-ubuntu20' into 'develop'
Feature/pyqt ubuntu20 See merge request cps/commonroad/commonroad-scenario-designer!447
- Loading branch information
Showing
15 changed files
with
105 additions
and
60 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from crdesigner.common import logging | ||
|
||
try: | ||
from sumocr.interface.sumo_simulation import SumoSimulation # noqa: F401 | ||
|
||
from crdesigner.map_conversion.sumo_map.config import SumoConfig # noqa: F401 | ||
from crdesigner.map_conversion.sumo_map.cr2sumo.converter import ( # noqa: F401 | ||
CR2SumoMapConverter, | ||
) | ||
|
||
SUMO_AVAILABLE = True | ||
except ImportError: | ||
logging.warning( | ||
"Cannot import SUMO. SUMO simulation will not be offered in Scenario Designer GUI. " | ||
"The GUI and other map conversions should work." | ||
) | ||
SUMO_AVAILABLE = False |
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
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
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
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,28 +1,31 @@ | ||
""" """ | ||
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) | ||
|
||
|
||
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) | ||
except (ImportError, RuntimeError): | ||
pyqt_available = False |
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
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
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