schema_validations method implemented to item entities

This commit is contained in:
iLLiCiTiT 2021-01-26 13:13:23 +01:00
parent 9e0f32fce8
commit c36c142db3
2 changed files with 26 additions and 0 deletions

View file

@ -28,6 +28,14 @@ class InputEntity(ItemEntity):
self._current_value = NOT_SET
def schema_validations(self):
if not self.file_item:
raise ValueError(
"{}: Missing parent file entity.".format(self.path)
)
super(InputEntity, self).schema_validations()
def __eq__(self, other):
if isinstance(other, ItemEntity):
return self.current_value == other.current_value

View file

@ -206,6 +206,9 @@ class GUIEntity(ItemEntity):
update_studio_values = None
update_project_values = None
def schema_validations(self):
return
def item_initalization(self):
self.valid_value_types = tuple()
self.require_key = False
@ -242,6 +245,11 @@ class DictImmutableKeysEntity(ItemEntity):
"{} - on_value_change".format(self.__class__.__name__)
)
def schema_validations(self):
super(DictImmutableKeysEntity, self).schema_validations()
for child_obj in self.children:
child_obj.schema_validations()
def on_change(self):
self.update_current_metadata()
self.parent.on_child_change(self)
@ -659,6 +667,11 @@ class DictMutableKeysEntity(ItemEntity):
" file item so can't store metadata."
))
def schema_validations(self):
super(DictMutableKeysEntity, self).schema_validations()
for child_obj in self.children:
child_obj.schema_validations()
def get_child_path(self, child_obj):
result_key = None
for key, _child_obj in self.children_by_key.items():
@ -952,6 +965,11 @@ class ListEntity(ItemEntity):
self.collapsible = self.schema_data.get("collapsible") or True
self.collapsed = self.schema_data.get("collapsed") or False
def schema_validations(self):
super(ListEntity, self).schema_validations()
for child_obj in self.children:
child_obj.schema_validations()
def get_child_path(self, child_obj):
result_idx = None
for idx, _child_obj in enumerate(self.children):