mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
renamed SaveWarning to SaveWarningExc
This commit is contained in:
parent
1418d9734a
commit
bfb0874f03
6 changed files with 26 additions and 26 deletions
|
|
@ -13,7 +13,7 @@ from openpype.modules import (
|
|||
ILaunchHookPaths,
|
||||
ISettingsChangeListener
|
||||
)
|
||||
from openpype.settings import SaveWarning
|
||||
from openpype.settings import SaveWarningExc
|
||||
|
||||
FTRACK_MODULE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
|
|
@ -136,7 +136,7 @@ class FtrackModule(
|
|||
session = self.create_ftrack_session()
|
||||
except Exception:
|
||||
self.log.warning("Couldn't create ftrack session.", exc_info=True)
|
||||
raise SaveWarning((
|
||||
raise SaveWarningExc((
|
||||
"Couldn't create Ftrack session."
|
||||
" You may need to update applications"
|
||||
" and tools in Ftrack custom attributes using defined action."
|
||||
|
|
@ -205,7 +205,7 @@ class FtrackModule(
|
|||
session.commit()
|
||||
|
||||
if missing_attributes:
|
||||
raise SaveWarning((
|
||||
raise SaveWarningExc((
|
||||
"Couldn't find custom attribute/s ({}) to update."
|
||||
" You may need to update applications"
|
||||
" and tools in Ftrack custom attributes using defined action."
|
||||
|
|
@ -234,7 +234,7 @@ class FtrackModule(
|
|||
session = self.create_ftrack_session()
|
||||
except Exception:
|
||||
self.log.warning("Couldn't create ftrack session.", exc_info=True)
|
||||
raise SaveWarning((
|
||||
raise SaveWarningExc((
|
||||
"Couldn't create Ftrack session."
|
||||
" You may need to update applications"
|
||||
" and tools in Ftrack custom attributes using defined action."
|
||||
|
|
@ -250,7 +250,7 @@ class FtrackModule(
|
|||
" Can't push attribute changes."
|
||||
).format(project_name)
|
||||
self.log.warning(msg)
|
||||
raise SaveWarning(msg)
|
||||
raise SaveWarningExc(msg)
|
||||
|
||||
project_id = project_entity["id"]
|
||||
|
||||
|
|
@ -323,7 +323,7 @@ class FtrackModule(
|
|||
for key, value in failed.items()
|
||||
])
|
||||
error_msg += "\nFailed to set: {}".format(joined_failed)
|
||||
raise SaveWarning(error_msg)
|
||||
raise SaveWarningExc(error_msg)
|
||||
|
||||
def create_ftrack_session(self, **session_kwargs):
|
||||
import ftrack_api
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from .exceptions import (
|
||||
SaveWarning
|
||||
SaveWarningExc
|
||||
)
|
||||
from .lib import (
|
||||
get_system_settings,
|
||||
|
|
@ -15,7 +15,7 @@ from .entities import (
|
|||
|
||||
|
||||
__all__ = (
|
||||
"SaveWarning",
|
||||
"SaveWarningExc",
|
||||
|
||||
"get_system_settings",
|
||||
"get_project_settings",
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ from openpype.settings.constants import (
|
|||
PROJECT_ANATOMY_KEY,
|
||||
KEY_REGEX
|
||||
)
|
||||
from openpype.settings.exceptions import SaveWarning
|
||||
from openpype.settings.exceptions import SaveWarningExc
|
||||
|
||||
from openpype.settings.lib import (
|
||||
DEFAULTS_DIR,
|
||||
|
|
@ -728,16 +728,16 @@ class ProjectSettings(RootEntity):
|
|||
warnings = []
|
||||
try:
|
||||
save_project_settings(self.project_name, project_settings)
|
||||
except SaveWarning as exc:
|
||||
except SaveWarningExc as exc:
|
||||
warnings.extend(exc.warnings)
|
||||
|
||||
try:
|
||||
save_project_anatomy(self.project_name, project_anatomy)
|
||||
except SaveWarning as exc:
|
||||
except SaveWarningExc as exc:
|
||||
warnings.extend(exc.warnings)
|
||||
|
||||
if warnings:
|
||||
raise SaveWarning(warnings)
|
||||
raise SaveWarningExc(warnings)
|
||||
|
||||
def _validate_defaults_to_save(self, value):
|
||||
"""Valiations of default values before save."""
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ class SaveSettingsValidation(Exception):
|
|||
pass
|
||||
|
||||
|
||||
class SaveWarning(SaveSettingsValidation):
|
||||
class SaveWarningExc(SaveSettingsValidation):
|
||||
def __init__(self, warnings):
|
||||
if isinstance(warnings, str):
|
||||
warnings = [warnings]
|
||||
self.warnings = warnings
|
||||
msg = " | ".join(warnings)
|
||||
super(SaveWarning, self).__init__(msg)
|
||||
super(SaveWarningExc, self).__init__(msg)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import logging
|
|||
import platform
|
||||
import copy
|
||||
from .exceptions import (
|
||||
SaveWarning
|
||||
SaveWarningExc
|
||||
)
|
||||
from .constants import (
|
||||
M_OVERRIDEN_KEY,
|
||||
|
|
@ -111,7 +111,7 @@ def save_studio_settings(data):
|
|||
data(dict): Overrides data with metadata defying studio overrides.
|
||||
|
||||
Raises:
|
||||
SaveWarning: If any module raises the exception.
|
||||
SaveWarningExc: If any module raises the exception.
|
||||
"""
|
||||
# Notify Pype modules
|
||||
from openpype.modules import ModulesManager, ISettingsChangeListener
|
||||
|
|
@ -129,12 +129,12 @@ def save_studio_settings(data):
|
|||
if isinstance(module, ISettingsChangeListener):
|
||||
try:
|
||||
module.on_system_settings_save(old_data, new_data, changes)
|
||||
except SaveWarning as exc:
|
||||
except SaveWarningExc as exc:
|
||||
warnings.extend(exc.warnings)
|
||||
|
||||
_SETTINGS_HANDLER.save_studio_settings(data)
|
||||
if warnings:
|
||||
raise SaveWarning(warnings)
|
||||
raise SaveWarningExc(warnings)
|
||||
|
||||
|
||||
@require_handler
|
||||
|
|
@ -155,7 +155,7 @@ def save_project_settings(project_name, overrides):
|
|||
overrides(dict): Overrides data with metadata defying studio overrides.
|
||||
|
||||
Raises:
|
||||
SaveWarning: If any module raises the exception.
|
||||
SaveWarningExc: If any module raises the exception.
|
||||
"""
|
||||
# Notify Pype modules
|
||||
from openpype.modules import ModulesManager, ISettingsChangeListener
|
||||
|
|
@ -184,13 +184,13 @@ def save_project_settings(project_name, overrides):
|
|||
module.on_project_settings_save(
|
||||
old_data, new_data, project_name, changes
|
||||
)
|
||||
except SaveWarning as exc:
|
||||
except SaveWarningExc as exc:
|
||||
warnings.extend(exc.warnings)
|
||||
|
||||
_SETTINGS_HANDLER.save_project_settings(project_name, overrides)
|
||||
|
||||
if warnings:
|
||||
raise SaveWarning(warnings)
|
||||
raise SaveWarningExc(warnings)
|
||||
|
||||
|
||||
@require_handler
|
||||
|
|
@ -211,7 +211,7 @@ def save_project_anatomy(project_name, anatomy_data):
|
|||
overrides(dict): Overrides data with metadata defying studio overrides.
|
||||
|
||||
Raises:
|
||||
SaveWarning: If any module raises the exception.
|
||||
SaveWarningExc: If any module raises the exception.
|
||||
"""
|
||||
# Notify Pype modules
|
||||
from openpype.modules import ModulesManager, ISettingsChangeListener
|
||||
|
|
@ -240,13 +240,13 @@ def save_project_anatomy(project_name, anatomy_data):
|
|||
module.on_project_anatomy_save(
|
||||
old_data, new_data, changes, project_name
|
||||
)
|
||||
except SaveWarning as exc:
|
||||
except SaveWarningExc as exc:
|
||||
warnings.extend(exc.warnings)
|
||||
|
||||
_SETTINGS_HANDLER.save_project_anatomy(project_name, anatomy_data)
|
||||
|
||||
if warnings:
|
||||
raise SaveWarning(warnings)
|
||||
raise SaveWarningExc(warnings)
|
||||
|
||||
|
||||
@require_handler
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ from openpype.settings.entities import (
|
|||
SchemaError
|
||||
)
|
||||
|
||||
from openpype.settings import SaveWarning
|
||||
from openpype.settings import SaveWarningExc
|
||||
from .widgets import ProjectListWidget
|
||||
|
||||
from . import lib
|
||||
|
|
@ -272,7 +272,7 @@ class SettingsCategoryWidget(QtWidgets.QWidget):
|
|||
# not required.
|
||||
self.reset()
|
||||
|
||||
except SaveWarning as exc:
|
||||
except SaveWarningExc as exc:
|
||||
warnings = [
|
||||
"<b>Settings were saved but few issues happened.</b>"
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue