mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
implemented get_entity_from_path for system settings
This commit is contained in:
parent
81bebe03c6
commit
5c9016c676
1 changed files with 15 additions and 4 deletions
|
|
@ -189,11 +189,10 @@ class RootEntity(BaseItemEntity):
|
|||
if not KEY_REGEX.match(key):
|
||||
raise InvalidKeySymbols(self.path, key)
|
||||
|
||||
@abstractmethod
|
||||
def get_entity_from_path(self, path):
|
||||
"""Return system settings entity."""
|
||||
raise NotImplementedError((
|
||||
"Method `get_entity_from_path` not available for \"{}\""
|
||||
).format(self.__class__.__name__))
|
||||
"""Return entity matching passed path."""
|
||||
pass
|
||||
|
||||
def create_schema_object(self, schema_data, *args, **kwargs):
|
||||
"""Create entity by entered schema data.
|
||||
|
|
@ -505,6 +504,18 @@ class SystemSettings(RootEntity):
|
|||
if set_studio_state:
|
||||
self.set_studio_state()
|
||||
|
||||
def get_entity_from_path(self, path):
|
||||
"""Return system settings entity."""
|
||||
path_parts = path.split("/")
|
||||
first_part = path_parts[0]
|
||||
output = self
|
||||
if first_part == self.root_key:
|
||||
path_parts.pop(0)
|
||||
|
||||
for path_part in path_parts:
|
||||
output = output[path_part]
|
||||
return output
|
||||
|
||||
def _reset_values(self):
|
||||
default_value = get_default_settings()[SYSTEM_SETTINGS_KEY]
|
||||
for key, child_obj in self.non_gui_children.items():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue