mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
Merge pull request #2080 from pypeclub/feature/PYPE-1221_Missing-defaults-in-settings
Tray UI: Message box about missing settings defaults
This commit is contained in:
commit
35b86d1a72
2 changed files with 58 additions and 2 deletions
|
|
@ -25,7 +25,8 @@ from .lib import (
|
|||
)
|
||||
from .entities import (
|
||||
SystemSettings,
|
||||
ProjectSettings
|
||||
ProjectSettings,
|
||||
DefaultsNotDefined
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -51,6 +52,8 @@ __all__ = (
|
|||
"get_anatomy_settings",
|
||||
"get_environments",
|
||||
"get_local_settings",
|
||||
|
||||
"SystemSettings",
|
||||
"ProjectSettings"
|
||||
"ProjectSettings",
|
||||
"DefaultsNotDefined"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,11 @@ from openpype.api import (
|
|||
from openpype.lib import get_pype_execute_args
|
||||
from openpype.modules import TrayModulesManager
|
||||
from openpype import style
|
||||
from openpype.settings import (
|
||||
SystemSettings,
|
||||
ProjectSettings,
|
||||
DefaultsNotDefined
|
||||
)
|
||||
|
||||
from .pype_info_widget import PypeInfoWidget
|
||||
|
||||
|
|
@ -114,6 +119,54 @@ class TrayManager:
|
|||
|
||||
self.main_thread_timer = main_thread_timer
|
||||
|
||||
# For storing missing settings dialog
|
||||
self._settings_validation_dialog = None
|
||||
|
||||
self.execute_in_main_thread(self._startup_validations)
|
||||
|
||||
def _startup_validations(self):
|
||||
"""Run possible startup validations."""
|
||||
self._validate_settings_defaults()
|
||||
|
||||
def _validate_settings_defaults(self):
|
||||
valid = True
|
||||
try:
|
||||
SystemSettings()
|
||||
ProjectSettings()
|
||||
|
||||
except DefaultsNotDefined:
|
||||
valid = False
|
||||
|
||||
if valid:
|
||||
return
|
||||
|
||||
title = "Settings miss default values"
|
||||
msg = (
|
||||
"Your OpenPype will not work as expected! \n"
|
||||
"Some default values in settigs are missing. \n\n"
|
||||
"Please contact OpenPype team."
|
||||
)
|
||||
msg_box = QtWidgets.QMessageBox(
|
||||
QtWidgets.QMessageBox.Warning,
|
||||
title,
|
||||
msg,
|
||||
QtWidgets.QMessageBox.Ok,
|
||||
flags=QtCore.Qt.Dialog
|
||||
)
|
||||
icon = QtGui.QIcon(resources.get_openpype_icon_filepath())
|
||||
msg_box.setWindowIcon(icon)
|
||||
msg_box.setStyleSheet(style.load_stylesheet())
|
||||
msg_box.buttonClicked.connect(self._post_validate_settings_defaults)
|
||||
|
||||
self._settings_validation_dialog = msg_box
|
||||
|
||||
msg_box.show()
|
||||
|
||||
def _post_validate_settings_defaults(self):
|
||||
widget = self._settings_validation_dialog
|
||||
self._settings_validation_dialog = None
|
||||
widget.deleteLater()
|
||||
|
||||
def show_tray_message(self, title, message, icon=None, msecs=None):
|
||||
"""Show tray message.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue