From 08edd34a1ef432d47f254e3903c9221f72951d86 Mon Sep 17 00:00:00 2001 From: Eric Mehl Date: Mon, 18 Mar 2024 15:58:38 -0400 Subject: [PATCH 1/4] StyleSheet : Reserve space for `valueChanged` icon --- Changes.md | 1 + python/GafferUI/_StyleSheet.py | 9 +++------ resources/graphics.svg | 20 ++++++++++---------- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Changes.md b/Changes.md index 73689a7a245..571c030ed14 100644 --- a/Changes.md +++ b/Changes.md @@ -30,6 +30,7 @@ Fixes - Display : Fixed shutdown crashes caused by Python slots connected to `driverCreatedSignal()` and `imageReceivedSignal()` [^1]. - LightPositionTool : Fixed crash when changing the tool mode with nothing selected [^1]. - ViewportGadget : Fixed selection issues with Intel GPUs (#901, #2788). +- TransformTool : Fixed alignment of green "value changed" icon for `orientation` plugs. API --- diff --git a/python/GafferUI/_StyleSheet.py b/python/GafferUI/_StyleSheet.py index 23bf1e5ea63..98ae65344a2 100644 --- a/python/GafferUI/_StyleSheet.py +++ b/python/GafferUI/_StyleSheet.py @@ -241,19 +241,16 @@ def styleColor( key ) : QLabel#gafferPlugLabel { /* - QLabel's text layout seems to lurch from one approach - to another in the presence of non-zero padding. So we - need some padding here so that we get a layout that - matches the `gafferValueChanged="true"` styling below. + Ensure that there is enough space reserved for the `valueChanged` + icon whether it is visible or not. */ - padding-left: 1px; + padding-left: 10px; } QLabel#gafferPlugLabel[gafferValueChanged="true"] { background-image: url(:/valueChanged.png); background-repeat: no-repeat; background-position: left; - padding-left: 16px; } QLabel#gafferDefaultRowLabel { diff --git a/resources/graphics.svg b/resources/graphics.svg index 26a72465dd5..d28532bb367 100644 --- a/resources/graphics.svg +++ b/resources/graphics.svg @@ -3309,6 +3309,14 @@ style="display:inline;opacity:0.1;fill:none;fill-opacity:1;stroke:none;stroke-width:0.597614;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.10173;stroke-opacity:1;paint-order:markers stroke fill" inkscape:label="activeRenderPassFadedHighlightedIcon" /> + - Date: Mon, 25 Mar 2024 18:09:36 -0400 Subject: [PATCH 2/4] LabelPlugValueWidget : `showValueChangedIndicator` --- Changes.md | 1 + python/GafferUI/LabelPlugValueWidget.py | 13 +++++++++++++ python/GafferUI/_StyleSheet.py | 4 ++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Changes.md b/Changes.md index 571c030ed14..562e8a33885 100644 --- a/Changes.md +++ b/Changes.md @@ -40,6 +40,7 @@ API - ProcessorWidget provides a base class for custom widgets, and a factory mechanism for registering them against processors. - SimpleProcessorWidget provides a base class for widgets with a simple summary label and optional action links. - TractorDispatcher : The `preSpoolSignal()` now provides an additional `taskData` argument to slots, which maps from Tractor tasks to information about the Gaffer tasks they will execute. +- LabelPlugValueWidget : Added optional `showValueChangedIndicator` metadata entry. If a plug has this entry set to `False`, the icon next to the label that indicates the value has changed will not be shown. Defaults to `True` if the value is not set. Breaking Changes ---------------- diff --git a/python/GafferUI/LabelPlugValueWidget.py b/python/GafferUI/LabelPlugValueWidget.py index d3eab7fa4f6..59454711924 100644 --- a/python/GafferUI/LabelPlugValueWidget.py +++ b/python/GafferUI/LabelPlugValueWidget.py @@ -45,6 +45,8 @@ # Supported plug metadata : # # - "renameable" +# - "showValueChangedIndicator" : If `False`, the indicator that the +# plug value has changed will not be shown. Defaults to `True` if not set. class LabelPlugValueWidget( GafferUI.PlugValueWidget ) : ## \todo Remove alignment arguments. Vertically the only alignment that looks good is `Center`, and @@ -72,6 +74,17 @@ def __init__( self, plug, horizontalAlignment=GafferUI.Label.HorizontalAlignment self.__label._qtWidget().setFixedHeight( 20 ) layout.addWidget( self.__label._qtWidget() ) + self.__label._qtWidget().setProperty( + "gafferShowValueChangedIndicator", + all( + ( + p.direction() == Gaffer.Plug.Direction.In and + Gaffer.Metadata.value( p, "showValueChangedIndicator" ) != False + ) + for p in self.getPlugs() + ) + ) + self.__editableLabel = None # we'll make this lazily as needed # Connecting at front so we're called before the slots diff --git a/python/GafferUI/_StyleSheet.py b/python/GafferUI/_StyleSheet.py index 98ae65344a2..5bd7f6ad27c 100644 --- a/python/GafferUI/_StyleSheet.py +++ b/python/GafferUI/_StyleSheet.py @@ -239,7 +239,7 @@ def styleColor( key ) : color: #b0d8fb; } - QLabel#gafferPlugLabel { + QLabel#gafferPlugLabel[gafferShowValueChangedIndicator="true"] { /* Ensure that there is enough space reserved for the `valueChanged` icon whether it is visible or not. @@ -247,7 +247,7 @@ def styleColor( key ) : padding-left: 10px; } - QLabel#gafferPlugLabel[gafferValueChanged="true"] { + QLabel#gafferPlugLabel[gafferShowValueChangedIndicator="true"][gafferValueChanged="true"] { background-image: url(:/valueChanged.png); background-repeat: no-repeat; background-position: left; From 8a0181ed9dd606e1cee24bf1f4c15bef887c781a Mon Sep 17 00:00:00 2001 From: Eric Mehl Date: Tue, 2 Apr 2024 17:45:23 -0400 Subject: [PATCH 3/4] SplinePlugValueWidget : Hide value changed icon --- python/GafferUI/SplinePlugValueWidget.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/GafferUI/SplinePlugValueWidget.py b/python/GafferUI/SplinePlugValueWidget.py index 187b05df86a..602fd9712a6 100644 --- a/python/GafferUI/SplinePlugValueWidget.py +++ b/python/GafferUI/SplinePlugValueWidget.py @@ -98,6 +98,8 @@ def __buttonPress( self, button, event ) : Gaffer.Metadata.registerValue( plugType, "interpolation", "plugValueWidget:type", "GafferUI.PresetsPlugValueWidget" ) for name, value in sorted( Gaffer.SplineDefinitionInterpolation.names.items() ): Gaffer.Metadata.registerValue( plugType, "interpolation", "preset:" + name, value ) + Gaffer.Metadata.registerValue( plugType, "p[0-9]*.x", "showValueChangedIndicator", False ) + Gaffer.Metadata.registerValue( plugType, "p[0-9]*.y", "showValueChangedIndicator", False ) ## \todo See comments for `ColorSwatchPlugValueWidget._ColorPlugValueDialogue`. # I think the best approach is probably to move the `acquire()` mechanism to the From e36cc50e372e6fb25b81509cf4d8cf1e4778dc7f Mon Sep 17 00:00:00 2001 From: John Haddon Date: Wed, 3 Apr 2024 12:43:20 +0100 Subject: [PATCH 4/4] LabelPlugValueWidget : Add prefix for widget-specific metadata --- Changes.md | 2 +- python/GafferUI/LabelPlugValueWidget.py | 4 ++-- python/GafferUI/SplinePlugValueWidget.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Changes.md b/Changes.md index 562e8a33885..129607e90a0 100644 --- a/Changes.md +++ b/Changes.md @@ -40,7 +40,7 @@ API - ProcessorWidget provides a base class for custom widgets, and a factory mechanism for registering them against processors. - SimpleProcessorWidget provides a base class for widgets with a simple summary label and optional action links. - TractorDispatcher : The `preSpoolSignal()` now provides an additional `taskData` argument to slots, which maps from Tractor tasks to information about the Gaffer tasks they will execute. -- LabelPlugValueWidget : Added optional `showValueChangedIndicator` metadata entry. If a plug has this entry set to `False`, the icon next to the label that indicates the value has changed will not be shown. Defaults to `True` if the value is not set. +- LabelPlugValueWidget : Added optional `labelPlugValueWidget:showValueChangedIndicator` metadata entry. If a plug has this entry set to `False`, the icon next to the label that indicates the value has changed will not be shown. Defaults to `True` if the value is not set. Breaking Changes ---------------- diff --git a/python/GafferUI/LabelPlugValueWidget.py b/python/GafferUI/LabelPlugValueWidget.py index 59454711924..f412ba43d62 100644 --- a/python/GafferUI/LabelPlugValueWidget.py +++ b/python/GafferUI/LabelPlugValueWidget.py @@ -45,7 +45,7 @@ # Supported plug metadata : # # - "renameable" -# - "showValueChangedIndicator" : If `False`, the indicator that the +# - "labelPlugValueWidget:showValueChangedIndicator" : If `False`, the indicator that the # plug value has changed will not be shown. Defaults to `True` if not set. class LabelPlugValueWidget( GafferUI.PlugValueWidget ) : @@ -79,7 +79,7 @@ def __init__( self, plug, horizontalAlignment=GafferUI.Label.HorizontalAlignment all( ( p.direction() == Gaffer.Plug.Direction.In and - Gaffer.Metadata.value( p, "showValueChangedIndicator" ) != False + Gaffer.Metadata.value( p, "labelPlugValueWidget:showValueChangedIndicator" ) != False ) for p in self.getPlugs() ) diff --git a/python/GafferUI/SplinePlugValueWidget.py b/python/GafferUI/SplinePlugValueWidget.py index 602fd9712a6..25300fd57cd 100644 --- a/python/GafferUI/SplinePlugValueWidget.py +++ b/python/GafferUI/SplinePlugValueWidget.py @@ -98,8 +98,8 @@ def __buttonPress( self, button, event ) : Gaffer.Metadata.registerValue( plugType, "interpolation", "plugValueWidget:type", "GafferUI.PresetsPlugValueWidget" ) for name, value in sorted( Gaffer.SplineDefinitionInterpolation.names.items() ): Gaffer.Metadata.registerValue( plugType, "interpolation", "preset:" + name, value ) - Gaffer.Metadata.registerValue( plugType, "p[0-9]*.x", "showValueChangedIndicator", False ) - Gaffer.Metadata.registerValue( plugType, "p[0-9]*.y", "showValueChangedIndicator", False ) + Gaffer.Metadata.registerValue( plugType, "p[0-9]*.x", "labelPlugValueWidget:showValueChangedIndicator", False ) + Gaffer.Metadata.registerValue( plugType, "p[0-9]*.y", "labelPlugValueWidget:showValueChangedIndicator", False ) ## \todo See comments for `ColorSwatchPlugValueWidget._ColorPlugValueDialogue`. # I think the best approach is probably to move the `acquire()` mechanism to the