Skip to content

Commit

Permalink
fixup! ColorChooser : Maintain options state per-session
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmehl committed Oct 2, 2024
1 parent 2c32505 commit 931eae1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions python/GafferUITest/ColorChooserTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ def testMetadata( self ) :
script["node"]["rgbPlug2"] = Gaffer.Color3fPlug( flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic )

widget = GafferUI.ColorPlugValueWidget( script["node"]["rgbPlug1"] )
widget.setColorChooserVisible( True )

# Default state

Expand Down Expand Up @@ -171,6 +172,7 @@ def testMetadata( self ) :

del widget
widget = GafferUI.ColorPlugValueWidget( script["node"]["rgbPlug1"] )
widget.setColorChooserVisible( True )

for c in "rgbtmi" :
self.assertTrue( self.__sliderFromWidget( widget, c ).getVisible() )
Expand All @@ -183,6 +185,7 @@ def testMetadata( self ) :
# gets the original defaults.

widget2 = GafferUI.ColorPlugValueWidget( script["node"]["rgbPlug2"] )
widget2.setColorChooserVisible( True )

for c in "rgbhsvtmi" :
self.assertTrue( self.__sliderFromWidget( widget2, c ).getVisible() )
Expand All @@ -202,6 +205,7 @@ def testMetadata( self ) :
script2.execute( script.serialise() )

widget = GafferUI.ColorPlugValueWidget( script2["node"]["rgbPlug1"] )
widget.setColorChooserVisible( True )

for c in "rgbhsvtmi" :
self.assertTrue( self.__sliderFromWidget( widget, c ).getVisible() )
Expand All @@ -223,7 +227,9 @@ def testSaveDefaultOptions( self ) :
script["node"]["rgbaPlug"].setValue( imath.Color4f( 0.1 ) )

rgbWidget = GafferUI.ColorPlugValueWidget( script["node"]["rgbPlug"] )
rgbWidget.setColorChooserVisible( True )
rgbaWidget = GafferUI.ColorPlugValueWidget( script["node"]["rgbaPlug"] )
rgbaWidget.setColorChooserVisible( True )

GafferUITest.PlugValueWidgetTest.waitForUpdate( rgbWidget._ColorPlugValueWidget__colorChooser )
GafferUITest.PlugValueWidgetTest.waitForUpdate( rgbaWidget._ColorPlugValueWidget__colorChooser )
Expand Down Expand Up @@ -253,7 +259,9 @@ def testSaveDefaultOptions( self ) :

# Both color types get the same value
rgbWidget = GafferUI.ColorPlugValueWidget( script["node"]["rgbPlug"] )
rgbWidget.setColorChooserVisible( True )
rgbaWidget = GafferUI.ColorPlugValueWidget( script["node"]["rgbaPlug"] )
rgbaWidget.setColorChooserVisible( True )

GafferUITest.PlugValueWidgetTest.waitForUpdate( rgbWidget._ColorPlugValueWidget__colorChooser )
GafferUITest.PlugValueWidgetTest.waitForUpdate( rgbaWidget._ColorPlugValueWidget__colorChooser )
Expand Down

0 comments on commit 931eae1

Please sign in to comment.