From 12a765dbd353d2696a39e941c1120ad3fc20b180 Mon Sep 17 00:00:00 2001 From: Joe Hultgren Date: Thu, 26 Mar 2020 18:57:07 -0700 Subject: [PATCH 1/2] allow context change widget on any item extra property to override context widget display --- python/tk_multi_publish2/api/item.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/python/tk_multi_publish2/api/item.py b/python/tk_multi_publish2/api/item.py index f3c55acc..423714c8 100644 --- a/python/tk_multi_publish2/api/item.py +++ b/python/tk_multi_publish2/api/item.py @@ -72,6 +72,7 @@ class PublishItem(object): __slots__ = [ "_active", "_allows_context_change", + "_allows_context_widget", "_children", "_context", "_created_temp_files", @@ -179,6 +180,7 @@ def __init__(self, name, type_spec, type_display, parent=None): self._active = True self._allows_context_change = True + self._allows_context_widget = False self._children = [] self._context = None self._created_temp_files = [] @@ -631,6 +633,22 @@ def context_change_allowed(self, allow): """ self._allows_context_change = allow + @property + def context_widget(self): + """ + Enable/disable context change for this item. + + Default is ``True`` + """ + return self._allows_context_widget + + @context_widget.setter + def context_widget(self, allow): + """ + Enable/disable context change for this item. + """ + self._allows_context_widget = allow + @property def description(self): """ From 98f18c59d78b7aeb1941715c28c3090167f9ac5f Mon Sep 17 00:00:00 2001 From: Joe Hultgren Date: Thu, 26 Mar 2020 19:00:17 -0700 Subject: [PATCH 2/2] check for the context widget flag override for default behavior for more complicated item grouping. --- python/tk_multi_publish2/dialog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tk_multi_publish2/dialog.py b/python/tk_multi_publish2/dialog.py index 57dce311..4255f181 100644 --- a/python/tk_multi_publish2/dialog.py +++ b/python/tk_multi_publish2/dialog.py @@ -617,7 +617,7 @@ def _create_item_details(self, tree_item): # Items with default thumbnails should still be able to have override thumbnails set by the user self.ui.item_thumbnail.setEnabled(True) - if item.parent.is_root: + if item.parent.is_root or item.context_widget: self.ui.context_widget.show() if item.context_change_allowed: