From e59292bb9e1a1a23348e17b067054d327c1e06fb Mon Sep 17 00:00:00 2001 From: Braden Jennings Date: Wed, 6 Mar 2024 09:45:41 +1300 Subject: [PATCH 01/12] enhancement/AY-2614_display_overriden_vs_default_attributes_in_publisher --- .../tools/publisher/widgets/widgets.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/client/ayon_core/tools/publisher/widgets/widgets.py b/client/ayon_core/tools/publisher/widgets/widgets.py index 4005cf2c84..1788df2bfd 100644 --- a/client/ayon_core/tools/publisher/widgets/widgets.py +++ b/client/ayon_core/tools/publisher/widgets/widgets.py @@ -1356,6 +1356,7 @@ def __init__(self, controller, parent): self._attr_def_id_to_instances = {} self._attr_def_id_to_attr_def = {} + self._attr_def_id_to_label = {} # To store content of scroll area to prevent garbage collection self._content_widget = None @@ -1381,6 +1382,7 @@ def set_current_instances(self, instances): self._content_widget = None self._attr_def_id_to_instances = {} self._attr_def_id_to_attr_def = {} + self._attr_def_id_to_label = {} result = self._controller.get_creator_attribute_definitions( instances @@ -1409,6 +1411,8 @@ def set_current_instances(self, instances): self._attr_def_id_to_instances[attr_def.id] = attr_instances self._attr_def_id_to_attr_def[attr_def.id] = attr_def + widget.value_changed + if attr_def.hidden: continue @@ -1423,6 +1427,7 @@ def set_current_instances(self, instances): label = attr_def.label or attr_def.key if label: label_widget = QtWidgets.QLabel(label, self) + self._attr_def_id_to_label[attr_def.id] = label_widget tooltip = attr_def.tooltip if tooltip: label_widget.setToolTip(tooltip) @@ -1448,9 +1453,27 @@ def set_current_instances(self, instances): def _input_value_changed(self, value, attr_id): instances = self._attr_def_id_to_instances.get(attr_id) attr_def = self._attr_def_id_to_attr_def.get(attr_id) + # print("attr_def", attr_def, attr_def.convert_value(), attr_def.deserialize() if not instances or not attr_def: return + # Update the styling of the associated label if is default or override + label_widget = self._attr_def_id_to_label.get(attr_id) + if label_widget: + # NOTE: The default returned by attr_def.default is returning a + # float, when it should be a int. So lets cast the widget value + # (argument to this method) to a float to match the type. + _value = value + if isinstance(_value, int): + _value = float(_value) + is_default = _value == attr_def.default + font = label_widget.font() + if is_default: + label_widget.setStyleSheet("") + else: + label_widget.setStyleSheet("font: bold") + label_widget.setFont(font) + for instance in instances: creator_attributes = instance["creator_attributes"] if attr_def.key in creator_attributes: From d744eec6c04236d7e9cdd34db6c7be7a832547e8 Mon Sep 17 00:00:00 2001 From: Braden Jennings Date: Wed, 6 Mar 2024 09:49:59 +1300 Subject: [PATCH 02/12] enhancement/AY-2614_display_overriden_vs_default_attributes_in_publisher --- .../tools/publisher/widgets/widgets.py | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/client/ayon_core/tools/publisher/widgets/widgets.py b/client/ayon_core/tools/publisher/widgets/widgets.py index 1788df2bfd..6239941daa 100644 --- a/client/ayon_core/tools/publisher/widgets/widgets.py +++ b/client/ayon_core/tools/publisher/widgets/widgets.py @@ -1411,8 +1411,6 @@ def set_current_instances(self, instances): self._attr_def_id_to_instances[attr_def.id] = attr_instances self._attr_def_id_to_attr_def[attr_def.id] = attr_def - widget.value_changed - if attr_def.hidden: continue @@ -1518,6 +1516,7 @@ def __init__(self, controller, parent): self._attr_def_id_to_instances = {} self._attr_def_id_to_attr_def = {} self._attr_def_id_to_plugin_name = {} + self._attr_def_id_to_label = {} # Store content of scroll area to prevent garbage collection self._content_widget = None @@ -1544,6 +1543,7 @@ def set_current_instances(self, instances, context_selected): self._attr_def_id_to_instances = {} self._attr_def_id_to_attr_def = {} self._attr_def_id_to_plugin_name = {} + self._attr_def_id_to_label = {} result = self._controller.get_publish_attribute_definitions( instances, context_selected @@ -1588,6 +1588,7 @@ def set_current_instances(self, instances, context_selected): label = attr_def.label or attr_def.key if label: label_widget = QtWidgets.QLabel(label, content_widget) + self._attr_def_id_to_label[attr_def.id] = label_widget tooltip = attr_def.tooltip if tooltip: label_widget.setToolTip(tooltip) @@ -1638,6 +1639,23 @@ def _input_value_changed(self, value, attr_id): if not instances or not attr_def or not plugin_name: return + # Update the styling of the associated label if is default or override + label_widget = self._attr_def_id_to_label.get(attr_id) + if label_widget: + # NOTE: The default returned by attr_def.default is returning a + # float, when it should be a int. So lets cast the widget value + # (argument to this method) to a float to match the type. + _value = value + if isinstance(_value, int): + _value = float(_value) + is_default = _value == attr_def.default + font = label_widget.font() + if is_default: + label_widget.setStyleSheet("") + else: + label_widget.setStyleSheet("font: bold") + label_widget.setFont(font) + for instance in instances: plugin_val = instance.publish_attributes[plugin_name] plugin_val[attr_def.key] = value From d48f97c15d08a759d4f5dcd27380cabfa8a8b31d Mon Sep 17 00:00:00 2001 From: Braden Jennings Date: Wed, 6 Mar 2024 09:50:24 +1300 Subject: [PATCH 03/12] enhancement/AY-2614_display_overriden_vs_default_attributes_in_publisher --- client/ayon_core/tools/publisher/widgets/widgets.py | 1 - 1 file changed, 1 deletion(-) diff --git a/client/ayon_core/tools/publisher/widgets/widgets.py b/client/ayon_core/tools/publisher/widgets/widgets.py index 6239941daa..50c9e18a16 100644 --- a/client/ayon_core/tools/publisher/widgets/widgets.py +++ b/client/ayon_core/tools/publisher/widgets/widgets.py @@ -1451,7 +1451,6 @@ def set_current_instances(self, instances): def _input_value_changed(self, value, attr_id): instances = self._attr_def_id_to_instances.get(attr_id) attr_def = self._attr_def_id_to_attr_def.get(attr_id) - # print("attr_def", attr_def, attr_def.convert_value(), attr_def.deserialize() if not instances or not attr_def: return From b4f37f0cf792764ef7ae52806ed60985b95dc271 Mon Sep 17 00:00:00 2001 From: Braden Jennings Date: Wed, 6 Mar 2024 09:51:52 +1300 Subject: [PATCH 04/12] enhancement/AY-2614_display_overriden_vs_default_attributes_in_publisher --- client/ayon_core/tools/publisher/widgets/widgets.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/client/ayon_core/tools/publisher/widgets/widgets.py b/client/ayon_core/tools/publisher/widgets/widgets.py index 50c9e18a16..125558943b 100644 --- a/client/ayon_core/tools/publisher/widgets/widgets.py +++ b/client/ayon_core/tools/publisher/widgets/widgets.py @@ -1464,12 +1464,10 @@ def _input_value_changed(self, value, attr_id): if isinstance(_value, int): _value = float(_value) is_default = _value == attr_def.default - font = label_widget.font() if is_default: label_widget.setStyleSheet("") else: label_widget.setStyleSheet("font: bold") - label_widget.setFont(font) for instance in instances: creator_attributes = instance["creator_attributes"] @@ -1648,12 +1646,10 @@ def _input_value_changed(self, value, attr_id): if isinstance(_value, int): _value = float(_value) is_default = _value == attr_def.default - font = label_widget.font() if is_default: label_widget.setStyleSheet("") else: label_widget.setStyleSheet("font: bold") - label_widget.setFont(font) for instance in instances: plugin_val = instance.publish_attributes[plugin_name] From cf8792b000f935d1ae04ad68bb8eb40ec1f0adb9 Mon Sep 17 00:00:00 2001 From: Braden Jennings Date: Wed, 6 Mar 2024 11:05:52 +1300 Subject: [PATCH 05/12] enhancement/AY-2614_display_overriden_vs_default_attributes_in_publisher --- client/ayon_core/style/style.css | 2 ++ .../tools/publisher/widgets/widgets.py | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/client/ayon_core/style/style.css b/client/ayon_core/style/style.css index fcc76b0bff..c2e669054e 100644 --- a/client/ayon_core/style/style.css +++ b/client/ayon_core/style/style.css @@ -899,6 +899,8 @@ PublisherTabsWidget { background: {color:publisher:tab-bg}; } +*[nondefault=true] { font: bold } + PublisherTabBtn { border-radius: 0px; background: {color:bg-inputs}; diff --git a/client/ayon_core/tools/publisher/widgets/widgets.py b/client/ayon_core/tools/publisher/widgets/widgets.py index 125558943b..a2c9883f94 100644 --- a/client/ayon_core/tools/publisher/widgets/widgets.py +++ b/client/ayon_core/tools/publisher/widgets/widgets.py @@ -1464,10 +1464,11 @@ def _input_value_changed(self, value, attr_id): if isinstance(_value, int): _value = float(_value) is_default = _value == attr_def.default - if is_default: - label_widget.setStyleSheet("") - else: - label_widget.setStyleSheet("font: bold") + label_widget.setProperty("nondefault", not is_default) + # if is_default: + # label_widget.setStyleSheet("") + # else: + # label_widget.setStyleSheet("font: bold") for instance in instances: creator_attributes = instance["creator_attributes"] @@ -1646,10 +1647,11 @@ def _input_value_changed(self, value, attr_id): if isinstance(_value, int): _value = float(_value) is_default = _value == attr_def.default - if is_default: - label_widget.setStyleSheet("") - else: - label_widget.setStyleSheet("font: bold") + label_widget.setProperty("nondefault", not is_default) + # if is_default: + # label_widget.setStyleSheet("") + # else: + # label_widget.setStyleSheet("font: bold") for instance in instances: plugin_val = instance.publish_attributes[plugin_name] From 7d1ffe737f1f4cb57fbee4affbf036baa6002556 Mon Sep 17 00:00:00 2001 From: Braden Jennings Date: Wed, 6 Mar 2024 12:16:18 +1300 Subject: [PATCH 06/12] enhancement/AY-2614_display_overriden_vs_default_attributes_in_publisher --- client/ayon_core/style/style.css | 2 -- .../tools/publisher/widgets/widgets.py | 18 ++++++++---------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/client/ayon_core/style/style.css b/client/ayon_core/style/style.css index c2e669054e..fcc76b0bff 100644 --- a/client/ayon_core/style/style.css +++ b/client/ayon_core/style/style.css @@ -899,8 +899,6 @@ PublisherTabsWidget { background: {color:publisher:tab-bg}; } -*[nondefault=true] { font: bold } - PublisherTabBtn { border-radius: 0px; background: {color:bg-inputs}; diff --git a/client/ayon_core/tools/publisher/widgets/widgets.py b/client/ayon_core/tools/publisher/widgets/widgets.py index a2c9883f94..125558943b 100644 --- a/client/ayon_core/tools/publisher/widgets/widgets.py +++ b/client/ayon_core/tools/publisher/widgets/widgets.py @@ -1464,11 +1464,10 @@ def _input_value_changed(self, value, attr_id): if isinstance(_value, int): _value = float(_value) is_default = _value == attr_def.default - label_widget.setProperty("nondefault", not is_default) - # if is_default: - # label_widget.setStyleSheet("") - # else: - # label_widget.setStyleSheet("font: bold") + if is_default: + label_widget.setStyleSheet("") + else: + label_widget.setStyleSheet("font: bold") for instance in instances: creator_attributes = instance["creator_attributes"] @@ -1647,11 +1646,10 @@ def _input_value_changed(self, value, attr_id): if isinstance(_value, int): _value = float(_value) is_default = _value == attr_def.default - label_widget.setProperty("nondefault", not is_default) - # if is_default: - # label_widget.setStyleSheet("") - # else: - # label_widget.setStyleSheet("font: bold") + if is_default: + label_widget.setStyleSheet("") + else: + label_widget.setStyleSheet("font: bold") for instance in instances: plugin_val = instance.publish_attributes[plugin_name] From a7fa42e44a64875451045fde4ccde2fdc8c95574 Mon Sep 17 00:00:00 2001 From: Braden Jennings Date: Mon, 11 Mar 2024 09:39:54 +1300 Subject: [PATCH 07/12] apply stylesheet on multi select and when loading widget --- .../tools/publisher/widgets/widgets.py | 44 ++++++++++++------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/client/ayon_core/tools/publisher/widgets/widgets.py b/client/ayon_core/tools/publisher/widgets/widgets.py index 125558943b..09cfa525e9 100644 --- a/client/ayon_core/tools/publisher/widgets/widgets.py +++ b/client/ayon_core/tools/publisher/widgets/widgets.py @@ -1399,14 +1399,20 @@ def set_current_instances(self, instances): row = 0 for attr_def, attr_instances, values in result: widget = create_widget_for_attr_def(attr_def, content_widget) + is_default = True if attr_def.is_value_def: if len(values) == 1: value = values[0] if value is not None: widget.set_value(values[0]) + is_default = value == attr_def.default else: widget.set_value(values, True) - + is_default = True + for value in values: + is_default = value == attr_def.default + if not is_default: + break widget.value_changed.connect(self._input_value_changed) self._attr_def_id_to_instances[attr_def.id] = attr_instances self._attr_def_id_to_attr_def[attr_def.id] = attr_def @@ -1434,6 +1440,10 @@ def set_current_instances(self, instances): QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter ) + if is_default: + label_widget.setStyleSheet("") + else: + label_widget.setStyleSheet("font: bold; color: #4287f5") content_layout.addWidget( label_widget, row, 0, 1, expand_cols ) @@ -1457,17 +1467,11 @@ def _input_value_changed(self, value, attr_id): # Update the styling of the associated label if is default or override label_widget = self._attr_def_id_to_label.get(attr_id) if label_widget: - # NOTE: The default returned by attr_def.default is returning a - # float, when it should be a int. So lets cast the widget value - # (argument to this method) to a float to match the type. - _value = value - if isinstance(_value, int): - _value = float(_value) - is_default = _value == attr_def.default + is_default = value == attr_def.default if is_default: label_widget.setStyleSheet("") else: - label_widget.setStyleSheet("font: bold") + label_widget.setStyleSheet("font: bold; color: #4287f5") for instance in instances: creator_attributes = instance["creator_attributes"] @@ -1594,6 +1598,8 @@ def set_current_instances(self, instances, context_selected): QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter ) + label_widget + attr_def_layout.addWidget( label_widget, row, 0, 1, expand_cols ) @@ -1623,8 +1629,18 @@ def set_current_instances(self, instances, context_selected): if multivalue: widget.set_value(values, multivalue) + is_default = True + for value in values: + is_default = value == attr_def.default + if not is_default: + break else: widget.set_value(values[0]) + is_default = values[0] == attr_def.default + if is_default: + label_widget.setStyleSheet("") + else: + label_widget.setStyleSheet("font: bold; color: #4287f5") self._scroll_area.setWidget(content_widget) self._content_widget = content_widget @@ -1639,17 +1655,11 @@ def _input_value_changed(self, value, attr_id): # Update the styling of the associated label if is default or override label_widget = self._attr_def_id_to_label.get(attr_id) if label_widget: - # NOTE: The default returned by attr_def.default is returning a - # float, when it should be a int. So lets cast the widget value - # (argument to this method) to a float to match the type. - _value = value - if isinstance(_value, int): - _value = float(_value) - is_default = _value == attr_def.default + is_default = value == attr_def.default if is_default: label_widget.setStyleSheet("") else: - label_widget.setStyleSheet("font: bold") + label_widget.setStyleSheet("color: #4287f5") for instance in instances: plugin_val = instance.publish_attributes[plugin_name] From de9eadfc1be7875f17b3d7535469e6b01070634b Mon Sep 17 00:00:00 2001 From: Braden Jennings Date: Mon, 11 Mar 2024 09:46:27 +1300 Subject: [PATCH 08/12] apply stylesheet on multi select and when loading widget --- client/ayon_core/tools/publisher/widgets/widgets.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/ayon_core/tools/publisher/widgets/widgets.py b/client/ayon_core/tools/publisher/widgets/widgets.py index 09cfa525e9..65784f24b4 100644 --- a/client/ayon_core/tools/publisher/widgets/widgets.py +++ b/client/ayon_core/tools/publisher/widgets/widgets.py @@ -1443,7 +1443,7 @@ def set_current_instances(self, instances): if is_default: label_widget.setStyleSheet("") else: - label_widget.setStyleSheet("font: bold; color: #4287f5") + label_widget.setStyleSheet("color: #4287f5") content_layout.addWidget( label_widget, row, 0, 1, expand_cols ) @@ -1471,7 +1471,7 @@ def _input_value_changed(self, value, attr_id): if is_default: label_widget.setStyleSheet("") else: - label_widget.setStyleSheet("font: bold; color: #4287f5") + label_widget.setStyleSheet("color: #4287f5") for instance in instances: creator_attributes = instance["creator_attributes"] @@ -1640,7 +1640,7 @@ def set_current_instances(self, instances, context_selected): if is_default: label_widget.setStyleSheet("") else: - label_widget.setStyleSheet("font: bold; color: #4287f5") + label_widget.setStyleSheet("color: #4287f5") self._scroll_area.setWidget(content_widget) self._content_widget = content_widget From f213dca87c41c49f8bbc92a1cc6d35344c6e9282 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Fri, 17 May 2024 14:17:56 +0200 Subject: [PATCH 09/12] change style only on existing label widgets --- client/ayon_core/tools/publisher/widgets/widgets.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/ayon_core/tools/publisher/widgets/widgets.py b/client/ayon_core/tools/publisher/widgets/widgets.py index bd1d200d08..738aefc5b9 100644 --- a/client/ayon_core/tools/publisher/widgets/widgets.py +++ b/client/ayon_core/tools/publisher/widgets/widgets.py @@ -1578,6 +1578,7 @@ def set_current_instances(self, instances, context_selected): widget.setVisible(False) hidden_widget = True + label_widget = None if not hidden_widget: expand_cols = 2 if attr_def.is_value_def and attr_def.is_label_horizontal: @@ -1598,7 +1599,6 @@ def set_current_instances(self, instances, context_selected): QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter ) - label_widget attr_def_layout.addWidget( label_widget, row, 0, 1, expand_cols @@ -1627,6 +1627,9 @@ def set_current_instances(self, instances, context_selected): self._attr_def_id_to_instances[attr_def.id] = instances self._attr_def_id_to_plugin_name[attr_def.id] = plugin_name + if label_widget is None: + continue + if multivalue: widget.set_value(values, multivalue) is_default = True From f6532cb9afeed865d958d8fe2bf5cbc92b9d009f Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Fri, 17 May 2024 14:18:28 +0200 Subject: [PATCH 10/12] use property to change style --- client/ayon_core/style/data.json | 3 +- client/ayon_core/style/style.css | 6 ++- .../tools/publisher/widgets/widgets.py | 51 +++++++++---------- 3 files changed, 31 insertions(+), 29 deletions(-) diff --git a/client/ayon_core/style/data.json b/client/ayon_core/style/data.json index 7389387d97..4edb154fbd 100644 --- a/client/ayon_core/style/data.json +++ b/client/ayon_core/style/data.json @@ -105,7 +105,8 @@ "bg-expander": "#2C313A", "bg-expander-hover": "#2d6c9f", "bg-expander-selected-hover": "#3784c5" - } + }, + "overridden-label": "#FF8C1A" }, "settings": { "invalid-light": "#C93636", diff --git a/client/ayon_core/style/style.css b/client/ayon_core/style/style.css index 607fd1fa31..5023d1f873 100644 --- a/client/ayon_core/style/style.css +++ b/client/ayon_core/style/style.css @@ -895,6 +895,10 @@ OverlayMessageWidget QWidget { #PublishWindow QComboBox { padding: 1px 1px 1px 0.2em; } +#PublishWindow QLabel[overridden="1"] { + color: {color:publisher:overridden-label}; +} + PublisherTabsWidget { background: {color:publisher:tab-bg}; } @@ -922,7 +926,7 @@ PublisherTabBtn[active="1"]:hover { background: {color:bg}; } -PixmapButton{ +PixmapButton { border: 0px solid transparent; border-radius: 0.2em; background: {color:bg-buttons}; diff --git a/client/ayon_core/tools/publisher/widgets/widgets.py b/client/ayon_core/tools/publisher/widgets/widgets.py index 738aefc5b9..8899e26ef9 100644 --- a/client/ayon_core/tools/publisher/widgets/widgets.py +++ b/client/ayon_core/tools/publisher/widgets/widgets.py @@ -76,6 +76,14 @@ def parse_icon_def( continue +def set_label_overriden_style(label_widget, is_overriden): + set_style_property( + label_widget, + "overridden", + str(int(is_overriden)) + ) + + class PublishPixmapLabel(PixmapLabel): def _get_pix_size(self): size = self.fontMetrics().height() @@ -1399,19 +1407,19 @@ def set_current_instances(self, instances): row = 0 for attr_def, attr_instances, values in result: widget = create_widget_for_attr_def(attr_def, content_widget) - is_default = True + is_value_overridden = False if attr_def.is_value_def: if len(values) == 1: value = values[0] if value is not None: widget.set_value(values[0]) - is_default = value == attr_def.default + is_value_overridden = value != attr_def.default else: widget.set_value(values, True) - is_default = True + is_value_overridden = False for value in values: - is_default = value == attr_def.default - if not is_default: + is_value_overridden = value != attr_def.default + if is_value_overridden: break widget.value_changed.connect(self._input_value_changed) self._attr_def_id_to_instances[attr_def.id] = attr_instances @@ -1440,10 +1448,8 @@ def set_current_instances(self, instances): QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter ) - if is_default: - label_widget.setStyleSheet("") - else: - label_widget.setStyleSheet("color: #4287f5") + + set_label_overriden_style(label_widget, is_value_overridden) content_layout.addWidget( label_widget, row, 0, 1, expand_cols ) @@ -1467,11 +1473,8 @@ def _input_value_changed(self, value, attr_id): # Update the styling of the associated label if is default or override label_widget = self._attr_def_id_to_label.get(attr_id) if label_widget: - is_default = value == attr_def.default - if is_default: - label_widget.setStyleSheet("") - else: - label_widget.setStyleSheet("color: #4287f5") + # Change style for overridden value + set_label_overriden_style(label_widget, value != attr_def.default) for instance in instances: creator_attributes = instance["creator_attributes"] @@ -1632,18 +1635,16 @@ def set_current_instances(self, instances, context_selected): if multivalue: widget.set_value(values, multivalue) - is_default = True + is_value_overridden = False for value in values: - is_default = value == attr_def.default - if not is_default: + is_value_overridden = value != attr_def.default + if not is_value_overridden: break else: widget.set_value(values[0]) - is_default = values[0] == attr_def.default - if is_default: - label_widget.setStyleSheet("") - else: - label_widget.setStyleSheet("color: #4287f5") + is_value_overridden = values[0] != attr_def.default + + set_label_overriden_style(label_widget, is_value_overridden) self._scroll_area.setWidget(content_widget) self._content_widget = content_widget @@ -1658,11 +1659,7 @@ def _input_value_changed(self, value, attr_id): # Update the styling of the associated label if is default or override label_widget = self._attr_def_id_to_label.get(attr_id) if label_widget: - is_default = value == attr_def.default - if is_default: - label_widget.setStyleSheet("") - else: - label_widget.setStyleSheet("color: #4287f5") + set_label_overriden_style(label_widget, value != attr_def.default) for instance in instances: plugin_val = instance.publish_attributes[plugin_name] From ee8abf5f533b80537f8ea941b26f75ad906fad1f Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Fri, 17 May 2024 14:25:21 +0200 Subject: [PATCH 11/12] fix set value of multiselection --- client/ayon_core/tools/publisher/widgets/widgets.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/client/ayon_core/tools/publisher/widgets/widgets.py b/client/ayon_core/tools/publisher/widgets/widgets.py index 8899e26ef9..5d8a5d7271 100644 --- a/client/ayon_core/tools/publisher/widgets/widgets.py +++ b/client/ayon_core/tools/publisher/widgets/widgets.py @@ -1416,7 +1416,6 @@ def set_current_instances(self, instances): is_value_overridden = value != attr_def.default else: widget.set_value(values, True) - is_value_overridden = False for value in values: is_value_overridden = value != attr_def.default if is_value_overridden: @@ -1630,9 +1629,6 @@ def set_current_instances(self, instances, context_selected): self._attr_def_id_to_instances[attr_def.id] = instances self._attr_def_id_to_plugin_name[attr_def.id] = plugin_name - if label_widget is None: - continue - if multivalue: widget.set_value(values, multivalue) is_value_overridden = False @@ -1644,7 +1640,10 @@ def set_current_instances(self, instances, context_selected): widget.set_value(values[0]) is_value_overridden = values[0] != attr_def.default - set_label_overriden_style(label_widget, is_value_overridden) + if label_widget is not None: + set_label_overriden_style( + label_widget, is_value_overridden + ) self._scroll_area.setWidget(content_widget) self._content_widget = content_widget From 953b605144387b6a8bd4b4ea8a1c6d231c7595a8 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Fri, 17 May 2024 14:31:06 +0200 Subject: [PATCH 12/12] separate overriden logic from set value logic --- .../tools/publisher/widgets/widgets.py | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/client/ayon_core/tools/publisher/widgets/widgets.py b/client/ayon_core/tools/publisher/widgets/widgets.py index 5d8a5d7271..767319d6b3 100644 --- a/client/ayon_core/tools/publisher/widgets/widgets.py +++ b/client/ayon_core/tools/publisher/widgets/widgets.py @@ -1407,19 +1407,13 @@ def set_current_instances(self, instances): row = 0 for attr_def, attr_instances, values in result: widget = create_widget_for_attr_def(attr_def, content_widget) - is_value_overridden = False if attr_def.is_value_def: if len(values) == 1: value = values[0] if value is not None: widget.set_value(values[0]) - is_value_overridden = value != attr_def.default else: widget.set_value(values, True) - for value in values: - is_value_overridden = value != attr_def.default - if is_value_overridden: - break widget.value_changed.connect(self._input_value_changed) self._attr_def_id_to_instances[attr_def.id] = attr_instances self._attr_def_id_to_attr_def[attr_def.id] = attr_def @@ -1448,6 +1442,11 @@ def set_current_instances(self, instances): | QtCore.Qt.AlignVCenter ) + is_value_overridden = False + for value in values: + if value != attr_def.default: + is_value_overridden = True + break set_label_overriden_style(label_widget, is_value_overridden) content_layout.addWidget( label_widget, row, 0, 1, expand_cols @@ -1631,16 +1630,16 @@ def set_current_instances(self, instances, context_selected): if multivalue: widget.set_value(values, multivalue) - is_value_overridden = False - for value in values: - is_value_overridden = value != attr_def.default - if not is_value_overridden: - break else: widget.set_value(values[0]) - is_value_overridden = values[0] != attr_def.default if label_widget is not None: + is_value_overridden = False + for value in values: + if value != attr_def.default: + is_value_overridden = True + break + set_label_overriden_style( label_widget, is_value_overridden )