Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes and alternates for #5737 #5764

Closed
wants to merge 7 commits into from
Closed
Prev Previous commit
LabelPlugValueWidget : Remove value changed indicator metadata
And instead just use a NameLabel in RampPlugValueWidget.
johnhaddon committed Apr 3, 2024
commit ad9a78bb1b221db11eeec728bfcbbaf8d9e6ef48
1 change: 0 additions & 1 deletion Changes.md
Original file line number Diff line number Diff line change
@@ -39,7 +39,6 @@ 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 `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
----------------
7 changes: 1 addition & 6 deletions python/GafferUI/LabelPlugValueWidget.py
Original file line number Diff line number Diff line change
@@ -45,8 +45,6 @@
# Supported plug metadata :
#
# - "renameable"
# - "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 ) :

## \todo Remove alignment arguments. Vertically the only alignment that looks good is `Center`, and
@@ -77,10 +75,7 @@ def __init__( self, plug, horizontalAlignment=GafferUI.Label.HorizontalAlignment
self.__label._qtWidget().setProperty(
"gafferShowValueChangedIndicator",
all(
(
p.direction() == Gaffer.Plug.Direction.In and
Gaffer.Metadata.value( p, "labelPlugValueWidget:showValueChangedIndicator" ) != False
)
p.direction() == Gaffer.Plug.Direction.In
for p in self.getPlugs()
)
)
17 changes: 8 additions & 9 deletions python/GafferUI/RampPlugValueWidget.py
Original file line number Diff line number Diff line change
@@ -83,17 +83,19 @@ def __init__( self, plug, **kw ) :
spacing = 4
) :

self.__positionLabel = GafferUI.LabelPlugValueWidget(
self.__positionLabel = GafferUI.NameLabel(
plug.pointXPlug( 0 ),
formatter = lambda _ : "Position",
parenting = { "verticalAlignment" : GafferUI.VerticalAlignment.Top }
)
self.__positionField = GafferUI.NumericPlugValueWidget(
plug.pointXPlug( 0 ),
parenting = { "verticalAlignment" : GafferUI.VerticalAlignment.Top }
)

self.__valueLabel = GafferUI.LabelPlugValueWidget(
self.__valueLabel = GafferUI.NameLabel(
plug.pointYPlug( 0 ),
formatter = lambda _ : "Value",
parenting = { "verticalAlignment" : GafferUI.VerticalAlignment.Top }
)
if isinstance( plug.pointYPlug( 0 ), Gaffer.FloatPlug ):
@@ -211,20 +213,17 @@ def __selectedIndexChanged( self, slider ) :
index = slider.getSelectedIndex()
if self.getPlug() is not None and index is not None :
pointPlug = self.getPlug().pointPlug( index )
self.__positionLabel.setPlug( pointPlug["x"] )
self.__positionLabel.setGraphComponent( pointPlug["x"] )
self.__positionField.setPlug( pointPlug["x"] )
self.__valueLabel.setPlug( pointPlug["y"] )
self.__valueLabel.setGraphComponent( pointPlug["y"] )
self.__valueField.setPlug( pointPlug["y"] )

else :
self.__positionLabel.setPlug( None )
self.__positionLabel.setGraphComponent( None )
self.__positionField.setPlug( None )
self.__valueLabel.setPlug( None )
self.__valueLabel.setGraphComponent( None )
self.__valueField.setPlug( None )

self.__positionLabel.label().setText( "Position" )
self.__valueLabel.label().setText( "Value" )

# we don't register this automatically for any plugs, as it takes up a lot of room
# in the node editor. this means the SplinePlugValueWidget will be used instead, and
# that will launch a dialogue containing a RampPlugValueWidget when appropriate. for
2 changes: 0 additions & 2 deletions python/GafferUI/SplinePlugValueWidget.py
Original file line number Diff line number Diff line change
@@ -98,8 +98,6 @@ 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", "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