From c222cb50806897f76a24408cafe1e52061b4802a Mon Sep 17 00:00:00 2001 From: Eric Mehl Date: Tue, 26 Mar 2024 15:54:07 -0400 Subject: [PATCH] RampPlugValueWidget : Fix `valueChanged` icon --- python/GafferUI/RampPlugValueWidget.py | 59 ++++++++++++-------------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/python/GafferUI/RampPlugValueWidget.py b/python/GafferUI/RampPlugValueWidget.py index 633fa93d337..f149de0ae22 100644 --- a/python/GafferUI/RampPlugValueWidget.py +++ b/python/GafferUI/RampPlugValueWidget.py @@ -78,37 +78,34 @@ def __init__( self, plug, **kw ) : self.__lastPositionChangedReason = None self.__positionsMergeGroupId = 0 - with GafferUI.ListContainer( - orientation = GafferUI.ListContainer.Orientation.Horizontal if isinstance( plug.pointYPlug( 0 ), Gaffer.FloatPlug ) else GafferUI.ListContainer.Orientation.Vertical, - spacing = 4 - ) : - - with GafferUI.ListContainer( orientation = GafferUI.ListContainer.Orientation.Horizontal, spacing = 4 ) : - self.__positionLabel = GafferUI.LabelPlugValueWidget( - plug.pointXPlug( 0 ), - parenting = { "verticalAlignment" : GafferUI.VerticalAlignment.Top } - ) - self.__positionField = GafferUI.NumericPlugValueWidget( - plug.pointXPlug( 0 ), - parenting = { "verticalAlignment" : GafferUI.VerticalAlignment.Top } - ) - - with GafferUI.ListContainer( orientation = GafferUI.ListContainer.Orientation.Horizontal, spacing = 4 ) : - self.__valueLabel = GafferUI.LabelPlugValueWidget( - plug.pointYPlug( 0 ), - parenting = { "verticalAlignment" : GafferUI.VerticalAlignment.Top } - ) - if isinstance( plug.pointYPlug( 0 ), Gaffer.FloatPlug ): - self.__valueField = GafferUI.NumericPlugValueWidget( - plug.pointYPlug( 0 ), - parenting = { "verticalAlignment" : GafferUI.VerticalAlignment.Top } - ) - else: - self.__valueField = GafferUI.ColorPlugValueWidget( - plug.pointYPlug( 0 ), - parenting = { "verticalAlignment" : GafferUI.VerticalAlignment.Top } - ) - self.__valueField.setColorChooserVisible( True ) + self.__positionLabel = GafferUI.LabelPlugValueWidget( plug.pointXPlug( 0 ) ) + self.__positionField = GafferUI.NumericPlugValueWidget( plug.pointXPlug( 0 ) ) + + self.__valueLabel = GafferUI.LabelPlugValueWidget( plug.pointYPlug( 0 ) ) + if isinstance( plug.pointYPlug( 0 ), Gaffer.FloatPlug ) : + self.__valueField = GafferUI.NumericPlugValueWidget( plug.pointYPlug( 0 ) ) + else: + self.__valueField = GafferUI.ColorPlugValueWidget( plug.pointYPlug( 0 ) ) + self.__valueField.setColorChooserVisible( True ) + + if isinstance( plug.pointYPlug( 0 ), Gaffer.FloatPlug ) : + row = GafferUI.ListContainer( orientation = GafferUI.ListContainer.Orientation.Horizontal, spacing = 4 ) + + row.addChild( self.__positionLabel, verticalAlignment = GafferUI.VerticalAlignment.Top ) + row.addChild( self.__positionField, verticalAlignment = GafferUI.VerticalAlignment.Top ) + + row.addChild( self.__valueLabel, verticalAlignment = GafferUI.VerticalAlignment.Top ) + row.addChild( self.__valueField, verticalAlignment = GafferUI.VerticalAlignment.Top ) + else : + grid = GafferUI.GridContainer( spacing = 4 ) + + grid.addChild( self.__positionLabel, ( 0, 0 ), ( GafferUI.HorizontalAlignment.Right, GafferUI.VerticalAlignment.Top ) ) + grid.addChild( self.__positionField, ( 1, 0 ), ( GafferUI.HorizontalAlignment.Left, GafferUI.VerticalAlignment.Top ) ) + + grid.addChild( self.__valueLabel, ( 0, 1 ), ( GafferUI.HorizontalAlignment.Right, GafferUI.VerticalAlignment.Top ) ) + grid.addChild( self.__valueField, ( 1, 1 ), ( GafferUI.HorizontalAlignment.Right, GafferUI.VerticalAlignment.Top ) ) + + self.setPlug( plug )