mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
invalid styles are ok in most of cases
This commit is contained in:
parent
6164481763
commit
eacf8cd401
3 changed files with 35 additions and 3 deletions
|
|
@ -64,12 +64,17 @@ class InputWidget(BaseWidget):
|
|||
self.label_widget.setProperty("state", state)
|
||||
self.label_widget.style().polish(self.label_widget)
|
||||
|
||||
@property
|
||||
def child_invalid(self):
|
||||
return self.is_invalid
|
||||
|
||||
def hierarchical_style_update(self):
|
||||
self.update_style()
|
||||
|
||||
|
||||
class GUIWidget(BaseWidget):
|
||||
separator_height = 2
|
||||
child_invalid = False
|
||||
|
||||
def create_ui(self):
|
||||
entity_type = self.entity["type"]
|
||||
|
|
|
|||
|
|
@ -170,6 +170,10 @@ class ModifiableDictItem(QtWidgets.QWidget):
|
|||
self.create_addible_ui()
|
||||
self.update_style()
|
||||
|
||||
@property
|
||||
def child_invalid(self):
|
||||
return self.is_key_duplicated or self.input_field.child_invalid
|
||||
|
||||
def create_addible_ui(self):
|
||||
key_input = QtWidgets.QLineEdit(self)
|
||||
key_input.setObjectName("DictKey")
|
||||
|
|
@ -539,6 +543,13 @@ class DictMutableKeysWidget(BaseWidget):
|
|||
|
||||
self.entity_widget.add_widget_to_layout(self, label)
|
||||
|
||||
@property
|
||||
def child_invalid(self):
|
||||
for input_field in self.input_fields:
|
||||
if input_field.child_invalid:
|
||||
return True
|
||||
return False
|
||||
|
||||
def add_required_keys(self):
|
||||
# TODO implement
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -131,8 +131,7 @@ class DictImmutableKeysWidget(BaseWidget):
|
|||
def update_style(self, is_overriden=None):
|
||||
child_has_studio_override = self.entity.child_has_studio_override
|
||||
child_modified = self.entity.has_unsaved_changes
|
||||
# child_invalid = self.child_invalid
|
||||
child_invalid = False
|
||||
child_invalid = self.child_invalid
|
||||
|
||||
child_style_state = self.get_style_state(
|
||||
child_invalid,
|
||||
|
|
@ -175,6 +174,13 @@ class DictImmutableKeysWidget(BaseWidget):
|
|||
|
||||
self._style_state = style_state
|
||||
|
||||
@property
|
||||
def child_invalid(self):
|
||||
for input_field in self.input_fields:
|
||||
if input_field.child_invalid:
|
||||
return True
|
||||
return False
|
||||
|
||||
def _on_entity_change(self):
|
||||
print("_on_entity_change", self.__class__.__name__, self.entity.path)
|
||||
|
||||
|
|
@ -373,8 +379,14 @@ class RawJsonWidget(InputWidget):
|
|||
def _on_value_change(self):
|
||||
if self.ignore_input_changes:
|
||||
return
|
||||
|
||||
self.is_invalid = self.input_field.has_invalid_value()
|
||||
self.update_style()
|
||||
print("_on_value_change", self.__class__.__name__, self.entity.path)
|
||||
if not self.is_invalid:
|
||||
self.entity.set_value(self.input_field.json_value())
|
||||
else:
|
||||
# Manually trigger value change to trigger style updates
|
||||
self.entity.on_value_change()
|
||||
|
||||
|
||||
class EnumeratorWidget(InputWidget):
|
||||
|
|
@ -446,6 +458,10 @@ class PathWidget(BaseWidget):
|
|||
def hierarchical_style_update(self):
|
||||
self.input_field.hierarchical_style_update()
|
||||
|
||||
@property
|
||||
def child_invalid(self):
|
||||
return self.input_field.is_invalid
|
||||
|
||||
def _on_entity_change(self):
|
||||
print("_on_entity_change", self.__class__.__name__, self.entity.path)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue