mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 13:52:15 +01:00
make_sure_is_visible expect result
This commit is contained in:
parent
65cf4559d2
commit
4a7995e9ad
6 changed files with 37 additions and 22 deletions
|
|
@ -372,6 +372,8 @@ class InputWidget(BaseWidget):
|
|||
entity_path = self.entity.path
|
||||
if entity_path == path:
|
||||
self.set_focus(scroll_to)
|
||||
return True
|
||||
return False
|
||||
|
||||
def update_style(self):
|
||||
has_unsaved_changes = self.entity.has_unsaved_changes
|
||||
|
|
@ -464,6 +466,9 @@ class GUIWidget(BaseWidget):
|
|||
pass
|
||||
|
||||
def make_sure_is_visible(self, *args, **kwargs):
|
||||
return False
|
||||
|
||||
def focused_in(self):
|
||||
pass
|
||||
|
||||
def set_path(self, *args, **kwargs):
|
||||
|
|
|
|||
|
|
@ -215,22 +215,24 @@ class DictConditionalWidget(BaseWidget):
|
|||
|
||||
def make_sure_is_visible(self, path, scroll_to):
|
||||
if not path:
|
||||
return
|
||||
return False
|
||||
|
||||
entity_path = self.entity.path
|
||||
if entity_path == path:
|
||||
self.set_focus(scroll_to)
|
||||
return
|
||||
return True
|
||||
|
||||
if not path.startswith(entity_path):
|
||||
return
|
||||
return False
|
||||
|
||||
if self.body_widget and not self.body_widget.is_expanded():
|
||||
self.body_widget.toggle_content(True)
|
||||
QtWidgets.QApplication.processEvents()
|
||||
|
||||
for input_field in self.input_fields:
|
||||
input_field.make_sure_is_visible(path, scroll_to)
|
||||
if input_field.make_sure_is_visible(path, scroll_to):
|
||||
return True
|
||||
return False
|
||||
|
||||
def add_widget_to_layout(self, widget, label=None):
|
||||
if not widget.entity:
|
||||
|
|
|
|||
|
|
@ -318,7 +318,7 @@ class ModifiableDictItem(QtWidgets.QWidget):
|
|||
)
|
||||
|
||||
def make_sure_is_visible(self, *args, **kwargs):
|
||||
self.input_field.make_sure_is_visible(*args, **kwargs)
|
||||
return self.input_field.make_sure_is_visible(*args, **kwargs)
|
||||
|
||||
def get_style_state(self):
|
||||
if self.is_invalid:
|
||||
|
|
@ -854,17 +854,19 @@ class DictMutableKeysWidget(BaseWidget):
|
|||
entity_path = self.entity.path
|
||||
if entity_path == path:
|
||||
self.set_focus(scroll_to)
|
||||
return
|
||||
return True
|
||||
|
||||
if not path.startswith(entity_path):
|
||||
return
|
||||
return False
|
||||
|
||||
if self.body_widget and not self.body_widget.is_expanded():
|
||||
self.body_widget.toggle_content(True)
|
||||
QtWidgets.QApplication.processEvents()
|
||||
|
||||
for input_field in self.input_fields:
|
||||
input_field.make_sure_is_visible(path, scroll_to)
|
||||
if input_field.make_sure_is_visible(path, scroll_to):
|
||||
return True
|
||||
return False
|
||||
|
||||
def set_entity_value(self):
|
||||
while self.input_fields:
|
||||
|
|
|
|||
|
|
@ -159,22 +159,24 @@ class DictImmutableKeysWidget(BaseWidget):
|
|||
|
||||
def make_sure_is_visible(self, path, scroll_to):
|
||||
if not path:
|
||||
return
|
||||
return False
|
||||
|
||||
entity_path = self.entity.path
|
||||
if entity_path == path:
|
||||
self.set_focus(scroll_to)
|
||||
return
|
||||
return True
|
||||
|
||||
if not path.startswith(entity_path):
|
||||
return
|
||||
return False
|
||||
|
||||
if self.body_widget and not self.body_widget.is_expanded():
|
||||
self.body_widget.toggle_content(True)
|
||||
QtWidgets.QApplication.processEvents()
|
||||
|
||||
for input_field in self.input_fields:
|
||||
input_field.make_sure_is_visible(path, scroll_to)
|
||||
for direct_child in self._direct_children_widgets:
|
||||
if direct_child.make_sure_is_visible(path, scroll_to):
|
||||
return True
|
||||
return False
|
||||
|
||||
def add_widget_to_layout(self, widget, label=None):
|
||||
if self.checkbox_child and widget.entity is self.checkbox_child:
|
||||
|
|
@ -599,7 +601,7 @@ class PathWidget(BaseWidget):
|
|||
self.input_field.set_entity_value()
|
||||
|
||||
def make_sure_is_visible(self, *args, **kwargs):
|
||||
self.input_field.make_sure_is_visible(*args, **kwargs)
|
||||
return self.input_field.make_sure_is_visible(*args, **kwargs)
|
||||
|
||||
def hierarchical_style_update(self):
|
||||
self.update_style()
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ class ListItem(QtWidgets.QWidget):
|
|||
)
|
||||
|
||||
def make_sure_is_visible(self, *args, **kwargs):
|
||||
self.input_field.make_sure_is_visible(*args, **kwargs)
|
||||
return self.input_field.make_sure_is_visible(*args, **kwargs)
|
||||
|
||||
@property
|
||||
def is_invalid(self):
|
||||
|
|
@ -269,22 +269,24 @@ class ListWidget(InputWidget):
|
|||
|
||||
def make_sure_is_visible(self, path, scroll_to):
|
||||
if not path:
|
||||
return
|
||||
return False
|
||||
|
||||
entity_path = self.entity.path
|
||||
if entity_path == path:
|
||||
self.set_focus(scroll_to)
|
||||
return
|
||||
return True
|
||||
|
||||
if not path.startswith(entity_path):
|
||||
return
|
||||
return False
|
||||
|
||||
if self.body_widget and not self.body_widget.is_expanded():
|
||||
self.body_widget.toggle_content(True)
|
||||
QtWidgets.QApplication.processEvents()
|
||||
|
||||
for input_field in self.input_fields:
|
||||
input_field.make_sure_is_visible(path, scroll_to)
|
||||
if input_field.make_sure_is_visible(path, scroll_to):
|
||||
return True
|
||||
return False
|
||||
|
||||
def _on_entity_change(self):
|
||||
# TODO do less inefficient
|
||||
|
|
|
|||
|
|
@ -67,16 +67,18 @@ class ListStrictWidget(BaseWidget):
|
|||
|
||||
def make_sure_is_visible(self, path, scroll_to):
|
||||
if not path:
|
||||
return
|
||||
return False
|
||||
|
||||
entity_path = self.entity.path
|
||||
if entity_path == path:
|
||||
self.set_focus(scroll_to)
|
||||
return
|
||||
return True
|
||||
|
||||
if path.startswith(entity_path):
|
||||
for input_field in self.input_fields:
|
||||
input_field.make_sure_is_visible(path, scroll_to)
|
||||
if input_field.make_sure_is_visible(path, scroll_to):
|
||||
return True
|
||||
return False
|
||||
|
||||
def add_widget_to_layout(self, widget, label=None):
|
||||
# Horizontally added children
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue