def __init__( self, color=IECore.Color3f( 1 ) ) : self.__column = GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Vertical ) GafferUI.Widget.__init__( self, self.__column.gtkWidget() ) self.__color = color self.__defaultColor = color self.__sliders = {} self.__sliders["r"] = ColorSlider( color, "r" ) self.__sliders["g"] = ColorSlider( color, "g" ) self.__sliders["b"] = ColorSlider( color, "b" ) self.__column.append( self.__sliders["r"] ) self.__column.append( self.__sliders["g"] ) self.__column.append( self.__sliders["b"] ) self.__sliders["h"] = ColorSlider( color, "h" ) self.__sliders["s"] = ColorSlider( color, "s" ) self.__sliders["v"] = ColorSlider( color, "v" ) self.__column.append( self.__sliders["h"] ) self.__column.append( self.__sliders["s"] ) self.__column.append( self.__sliders["v"] ) self.__sliderConnections = [] for s in self.__sliders.values() : self.__sliderConnections.append( s.positionChangedSignal().connect( self.__sliderChanged ) ) swatchRow = GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Horizontal ) self.__initialColorSwatch = GafferUI.ColorSwatch( color ) self.__initialColorSwatch.gtkWidget().add_events( gtk.gdk.BUTTON_PRESS_MASK ) self.__initialColorSwatch.gtkWidget().connect( "button-press-event", lambda widget, event : self.setColor( self.getInitialColor() ) ) swatchRow.append( self.__initialColorSwatch, expand=True ) self.__colorSwatch = GafferUI.ColorSwatch( color ) swatchRow.append( self.__colorSwatch, expand=True ) self.__column.append( swatchRow, expand=True ) self.__colorChangedSignal = GafferUI.WidgetSignal() self.__setSlidersFromColor()
def __init__(self, key, target=None, defaultValue=imath.Color4f(0, 0, 0, 0), **kw): self.__swatch = GafferUI.ColorSwatch(useDisplayTransform=False) MetadataWidget.__init__(self, self.__swatch, key, target, defaultValue=defaultValue, **kw) self.__swatch._qtWidget().setFixedHeight(18) self.__swatch._qtWidget().setMaximumWidth(40) self.__swatch.buttonReleaseSignal().connect(Gaffer.WeakMethod( self.__buttonRelease), scoped=False)
def __init__(self, color=IECore.Color3f(1)): self.__column = GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Vertical, spacing=4) GafferUI.Widget.__init__(self, self.__column) self.__color = color self.__defaultColor = color self.__sliders = {} self.__numericWidgets = {} self.__componentValueChangedConnections = [] with self.__column: # sliders and numeric widgets for component in "rgbahsv": with GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Horizontal, spacing=4): numericWidget = GafferUI.NumericWidget(0.0) numericWidget.setFixedCharacterWidth(6) numericWidget.component = component self.__numericWidgets[component] = numericWidget slider = _ComponentSlider(color, component) self.__sliders[component] = slider self.__componentValueChangedConnections.append( numericWidget.valueChangedSignal().connect( Gaffer.WeakMethod(self.__componentValueChanged))) self.__componentValueChangedConnections.append( slider.valueChangedSignal().connect( Gaffer.WeakMethod(self.__componentValueChanged))) # initial and current colour swatches with GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Horizontal, parenting={"expand": True}): self.__initialColorSwatch = GafferUI.ColorSwatch( color, parenting={"expand": True}) self.__initialColorPressConnection = self.__initialColorSwatch.buttonPressSignal( ).connect(Gaffer.WeakMethod(self.__initialColorPress)) GafferUI.Spacer(IECore.V2i(4, 40)) self.__colorSwatch = GafferUI.ColorSwatch( color, parenting={"expand": True}) self.__colorChangedSignal = Gaffer.Signal2() self.__updateUIFromColor()
def _update(self): with self.node().scriptNode().context(): try: values = self.node().values() except: return if not len(values) or not isinstance(values[0], imath.Color3f): return for i in range(0, max(len(values), len(self.__row))): if i >= len(values): self.__row[i].setVisible(False) else: if i < len(self.__row): swatch = self.__row[i] swatch.setVisible(True) else: swatch = GafferUI.ColorSwatch() swatch._qtWidget().setMinimumSize(0, 12) self.__row.append(swatch) swatch.setColor(values[i])
def __init__(self, plugs, **kw): self.__swatch = GafferUI.ColorSwatch() GafferUI.PlugValueWidget.__init__(self, self.__swatch, plugs, **kw) ## \todo How do set maximum height with a public API? self.__swatch._qtWidget().setMaximumHeight(20) self._addPopupMenu(self.__swatch) self.__swatch.buttonPressSignal().connect(Gaffer.WeakMethod( self.__buttonPress), scoped=False) self.__swatch.dragBeginSignal().connect(Gaffer.WeakMethod( self.__dragBegin), scoped=False) self.__swatch.dragEndSignal().connect(Gaffer.WeakMethod( self.__dragEnd), scoped=False) self.__swatch.buttonReleaseSignal().connect(Gaffer.WeakMethod( self.__buttonRelease), scoped=False) self._updateFromPlugs()
def testAccessors( self ) : c = GafferUI.ColorSwatch() self.assertEqual( c.getColor(), IECore.Color4f( 1 ) ) c.setColor( IECore.Color3f( 1, 2, 3 ) ) self.assertEqual( c.getColor(), IECore.Color3f( 1, 2, 3 ) )
def __init__( self, color=IECore.Color3f( 1 ) ) : self.__column = GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Vertical ) GafferUI.Widget.__init__( self, self.__column ) self.__color = color self.__defaultColor = color self.__sliders = {} self.__sliders["r"] = ColorSlider( color, "r" ) self.__sliders["g"] = ColorSlider( color, "g" ) self.__sliders["b"] = ColorSlider( color, "b" ) self.__sliders["a"] = ColorSlider( color, "a" ) self.__column.append( self.__sliders["r"] ) self.__column.append( self.__sliders["g"] ) self.__column.append( self.__sliders["b"] ) self.__column.append( self.__sliders["a"] ) self.__sliders["h"] = ColorSlider( color, "h" ) self.__sliders["s"] = ColorSlider( color, "s" ) self.__sliders["v"] = ColorSlider( color, "v" ) self.__column.append( self.__sliders["h"] ) self.__column.append( self.__sliders["s"] ) self.__column.append( self.__sliders["v"] ) self.__sliderConnections = [] for s in self.__sliders.values() : self.__sliderConnections.append( s.valueChangedSignal().connect( Gaffer.WeakMethod( self.__sliderChanged ) ) ) swatchRow = GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Horizontal ) self.__initialColorSwatch = GafferUI.ColorSwatch( color ) self.__initialColorPressConnection = self.__initialColorSwatch.buttonPressSignal().connect( Gaffer.WeakMethod( self.__initialColorPress ) ) swatchRow.append( self.__initialColorSwatch, expand=True ) self.__colorSwatch = GafferUI.ColorSwatch( color ) swatchRow.append( self.__colorSwatch, expand=True ) self.__column.append( swatchRow, expand=True ) self.__colorChangedSignal = Gaffer.Signal2() self.__setSlidersFromColor()
def __init__(self, plug, **kw): self.__grid = GafferUI.GridContainer(spacing=4) GafferUI.PlugValueWidget.__init__(self, self.__grid, plug, **kw) with self.__grid: for x in range(0, 10): for y in range(0, 3): GafferUI.ColorSwatch(parenting={"index": (x, y)}) self._updateFromPlug()
def __init__(self, plug): self.__swatch = GafferUI.ColorSwatch() GafferUI.PlugValueWidget.__init__(self, self.__swatch.gtkWidget(), plug) self.__swatch.gtkWidget().add_events(gtk.gdk.BUTTON_PRESS_MASK) self.__swatch.gtkWidget().connect("button-press-event", self.__buttonPress) self.__colorChooserDialogue = None
def __init__(self, key, target=None, **kw): self.__swatch = GafferUI.ColorSwatch(useDisplayTransform=False) _MetadataWidget.__init__(self, self.__swatch, key, target, **kw) self.__swatch._qtWidget().setMaximumHeight(20) self.__swatch._qtWidget().setMaximumWidth(40) self.__value = None self.__buttonReleaseConnection = self.__swatch.buttonReleaseSignal( ).connect(Gaffer.WeakMethod(self.__buttonRelease))
def __init__(self, plug, **kw): frame = GafferUI.Frame(borderWidth=4) GafferUI.PlugValueWidget.__init__(self, frame, plug, **kw) # Style selector specificity rules seem to preclude us styling this # based on gafferClass. frame._qtWidget().setObjectName("gafferColorInspector") with frame: with GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Horizontal, spacing=4): GafferUI.Spacer(imath.V2i(0, 10)) self.__positionLabel = GafferUI.Label() self.__positionLabel._qtWidget().setFixedWidth(90) self.__swatch = GafferUI.ColorSwatch() self.__swatch._qtWidget().setFixedWidth(12) self.__swatch._qtWidget().setFixedHeight(12) self.__busyWidget = GafferUI.BusyWidget(size=12) self.__rgbLabel = GafferUI.Label() GafferUI.Spacer(imath.V2i(20, 10), imath.V2i(20, 10)) self.__hsvLabel = GafferUI.Label() GafferUI.Spacer(imath.V2i(0, 10)) self.__pixel = imath.V2f(0) viewportGadget = plug.parent().viewportGadget() viewportGadget.mouseMoveSignal().connect(Gaffer.WeakMethod( self.__mouseMove), scoped=False) imageGadget = viewportGadget.getPrimaryChild() imageGadget.buttonPressSignal().connect(Gaffer.WeakMethod( self.__buttonPress), scoped=False) imageGadget.dragBeginSignal().connect(Gaffer.WeakMethod( self.__dragBegin), scoped=False) imageGadget.dragEndSignal().connect(Gaffer.WeakMethod(self.__dragEnd), scoped=False) self.__updateLabels(imath.V2i(0), imath.Color4f(0, 0, 0, 1))
def __init__(self, plug, **kw): GafferUI.CompoundNumericPlugValueWidget.__init__(self, plug, **kw) self.__swatch = GafferUI.ColorSwatch() ## \todo How do set maximum height with a public API? self.__swatch._qtWidget().setMaximumHeight(20) self._row().append(self.__swatch, expand=True) self.__buttonPressConnection = self.__swatch.buttonPressSignal( ).connect(Gaffer.WeakMethod(self.__buttonPress)) self.__colorChooserDialogue = None self.__blinkBehaviour = None self._updateFromPlug()
def __init__( self, plug, **kw ) : self.__swatch = GafferUI.ColorSwatch() GafferUI.PlugValueWidget.__init__( self, self.__swatch, plug, **kw ) ## \todo How do set maximum height with a public API? self.__swatch._qtWidget().setMaximumHeight( 20 ) self._addPopupMenu( self.__swatch ) self.__buttonPressConnection = self.__swatch.buttonPressSignal().connect( Gaffer.WeakMethod( self.__buttonPress ) ) self.__dragBeginConnection = self.__swatch.dragBeginSignal().connect( Gaffer.WeakMethod( self.__dragBegin ) ) self.__dragEndConnection = self.__swatch.dragEndSignal().connect( Gaffer.WeakMethod( self.__dragEnd ) ) self.__buttonReleaseConnection = self.__swatch.buttonReleaseSignal().connect( Gaffer.WeakMethod( self.__buttonRelease ) ) self.__colorChooserDialogue = None self._updateFromPlug()
def __init__(self, plug, **kw): frame = GafferUI.Frame(borderWidth=4) frame._qtWidget().setObjectName("gafferDarker") GafferUI.PlugValueWidget.__init__(self, frame, plug, **kw) with frame: with GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Horizontal, spacing=4): self.__positionLabel = GafferUI.Label() self.__positionLabel._qtWidget().setFixedWidth(90) self.__swatch = GafferUI.ColorSwatch() self.__swatch._qtWidget().setFixedWidth(12) self.__swatch._qtWidget().setFixedHeight(12) self.__busyWidget = GafferUI.BusyWidget(size=12) self.__rgbLabel = GafferUI.Label() GafferUI.Spacer(imath.V2i(20, 10), imath.V2i(20, 10)) self.__hsvLabel = GafferUI.Label() self.__pixel = imath.V2f(0) viewportGadget = plug.parent().viewportGadget() self.__mouseMoveConnection = viewportGadget.mouseMoveSignal().connect( Gaffer.WeakMethod(self.__mouseMove)) imageGadget = viewportGadget.getPrimaryChild() self.__buttonPressSignal = imageGadget.buttonPressSignal().connect( Gaffer.WeakMethod(self.__buttonPress)) self.__dragBeginSignal = imageGadget.dragBeginSignal().connect( Gaffer.WeakMethod(self.__dragBegin)) self.__dragEndSignal = imageGadget.dragEndSignal().connect( Gaffer.WeakMethod(self.__dragEnd)) self.__updateLabels(imath.V2i(0), imath.Color4f(0, 0, 0, 1))
def __init__(self, **kw): GafferUI.ListContainer.__init__( self, GafferUI.ListContainer.Orientation.Horizontal, spacing=4) self.__spacer = GafferUI.Spacer(imath.V2i(20, 1), imath.V2i(20, 1)) self.addChild(self.__spacer) self.__swatch = GafferUI.ColorSwatch() # No easy way to manage size at present in GafferUI self.__swatch._qtWidget().setFixedWidth(40) self.__swatch._qtWidget().setFixedHeight(20) self.addChild(self.__swatch) self.__label = GafferUI.Label() self.addChild(self.__label) # Allow right-click to add an override for the target set self.__menu = GafferUI.Menu(Gaffer.WeakMethod( self.__addMenuDefinition)) self.contextMenuSignal().connect(Gaffer.WeakMethod(self.__menu.popup), scoped=False)
def __init__(self, plug, **kw): frame = GafferUI.Frame(borderWidth=4) frame._qtWidget().setObjectName("gafferDarker") GafferUI.PlugValueWidget.__init__(self, frame, plug, **kw) with frame: with GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Horizontal, spacing=4): self.__positionLabel = GafferUI.Label() self.__positionLabel._qtWidget().setFixedWidth(90) self.__swatch = GafferUI.ColorSwatch() self.__swatch._qtWidget().setFixedWidth(12) self.__swatch._qtWidget().setFixedHeight(12) self.__rgbLabel = GafferUI.Label() GafferUI.Spacer(IECore.V2i(20, 10), IECore.V2i(20, 10)) self.__hsvLabel = GafferUI.Label()
def __init__(self, color=imath.Color3f(1), useDisplayTransform=True, components="rgb-HSL-a", showSwatch=True, **kw): self.__column = GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Vertical, spacing=4) GafferUI.Widget.__init__(self, self.__column, **kw) self.__color = color self.__defaultColor = color self.__sliders = {} self.__numericWidgets = {} self.__componentValueChangedConnections = [] with self.__column: # sliders and numeric widgets for component in components: if component == "-": GafferUI.Divider() continue with GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Horizontal, spacing=4): label = GafferUI.Label(component.upper(), horizontalAlignment=GafferUI.Label. HorizontalAlignment.Center) label._qtWidget().setFixedWidth(20) numericWidget = GafferUI.NumericWidget(0.0) numericWidget.setFixedCharacterWidth(6) numericWidget.component = component self.__numericWidgets[component] = numericWidget slider = _ComponentSlider( color, component, useDisplayTransform=useDisplayTransform) self.__sliders[component] = slider self.__componentValueChangedConnections.append( numericWidget.valueChangedSignal().connect( Gaffer.WeakMethod(self.__componentValueChanged), scoped=False)) self.__componentValueChangedConnections.append( slider.valueChangedSignal().connect(Gaffer.WeakMethod( self.__componentValueChanged), scoped=False)) if showSwatch: # initial and current colour swatches with GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Horizontal, parenting={"expand": True}): self.__initialColorSwatch = GafferUI.ColorSwatch( color, useDisplayTransform=useDisplayTransform, parenting={"expand": True}) self.__initialColorSwatch.buttonPressSignal().connect( Gaffer.WeakMethod(self.__initialColorPress), scoped=False) GafferUI.Spacer(imath.V2i(4, 40)) self.__colorSwatch = GafferUI.ColorSwatch( color, useDisplayTransform=useDisplayTransform, parenting={"expand": True}) else: self.__initialColorSwatch = None self.__colorSwatch = None self.__colorChangedSignal = Gaffer.Signal2() self.__updateUIFromColor()
def __init__(self, plug, **kw): l = GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Horizontal, spacing=4) GafferUI.PlugValueWidget.__init__(self, l, plug, **kw) mode = plug["mode"].getValue() with l: self.__indexLabel = GafferUI.Label() labelFont = QtGui.QFont(self.__indexLabel._qtWidget().font()) labelFont.setBold(True) labelFont.setPixelSize(10) labelFontMetrics = QtGui.QFontMetrics(labelFont) self.__indexLabel._qtWidget().setMinimumWidth( labelFontMetrics.width("99")) self.__modeImage = GafferUI.Image("sourceCursor.png") self.__positionLabel = GafferUI.Label() self.__positionLabel._qtWidget().setMinimumWidth( labelFontMetrics.width("9999 9999 -> 9999 9999")) self.__swatch = GafferUI.ColorSwatch() self.__swatch._qtWidget().setFixedWidth(12) self.__swatch._qtWidget().setFixedHeight(12) self.__busyWidget = GafferUI.BusyWidget(size=12) self.__rgbLabel = GafferUI.Label() self.__rgbLabel._qtWidget().setMinimumWidth( labelFontMetrics.width("RGBA : 99999 99999 99999 99999")) self.__hsvLabel = GafferUI.Label() self.__hsvLabel._qtWidget().setMinimumWidth( labelFontMetrics.width("HSV : 99999 99999 99999")) self.__exposureLabel = GafferUI.Label() self.__exposureLabel._qtWidget().setMinimumWidth( labelFontMetrics.width("EV : 19.9")) l.addChild(GafferUI.Spacer(size=imath.V2i(0))) if mode == GafferImageUI.ImageView.ColorInspectorPlug.Mode.Cursor: m = IECore.MenuDefinition() m.append( "/Pixel Inspector", { "command": functools.partial( Gaffer.WeakMethod(self.__addClick), GafferImageUI. ImageView.ColorInspectorPlug.Mode.Pixel) }) m.append( "/Area Inspector", { "command": functools.partial( Gaffer.WeakMethod(self.__addClick), GafferImageUI. ImageView.ColorInspectorPlug.Mode.Area) }) button = GafferUI.MenuButton("", "plus.png", hasFrame=False, menu=GafferUI.Menu( m, title="Add Color Inspector")) else: button = GafferUI.Button("", "delete.png", hasFrame=False) button.clickedSignal().connect(Gaffer.WeakMethod( self.__deleteClick), scoped=False) self.__pixel = imath.V2i(0) self.__createInspectorStartPosition = None if plug.getName() == "ColorInspectorPlug": viewportGadget = plug.node().viewportGadget() imageGadget = viewportGadget.getPrimaryChild() imageGadget.mouseMoveSignal().connect(Gaffer.WeakMethod( self.__mouseMove), scoped=False) imageGadget.buttonPressSignal().connect(Gaffer.WeakMethod( self.__buttonPress), scoped=False) imageGadget.buttonReleaseSignal().connect(Gaffer.WeakMethod( self.__buttonRelease), scoped=False) imageGadget.dragBeginSignal().connect(Gaffer.WeakMethod( self.__dragBegin), scoped=False) imageGadget.dragEnterSignal().connect(Gaffer.WeakMethod( self.__dragEnter), scoped=False) imageGadget.dragMoveSignal().connect(Gaffer.WeakMethod( self.__dragMove), scoped=False) imageGadget.dragEndSignal().connect(Gaffer.WeakMethod( self.__dragEnd), scoped=False) self.__swatch.buttonPressSignal().connect(Gaffer.WeakMethod( self.__buttonPress), scoped=False) self.__swatch.dragBeginSignal().connect(Gaffer.WeakMethod( self.__dragBegin), scoped=False) self.__swatch.dragEndSignal().connect(Gaffer.WeakMethod( self.__dragEnd), scoped=False) plug.node()["colorInspector"]["evaluator"]["pixelColor"].getInput( ).node().plugDirtiedSignal().connect(Gaffer.WeakMethod( self.__updateFromImageNode), scoped=False) plug.node().plugDirtiedSignal().connect(Gaffer.WeakMethod( self._plugDirtied), scoped=False) plug.node()["in"].getInput().node().scriptNode().context( ).changedSignal().connect(Gaffer.WeakMethod(self.__updateFromContext), scoped=False) Gaffer.Metadata.plugValueChangedSignal(self.getPlug().node()).connect( Gaffer.WeakMethod(self.__plugMetadataChanged), scoped=False) self.__updateLabels(imath.V2i(0), imath.Color4f(0, 0, 0, 1)) # Set initial state of mode icon self._plugDirtied(plug["mode"])
def __init__(self, scriptNode, **kw): # create main two part container (top for actions, bottom for feedback) self.__splittable = GafferUI.SplitContainer(borderWidth=2) GafferUI.Editor.__init__(self, self.__splittable, scriptNode, **kw) with self.__splittable: # create splittable container so we can have actions tabs and a feedback window. GafferUI.Label( "This toolset is designed to make managing graphs simpler and more consistent", horizontalAlignment=GafferUI.Label.HorizontalAlignment.Center, ) ############# TAB CONTAINER ############## with GafferUI.TabbedContainer() as self.__tab1Container: ############# LAYOUT TAB ############## with GafferUI.ListContainer( spacing=5, borderWidth=5) as self.__toolboxContainer1: self.__tab1Container.setLabel(self.__toolboxContainer1, "Layout") directions = ( # direction, ascii, position ("NW", "\xf0\x9f\xa1\xbc", (1, 1)), ("N", "\xf0\x9f\xa1\xb9", (2, 1)), ("NE", "\xf0\x9f\xa1\xbd", (3, 1)), ("W", "\xf0\x9f\xa1\xb8", (1, 2)), (None, None, (2, 2)), ("E", "\xf0\x9f\xa1\xba", (3, 2)), ("SW", "\xf0\x9f\xa1\xbf", (1, 3)), ("S", "\xf0\x9f\xa1\xbb", (2, 3)), ("SE", "\xf0\x9f\xa1\xbe", (3, 3))) with GafferUI.GridContainer() as self.__moverGrid: GafferUI.Label("Select", parenting={"index": (1, 1)}) GafferUI.Label(" ", parenting={"index": (2, 1)}) GafferUI.Label("Move", parenting={"index": (3, 1)}) GafferUI.Label(" ", parenting={"index": (4, 1)}) ############# SELECTOR ARROW GRID ############## with GafferUI.GridContainer( parenting={"index": ( 1, 2)}) as self.__selectorGrid: for direction in directions: if direction[0] != None: GafferUI.Button( text=direction[1], parenting={"index": (direction[2])}) self.__selectorGrid[direction[ 2]]._qtWidget().setMinimumWidth(25) self.__selectorGrid[direction[ 2]]._qtWidget().setMaximumWidth(25) self.__selectorGrid[ direction[2]]._qtWidget().setProperty( "myDirection", direction[0]) self.__selectorGrid[ direction[2]].clickedSignal().connect( self.__selectorAction, scoped=False) ############# MOVER ARROW GRID ############## with GafferUI.GridContainer( parenting={"index": (3, 2)}) as self.__moverGrid: for direction in directions: if direction[0] != None: GafferUI.Button( text=direction[1], parenting={"index": (direction[2])}) self.__moverGrid[direction[2]]._qtWidget( ).setMinimumWidth(25) self.__moverGrid[direction[2]]._qtWidget( ).setMaximumWidth(25) self.__moverGrid[ direction[2]]._qtWidget().setProperty( "myDirection", direction[0]) self.__moverGrid[ direction[2]].clickedSignal().connect( self.__moverAction, scoped=False) ############# SELECT/MOVE OPTIONS ############## with GafferUI.ListContainer( orientation=GafferUI.ListContainer.Orientation. Vertical, parenting={"index": (5, 2)}) as self.__LayoutOptions: self.__limitToBackdropsCheckbox = GafferUI.BoolWidget( text="Limit Selection to Backdrops", checked=True) self.__extendBackdropsCheckbox = GafferUI.BoolWidget( text="Extend Backdrops", checked=True) ############# COLOUR TAB ############## with GafferUI.ListContainer( spacing=5, borderWidth=5) as self.__toolboxContainer2: self.__tab1Container.setLabel(self.__toolboxContainer2, "Colour") ############# COLOUR GRID ############## with GafferUI.GridContainer() as self.__colorGrid: gridSize = (10, 5) for i in range(0, gridSize[0]): for j in range(0, gridSize[1]): HSV = imath.Color4f( (1.0 / gridSize[0]) * float(i), 0.5, 1.0 - ((1.0 / gridSize[1]) * float(j)), 1.0) RGB = HSV.hsv2rgb() GafferUI.ColorSwatch( RGB, useDisplayTransform=False, parenting={"index": (i, j)}) self.__colorGrid[ i, j]._qtWidget().setMaximumHeight(20) self.__colorGrid[ i, j].buttonPressSignal().connect( self.__setColourAction, scoped=False) ############# SEARCH AND REPLACE TAB ############## with GafferUI.ListContainer( spacing=5, borderWidth=5) as self.__toolboxContainer3: self.__tab1Container.setLabel(self.__toolboxContainer3, "Search and Replace") spacing = 100 with GafferUI.ListContainer( spacing=5, borderWidth=5, orientation=GafferUI.ListContainer.Orientation. Horizontal) as self.__searchList: self.__searchLabel = GafferUI.Label( "Search For", horizontalAlignment=GafferUI.Label. HorizontalAlignment.Right) self.__searchLabel._qtWidget().setMinimumWidth(spacing) self.__searchLabel._qtWidget().setMaximumWidth(spacing) self.__searchWidget = GafferUI.TextWidget( text="myTest") with GafferUI.ListContainer( spacing=5, borderWidth=5, orientation=GafferUI.ListContainer.Orientation. Horizontal) as self.__replaceList: self.__replaceLabel = GafferUI.Label( "Replace With", horizontalAlignment=GafferUI.Label. HorizontalAlignment.Right) self.__replaceLabel._qtWidget().setMinimumWidth( spacing) self.__replaceLabel._qtWidget().setMaximumWidth( spacing) self.__replaceWidget = GafferUI.TextWidget( text="banana") with GafferUI.ListContainer( spacing=5, borderWidth=5, orientation=GafferUI.ListContainer.Orientation. Horizontal) as self.__searchReplaceList: self.__searchReplaceNodePlugsMenu = GafferUI.SelectionMenu( ) self.__searchReplaceNodePlugsMenu.addItem("Node Names") self.__searchReplaceNodePlugsMenu.addItem( "Plug Values") self.__searchReplaceNodePlugsMenu._qtWidget( ).setMinimumWidth(spacing) self.__searchReplaceNodePlugsMenu._qtWidget( ).setMaximumWidth(spacing) self.__searchReplaceScopeMenu = GafferUI.SelectionMenu( ) self.__searchReplaceScopeMenu.addItem( "In Selected Nodes") self.__searchReplaceScopeMenu.addItem( "In Gaffer Scene") self.__searchReplaceScopeMenu._qtWidget( ).setMinimumWidth(spacing + 30) self.__searchReplaceScopeMenu._qtWidget( ).setMaximumWidth(spacing + 30) self.__searchReplaceButton = GafferUI.Button( text="Search and Replace") self.__searchReplaceButton.clickedSignal().connect( self.__findReplaceAction, scoped=False) self.__searchReplaceButton._qtWidget().setMaximumWidth( 150)