Merge pull request #1458 from pypeclub/feature/ftrack_specific_settings_save_message

This commit is contained in:
Milan Kolar 2021-05-04 16:07:04 +02:00 committed by GitHub
commit 2c15345089
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -127,10 +127,28 @@ class FtrackModule(
self, old_value, new_value, changes, new_value_metadata
):
"""Implementation of ISettingsChangeListener interface."""
if not self.ftrack_url:
raise SaveWarningExc((
"Ftrack URL is not set."
" Can't propagate changes to Ftrack server."
))
ftrack_changes = changes.get("modules", {}).get("ftrack", {})
url_change_msg = None
if "ftrack_server" in ftrack_changes:
url_change_msg = (
"Ftrack URL was changed."
" This change may need to restart OpenPype to take affect."
)
try:
session = self.create_ftrack_session()
except Exception:
self.log.warning("Couldn't create ftrack session.", exc_info=True)
if url_change_msg:
raise SaveWarningExc(url_change_msg)
raise SaveWarningExc((
"Saving of attributes to ftrack wasn't successful,"
" try running Create/Update Avalon Attributes in ftrack."
@ -204,6 +222,9 @@ class FtrackModule(
" Try running Create/Update Avalon Attributes in ftrack."
).format(", ".join(missing_attributes)))
if url_change_msg:
raise SaveWarningExc(url_change_msg)
def on_project_settings_save(self, *_args, **_kwargs):
"""Implementation of ISettingsChangeListener interface."""
# Ignore