mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +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
|
entity_path = self.entity.path
|
||||||
if entity_path == path:
|
if entity_path == path:
|
||||||
self.set_focus(scroll_to)
|
self.set_focus(scroll_to)
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def update_style(self):
|
def update_style(self):
|
||||||
has_unsaved_changes = self.entity.has_unsaved_changes
|
has_unsaved_changes = self.entity.has_unsaved_changes
|
||||||
|
|
@ -464,6 +466,9 @@ class GUIWidget(BaseWidget):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def make_sure_is_visible(self, *args, **kwargs):
|
def make_sure_is_visible(self, *args, **kwargs):
|
||||||
|
return False
|
||||||
|
|
||||||
|
def focused_in(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def set_path(self, *args, **kwargs):
|
def set_path(self, *args, **kwargs):
|
||||||
|
|
|
||||||
|
|
@ -215,22 +215,24 @@ class DictConditionalWidget(BaseWidget):
|
||||||
|
|
||||||
def make_sure_is_visible(self, path, scroll_to):
|
def make_sure_is_visible(self, path, scroll_to):
|
||||||
if not path:
|
if not path:
|
||||||
return
|
return False
|
||||||
|
|
||||||
entity_path = self.entity.path
|
entity_path = self.entity.path
|
||||||
if entity_path == path:
|
if entity_path == path:
|
||||||
self.set_focus(scroll_to)
|
self.set_focus(scroll_to)
|
||||||
return
|
return True
|
||||||
|
|
||||||
if not path.startswith(entity_path):
|
if not path.startswith(entity_path):
|
||||||
return
|
return False
|
||||||
|
|
||||||
if self.body_widget and not self.body_widget.is_expanded():
|
if self.body_widget and not self.body_widget.is_expanded():
|
||||||
self.body_widget.toggle_content(True)
|
self.body_widget.toggle_content(True)
|
||||||
QtWidgets.QApplication.processEvents()
|
QtWidgets.QApplication.processEvents()
|
||||||
|
|
||||||
for input_field in self.input_fields:
|
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):
|
def add_widget_to_layout(self, widget, label=None):
|
||||||
if not widget.entity:
|
if not widget.entity:
|
||||||
|
|
|
||||||
|
|
@ -318,7 +318,7 @@ class ModifiableDictItem(QtWidgets.QWidget):
|
||||||
)
|
)
|
||||||
|
|
||||||
def make_sure_is_visible(self, *args, **kwargs):
|
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):
|
def get_style_state(self):
|
||||||
if self.is_invalid:
|
if self.is_invalid:
|
||||||
|
|
@ -854,17 +854,19 @@ class DictMutableKeysWidget(BaseWidget):
|
||||||
entity_path = self.entity.path
|
entity_path = self.entity.path
|
||||||
if entity_path == path:
|
if entity_path == path:
|
||||||
self.set_focus(scroll_to)
|
self.set_focus(scroll_to)
|
||||||
return
|
return True
|
||||||
|
|
||||||
if not path.startswith(entity_path):
|
if not path.startswith(entity_path):
|
||||||
return
|
return False
|
||||||
|
|
||||||
if self.body_widget and not self.body_widget.is_expanded():
|
if self.body_widget and not self.body_widget.is_expanded():
|
||||||
self.body_widget.toggle_content(True)
|
self.body_widget.toggle_content(True)
|
||||||
QtWidgets.QApplication.processEvents()
|
QtWidgets.QApplication.processEvents()
|
||||||
|
|
||||||
for input_field in self.input_fields:
|
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):
|
def set_entity_value(self):
|
||||||
while self.input_fields:
|
while self.input_fields:
|
||||||
|
|
|
||||||
|
|
@ -159,22 +159,24 @@ class DictImmutableKeysWidget(BaseWidget):
|
||||||
|
|
||||||
def make_sure_is_visible(self, path, scroll_to):
|
def make_sure_is_visible(self, path, scroll_to):
|
||||||
if not path:
|
if not path:
|
||||||
return
|
return False
|
||||||
|
|
||||||
entity_path = self.entity.path
|
entity_path = self.entity.path
|
||||||
if entity_path == path:
|
if entity_path == path:
|
||||||
self.set_focus(scroll_to)
|
self.set_focus(scroll_to)
|
||||||
return
|
return True
|
||||||
|
|
||||||
if not path.startswith(entity_path):
|
if not path.startswith(entity_path):
|
||||||
return
|
return False
|
||||||
|
|
||||||
if self.body_widget and not self.body_widget.is_expanded():
|
if self.body_widget and not self.body_widget.is_expanded():
|
||||||
self.body_widget.toggle_content(True)
|
self.body_widget.toggle_content(True)
|
||||||
QtWidgets.QApplication.processEvents()
|
QtWidgets.QApplication.processEvents()
|
||||||
|
|
||||||
for input_field in self.input_fields:
|
for direct_child in self._direct_children_widgets:
|
||||||
input_field.make_sure_is_visible(path, scroll_to)
|
if direct_child.make_sure_is_visible(path, scroll_to):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def add_widget_to_layout(self, widget, label=None):
|
def add_widget_to_layout(self, widget, label=None):
|
||||||
if self.checkbox_child and widget.entity is self.checkbox_child:
|
if self.checkbox_child and widget.entity is self.checkbox_child:
|
||||||
|
|
@ -599,7 +601,7 @@ class PathWidget(BaseWidget):
|
||||||
self.input_field.set_entity_value()
|
self.input_field.set_entity_value()
|
||||||
|
|
||||||
def make_sure_is_visible(self, *args, **kwargs):
|
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):
|
def hierarchical_style_update(self):
|
||||||
self.update_style()
|
self.update_style()
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ class ListItem(QtWidgets.QWidget):
|
||||||
)
|
)
|
||||||
|
|
||||||
def make_sure_is_visible(self, *args, **kwargs):
|
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
|
@property
|
||||||
def is_invalid(self):
|
def is_invalid(self):
|
||||||
|
|
@ -269,22 +269,24 @@ class ListWidget(InputWidget):
|
||||||
|
|
||||||
def make_sure_is_visible(self, path, scroll_to):
|
def make_sure_is_visible(self, path, scroll_to):
|
||||||
if not path:
|
if not path:
|
||||||
return
|
return False
|
||||||
|
|
||||||
entity_path = self.entity.path
|
entity_path = self.entity.path
|
||||||
if entity_path == path:
|
if entity_path == path:
|
||||||
self.set_focus(scroll_to)
|
self.set_focus(scroll_to)
|
||||||
return
|
return True
|
||||||
|
|
||||||
if not path.startswith(entity_path):
|
if not path.startswith(entity_path):
|
||||||
return
|
return False
|
||||||
|
|
||||||
if self.body_widget and not self.body_widget.is_expanded():
|
if self.body_widget and not self.body_widget.is_expanded():
|
||||||
self.body_widget.toggle_content(True)
|
self.body_widget.toggle_content(True)
|
||||||
QtWidgets.QApplication.processEvents()
|
QtWidgets.QApplication.processEvents()
|
||||||
|
|
||||||
for input_field in self.input_fields:
|
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):
|
def _on_entity_change(self):
|
||||||
# TODO do less inefficient
|
# TODO do less inefficient
|
||||||
|
|
|
||||||
|
|
@ -67,16 +67,18 @@ class ListStrictWidget(BaseWidget):
|
||||||
|
|
||||||
def make_sure_is_visible(self, path, scroll_to):
|
def make_sure_is_visible(self, path, scroll_to):
|
||||||
if not path:
|
if not path:
|
||||||
return
|
return False
|
||||||
|
|
||||||
entity_path = self.entity.path
|
entity_path = self.entity.path
|
||||||
if entity_path == path:
|
if entity_path == path:
|
||||||
self.set_focus(scroll_to)
|
self.set_focus(scroll_to)
|
||||||
return
|
return True
|
||||||
|
|
||||||
if path.startswith(entity_path):
|
if path.startswith(entity_path):
|
||||||
for input_field in self.input_fields:
|
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):
|
def add_widget_to_layout(self, widget, label=None):
|
||||||
# Horizontally added children
|
# Horizontally added children
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue