Skip to content

Commit

Permalink
RampPlugValueWidget : Fix valueChanged icon
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmehl committed Mar 26, 2024
1 parent 5457295 commit c222cb5
Showing 1 changed file with 28 additions and 31 deletions.
59 changes: 28 additions & 31 deletions python/GafferUI/RampPlugValueWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 )

Expand Down

0 comments on commit c222cb5

Please sign in to comment.