mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
change view on too much instances
This commit is contained in:
parent
c800e35f3f
commit
e07b11b7fa
2 changed files with 16 additions and 0 deletions
|
|
@ -548,6 +548,10 @@ class InstanceCardView(AbstractInstanceView):
|
|||
result.setWidth(width)
|
||||
return result
|
||||
|
||||
def get_current_instance_count(self) -> int:
|
||||
"""How many instances are currently in the view."""
|
||||
return len(self._widgets_by_id)
|
||||
|
||||
def _toggle_instances(
|
||||
self,
|
||||
new_value: Optional[bool],
|
||||
|
|
|
|||
|
|
@ -513,7 +513,19 @@ class OverviewWidget(QtWidgets.QFrame):
|
|||
self._refresh_instances()
|
||||
|
||||
def _on_instances_added(self):
|
||||
view = self._get_current_view()
|
||||
is_card_view = False
|
||||
count = 0
|
||||
if isinstance(view, InstanceCardView):
|
||||
is_card_view = True
|
||||
count = view.get_current_instance_count()
|
||||
|
||||
self._refresh_instances()
|
||||
|
||||
if is_card_view and count < 10:
|
||||
new_count = view.get_current_instance_count()
|
||||
if new_count > count and new_count >= 10:
|
||||
self._change_view_type()
|
||||
|
||||
def _on_instances_removed(self):
|
||||
self._refresh_instances()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue