mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
Make sure current value in enum match with valid keys
This commit is contained in:
parent
2a8a444ec9
commit
bdfdc38b72
2 changed files with 15 additions and 1 deletions
|
|
@ -12,7 +12,7 @@
|
||||||
{
|
{
|
||||||
"color_code": [],
|
"color_code": [],
|
||||||
"layer_name_regex": [],
|
"layer_name_regex": [],
|
||||||
"family": "",
|
"family": "image",
|
||||||
"subset_template_name": ""
|
"subset_template_name": ""
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,20 @@ class EnumEntity(BaseEnumEntity):
|
||||||
)
|
)
|
||||||
super(EnumEntity, self).schema_validations()
|
super(EnumEntity, self).schema_validations()
|
||||||
|
|
||||||
|
def set_override_state(self, *args, **kwargs):
|
||||||
|
super(EnumEntity, self).set_override_state(*args, **kwargs)
|
||||||
|
|
||||||
|
# Make sure current value is valid
|
||||||
|
if self.multiselection:
|
||||||
|
new_value = []
|
||||||
|
for key in self._current_value:
|
||||||
|
if key in self.valid_keys:
|
||||||
|
new_value.append(key)
|
||||||
|
self._current_value = new_value
|
||||||
|
|
||||||
|
elif self._current_value not in self.valid_keys:
|
||||||
|
self._current_value = self.value_on_not_set
|
||||||
|
|
||||||
|
|
||||||
class HostsEnumEntity(BaseEnumEntity):
|
class HostsEnumEntity(BaseEnumEntity):
|
||||||
"""Enumeration of host names.
|
"""Enumeration of host names.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue