mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
added docstrings to SettingObject's methods
This commit is contained in:
parent
3c0fc416d4
commit
737d02ec9e
1 changed files with 71 additions and 4 deletions
|
|
@ -103,6 +103,9 @@ class SettingObject:
|
|||
def had_studio_override(self):
|
||||
"""Item had studio overrides on refresh.
|
||||
|
||||
Use attribute `_had_studio_override` which should be changed only
|
||||
during methods `update_studio_values` and `update_default_values`.
|
||||
|
||||
Returns:
|
||||
bool
|
||||
|
||||
|
|
@ -114,7 +117,7 @@ class SettingObject:
|
|||
"""Item has studio override at the moment.
|
||||
|
||||
With combination of `had_studio_override` is possible to know if item
|
||||
has changes (not just value change).
|
||||
is modified (not value change).
|
||||
|
||||
Returns:
|
||||
bool
|
||||
|
|
@ -190,7 +193,8 @@ class SettingObject:
|
|||
|
||||
@property
|
||||
def is_overidable(self):
|
||||
"""Should care about overrides."""
|
||||
""" care about overrides."""
|
||||
|
||||
return self._parent.is_overidable
|
||||
|
||||
def any_parent_overriden(self):
|
||||
|
|
@ -200,6 +204,7 @@ class SettingObject:
|
|||
bool
|
||||
|
||||
"""
|
||||
|
||||
if self._parent._is_overriden:
|
||||
return True
|
||||
return self._parent.any_parent_overriden()
|
||||
|
|
@ -222,6 +227,7 @@ class SettingObject:
|
|||
def style_state(
|
||||
cls, has_studio_override, is_invalid, is_overriden, is_modified
|
||||
):
|
||||
"""Return stylesheet state by intered booleans."""
|
||||
items = []
|
||||
if is_invalid:
|
||||
items.append("invalid")
|
||||
|
|
@ -314,6 +320,15 @@ class SettingObject:
|
|||
self.ignore_value_changes = False
|
||||
|
||||
def discard_changes(self):
|
||||
"""Item's implementation to discard all changes made by user.
|
||||
|
||||
Reset all values to same values as had when opened GUI
|
||||
or when changed project.
|
||||
|
||||
Must not affect `had_studio_override` value or `was_overriden`
|
||||
value. It must be marked that there are keys/values which are not in
|
||||
defaults or overrides.
|
||||
"""
|
||||
raise NotImplementedError(
|
||||
"{} Method `discard_changes` not implemented!".format(
|
||||
repr(self)
|
||||
|
|
@ -326,6 +341,10 @@ class SettingObject:
|
|||
self.ignore_value_changes = False
|
||||
|
||||
def set_studio_default(self):
|
||||
"""Item's implementation to set current values as studio's overrides.
|
||||
|
||||
Mark item and it's children as they have studio overrides.
|
||||
"""
|
||||
raise NotImplementedError(
|
||||
"{} Method `set_studio_default` not implemented!".format(
|
||||
repr(self)
|
||||
|
|
@ -338,6 +357,11 @@ class SettingObject:
|
|||
self.ignore_value_changes = False
|
||||
|
||||
def reset_to_pype_default(self):
|
||||
"""Item's implementation to remove studio overrides.
|
||||
|
||||
Mark item as it does not have studio overrides unset studio
|
||||
override values.
|
||||
"""
|
||||
raise NotImplementedError(
|
||||
"{} Method `reset_to_pype_default` not implemented!".format(
|
||||
repr(self)
|
||||
|
|
@ -350,6 +374,11 @@ class SettingObject:
|
|||
self.ignore_value_changes = False
|
||||
|
||||
def remove_overrides(self):
|
||||
"""Item's implementation to remove project overrides.
|
||||
|
||||
Mark item as does not have project overrides. Must not change
|
||||
`was_overriden` attribute value.
|
||||
"""
|
||||
raise NotImplementedError(
|
||||
"{} Method `remove_overrides` not implemented!".format(
|
||||
repr(self)
|
||||
|
|
@ -362,11 +391,21 @@ class SettingObject:
|
|||
self.ignore_value_changes = False
|
||||
|
||||
def set_as_overriden(self):
|
||||
"""Item's implementation to set values as overriden for project.
|
||||
|
||||
Mark item and all it's children as they're overriden. Must skip
|
||||
items with children items that has attributes `is_group`
|
||||
and `any_parent_is_group` set to False. In that case those items
|
||||
are not meant to be overridable and should trigger the method on it's
|
||||
children.
|
||||
|
||||
"""
|
||||
raise NotImplementedError(
|
||||
"{} Method `set_as_overriden` not implemented!".format(repr(self))
|
||||
)
|
||||
|
||||
def hierarchical_style_update(self):
|
||||
"""Trigger update style method down the hierarchy."""
|
||||
raise NotImplementedError(
|
||||
"{} Method `hierarchical_style_update` not implemented!".format(
|
||||
repr(self)
|
||||
|
|
@ -374,23 +413,51 @@ class SettingObject:
|
|||
)
|
||||
|
||||
def update_default_values(self, parent_values):
|
||||
"""Fill default values on startup or on refresh.
|
||||
|
||||
Default values stored in `pype` repository should update all items in
|
||||
schema. Each item should take values for his key and set it's value or
|
||||
pass values down to children items.
|
||||
|
||||
Args:
|
||||
parent_values (dict): Values of parent's item. But in case item is
|
||||
used as widget, `parent_values` contain value for item.
|
||||
"""
|
||||
raise NotImplementedError(
|
||||
"{} does not have implemented `update_default_values`".format(self)
|
||||
)
|
||||
|
||||
def update_studio_values(self, parent_values):
|
||||
"""Fill studio override values on startup or on refresh.
|
||||
|
||||
Set studio value if is not set to NOT_SET, in that case studio
|
||||
overrides are not set yet.
|
||||
|
||||
Args:
|
||||
parent_values (dict): Values of parent's item. But in case item is
|
||||
used as widget, `parent_values` contain value for item.
|
||||
"""
|
||||
raise NotImplementedError(
|
||||
"{} does not have implemented `update_studio_values`".format(self)
|
||||
)
|
||||
|
||||
def apply_overrides(self, parent_values):
|
||||
"""Fill project override values on startup, refresh or project change.
|
||||
|
||||
Set project value if is not set to NOT_SET, in that case project
|
||||
overrides are not set yet.
|
||||
|
||||
Args:
|
||||
parent_values (dict): Values of parent's item. But in case item is
|
||||
used as widget, `parent_values` contain value for item.
|
||||
"""
|
||||
raise NotImplementedError(
|
||||
"{} does not have implemented `apply_overrides`".format(self)
|
||||
)
|
||||
|
||||
@property
|
||||
def child_has_studio_override(self):
|
||||
"""Any children item is modified."""
|
||||
"""Any children item has studio overrides."""
|
||||
raise NotImplementedError(
|
||||
"{} does not have implemented `child_has_studio_override`".format(
|
||||
self
|
||||
|
|
@ -406,7 +473,7 @@ class SettingObject:
|
|||
|
||||
@property
|
||||
def child_overriden(self):
|
||||
"""Any children item is overriden."""
|
||||
"""Any children item has project overrides."""
|
||||
raise NotImplementedError(
|
||||
"{} does not have implemented `child_overriden`".format(self)
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue