mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
Move product types filter logic to the model
This commit is contained in:
parent
d8fcc4c85c
commit
88959b2c54
1 changed files with 17 additions and 13 deletions
|
|
@ -71,6 +71,21 @@ class ProductTypesQtModel(QtGui.QStandardItemModel):
|
|||
self._refreshing = False
|
||||
self.refreshed.emit()
|
||||
|
||||
def reset_product_types_filter(self):
|
||||
|
||||
project_name = self._controller.get_selected_project_name()
|
||||
product_types_filter = (
|
||||
self._controller.get_product_types_filter(project_name)
|
||||
)
|
||||
if product_types_filter.is_include:
|
||||
self.change_state_for_all(False)
|
||||
else:
|
||||
self.change_state_for_all(True)
|
||||
self.change_states(
|
||||
product_types_filter.is_include,
|
||||
product_types_filter.product_types
|
||||
)
|
||||
|
||||
def setData(self, index, value, role=None):
|
||||
checkstate_changed = False
|
||||
if role is None:
|
||||
|
|
@ -169,20 +184,9 @@ class ProductTypesView(QtWidgets.QListView):
|
|||
|
||||
def _on_refresh_finished(self):
|
||||
|
||||
# Apply product types filter
|
||||
# Apply product types filter on first show
|
||||
if self._refresh_product_types_filter:
|
||||
project_name = self._controller.get_selected_project_name()
|
||||
product_types_filter = (
|
||||
self._controller.get_product_types_filter(project_name)
|
||||
)
|
||||
if product_types_filter.is_include:
|
||||
self._on_disable_all()
|
||||
else:
|
||||
self._on_enable_all()
|
||||
self._product_types_model.change_states(
|
||||
product_types_filter.is_include,
|
||||
product_types_filter.product_types
|
||||
)
|
||||
self._product_types_model.reset_product_types_filter()
|
||||
|
||||
self.filter_changed.emit()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue