From 34d03b6d9ac692e4c44dadfe88e250836d65ae46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Holl=C3=B3?= Date: Mon, 10 Jun 2024 17:24:49 +0200 Subject: [PATCH 1/2] FIX: show expand indicator when item only have children that are not tasks calling update_expand_indicator() after the recursive call so child items can be considered as well. Fixes a bug where expand inidicator was not shown when an item only had children that are not tasks --- .../publish_tree_widget/publish_tree_widget.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/tk_multi_publish2/publish_tree_widget/publish_tree_widget.py b/python/tk_multi_publish2/publish_tree_widget/publish_tree_widget.py index 24cefe68..a25f1118 100644 --- a/python/tk_multi_publish2/publish_tree_widget/publish_tree_widget.py +++ b/python/tk_multi_publish2/publish_tree_widget/publish_tree_widget.py @@ -152,13 +152,13 @@ def _build_item_tree_r(self, item, checked, level, tree_parent): ui_task = TreeNodeTask(task, ui_item) self.__created_items.append(ui_task) + for child in item.children: + self._build_item_tree_r(child, checked, level + 1, ui_item) + # ensure the expand indicator is shown/hidden depending on child # visibility ui_item.update_expand_indicator() - for child in item.children: - self._build_item_tree_r(child, checked, level + 1, ui_item) - # lastly, handle the item level check state. # if the item has been marked as checked=False # uncheck it now (which will affect all children) From 1223d62cca40843bbb13d7c54f250302025be636 Mon Sep 17 00:00:00 2001 From: hollov Date: Mon, 25 Nov 2024 15:41:06 +0100 Subject: [PATCH 2/2] Cannot change checked status for disabled or hidden task items --- .../publish_tree_widget/tree_node_task.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/python/tk_multi_publish2/publish_tree_widget/tree_node_task.py b/python/tk_multi_publish2/publish_tree_widget/tree_node_task.py index 3e1681f8..b5bc56c1 100644 --- a/python/tk_multi_publish2/publish_tree_widget/tree_node_task.py +++ b/python/tk_multi_publish2/publish_tree_widget/tree_node_task.py @@ -64,6 +64,9 @@ def set_check_state(self, state, apply_to_all_plugins=False): """ Called by child item when checkbox was ticked """ + if not self._task.visible or not self._task.enabled: + return + # Ensure that we set the task to match the UI state self._task.active = state != QtCore.Qt.Unchecked @@ -74,6 +77,14 @@ def set_check_state(self, state, apply_to_all_plugins=False): # set just this one super(TreeNodeTask, self).set_check_state(state) + def _set_check_state_r(self, state): + if not self._task.visible or not self._task.enabled: + if self.parent(): + self.parent().recompute_check_state() + return + + super(TreeNodeTask, self)._set_check_state_r(state) + @property def task(self): """