示例#1
0
	def __init__( self, scriptNode, **kw ) :

		self.__gadgetWidget = GafferUI.GadgetWidget(
			bufferOptions = set( (
				GafferUI.GLWidget.BufferOptions.Depth,
				GafferUI.GLWidget.BufferOptions.Double )
			),
		)

		GafferUI.NodeSetEditor.__init__( self, self.__gadgetWidget, scriptNode, **kw )

		with GafferUI.ListContainer( borderWidth = 2, spacing = 2 ) as toolbarColumn :
			self.__nodeToolbarFrame = GafferUI.Frame( borderWidth = 0, borderStyle=GafferUI.Frame.BorderStyle.None )
			with GafferUI.ListContainer( borderWidth = 0, spacing = 2, orientation = GafferUI.ListContainer.Orientation.Horizontal ) :
				with GafferUI.Frame( borderWidth = 1, borderStyle=GafferUI.Frame.BorderStyle.None ) :
					self.__toolMenuButton = GafferUI.MenuButton( menu = GafferUI.Menu( Gaffer.WeakMethod( self.__toolMenuDefinition ) ), hasFrame=False )
				self.__toolbarFrame = GafferUI.Frame( borderWidth = 0, borderStyle=GafferUI.Frame.BorderStyle.None )
		self.__gadgetWidget.addOverlay( toolbarColumn )

		self.__views = []
		# The following two variables are indexed by view
		# instance. We would prefer to simply store toolbars
		# and tools as python attributes on the view instances
		# themselves, but we can't because that would create
		# circular references.
		self.__viewToolbars = {}
		self.__viewTools = {}
		self.__currentView = None

		self._updateFromSet()
示例#2
0
    def __init__(self, title, message, details=None, **kw):

        GafferUI.Dialogue.__init__(self,
                                   title,
                                   sizeMode=GafferUI.Window.SizeMode.Manual,
                                   **kw)

        column = GafferUI.ListContainer(
            GafferUI.ListContainer.Orientation.Vertical, spacing=8)
        messageWidget = GafferUI.Label(IECore.StringUtil.wrap(message, 60))
        messageFrame = GafferUI.Frame(child=messageWidget, borderWidth=8)

        column.append(messageFrame)

        if details is not None:

            detailsWidget = GafferUI.MultiLineTextWidget(
                text=details,
                editable=False,
            )

            detailsFrame = GafferUI.Frame(child=detailsWidget, borderWidth=8)

            column.append(
                GafferUI.Collapsible(label="Details",
                                     collapsed=True,
                                     child=detailsFrame))

        self._setWidget(column)

        self.__closeButton = self._addButton("Close")
示例#3
0
	def testGetHandleTwice( self ) :

		c = GafferUI.SplitContainer()

		c.append( GafferUI.Frame() )
		c.append( GafferUI.Frame() )

		self.failUnless( c.handle( 0 ) is c.handle( 0 ) )
示例#4
0
    def testGetHandleTwice(self):

        c = GafferUI.SplitContainer()

        c.append(GafferUI.Frame())
        c.append(GafferUI.Frame())

        self.assertTrue(c.handle(0) is c.handle(0))
示例#5
0
    def testHandle(self):

        c = GafferUI.SplitContainer()

        c.append(GafferUI.Frame())
        c.append(GafferUI.Frame())

        self.assertRaises(IndexError, c.handle, -1)
        self.assertRaises(IndexError, c.handle, 1)

        self.assertIsInstance(c.handle(0), GafferUI.Widget)
        self.assertEqual(c.handle(0).parent(), c)
示例#6
0
    def testAccessHandleAfterContainerDeleted(self):

        c = GafferUI.SplitContainer()

        c.append(GafferUI.Frame())
        c.append(GafferUI.Frame())

        h = c.handle(0)

        del c

        # the internal handle has been deleted. there's not much we can do
        # except make sure that we get exceptions rather than crashes.
        self.assertRaises(RuntimeError, h.size)
示例#7
0
    def testCanDieAfterGetHandle(self):

        c = GafferUI.SplitContainer()

        c.append(GafferUI.Frame())
        c.append(GafferUI.Frame())

        w = weakref.ref(c)

        h = c.handle(0)

        del c

        self.assertEqual(w(), None)
示例#8
0
    def testGetSizes(self):

        w = GafferUI.Window()
        c = GafferUI.SplitContainer()
        w.setChild(c)

        c.append(GafferUI.Frame())
        c.append(GafferUI.Frame())

        # SplitContainer must be visible on screen before we can
        # rely on size information.
        w.setVisible(True)

        sizes = c.getSizes()
        self.assertEqual(sum(sizes) + c.handle(0).size().y, c.size().y)
示例#9
0
	def __init__( self, tasks, dispatchers, nodesToShow, postDispatchBehaviour=PostDispatchBehaviour.Confirm, title="Dispatch Tasks", sizeMode=GafferUI.Window.SizeMode.Manual, **kw ) :

		GafferUI.Dialogue.__init__( self, title, sizeMode=sizeMode, **kw )

		self._getWidget().setBorderStyle( GafferUI.Frame.BorderStyle.None )

		self.__dispatchers = dispatchers
		self.__tasks = tasks
		self.__nodesToShow = nodesToShow
		self.__script = tasks[0].scriptNode()
		# hold a reference to the script window so plugs which launch child windows work properly.
		# this is necessary for PlugValueWidgets like color swatches and ramps. Ideally those widgets
		# wouldn't rely on the existence of a ScriptWindow and we could drop this acquisition.
		self.__scriptWindow = GafferUI.ScriptWindow.acquire( self.__script )

		self.__postDispatchBehaviour = postDispatchBehaviour

		# build tabs for all the node, dispatcher, and context settings
		with GafferUI.ListContainer() as self.__settings :

			mainMenu = GafferUI.MenuBar( self.menuDefinition() )
			mainMenu.setVisible( False )

			with GafferUI.TabbedContainer() as self.__tabs :

				for node in self.__nodesToShow :
					nodeFrame = GafferUI.Frame( borderStyle=GafferUI.Frame.BorderStyle.None, borderWidth=0 )
					nodeFrame.addChild( self.__nodeEditor( node ) )
					# remove the per-node execute button
					Gaffer.Metadata.registerValue( node, "layout:customWidget:dispatchButton:widgetType", "", persistent = False )
					self.__tabs.setLabel( nodeFrame, node.relativeName( self.__script ) )

				with GafferUI.ListContainer() as dispatcherTab :

					with GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Horizontal, spacing=2, borderWidth=4 ) as dispatcherMenuColumn :
						GafferUI.Label( "<h4>Dispatcher</h4>" )
						self.__dispatchersMenu = GafferUI.MultiSelectionMenu( allowMultipleSelection = False, allowEmptySelection = False )
						self.__dispatchersMenu.append( [ x.getName() for x in self.__dispatchers ] )
						self.__dispatchersMenu.setSelection( [ self.__dispatchers[0].getName() ] )
						self.__dispatchersMenuChanged = self.__dispatchersMenu.selectionChangedSignal().connect( Gaffer.WeakMethod( self.__dispatcherChanged ) )
						dispatcherMenuColumn.setVisible( len(self.__dispatchers) > 1 )

					self.__dispatcherFrame = GafferUI.Frame( borderStyle=GafferUI.Frame.BorderStyle.None, borderWidth=0 )
					self.__tabs.setLabel( dispatcherTab, "Dispatcher" )

				with GafferUI.Frame( borderStyle=GafferUI.Frame.BorderStyle.None, borderWidth=4 ) as contextTab :
					GafferUI.PlugValueWidget.create( self.__script["variables"] )
					self.__tabs.setLabel( contextTab, "Context Variables" )
示例#10
0
    def __init__(self, **kw):

        GafferUI.Window.__init__(self, **kw)

        self.__dispatcher = Gaffer.Dispatcher.dispatcher("Local")
        self.__nodes = []

        with self:

            with GafferUI.ListContainer(
                    orientation=GafferUI.ListContainer.Orientation.Vertical,
                    spacing=2,
                    borderWidth=4):

                with GafferUI.ListContainer(
                        GafferUI.ListContainer.Orientation.Horizontal,
                        spacing=4):
                    GafferUI.Label("Dispatcher")
                    dispatchersMenu = GafferUI.MultiSelectionMenu(
                        allowMultipleSelection=False,
                        allowEmptySelection=False)
                    dispatchersMenu.append(Gaffer.Dispatcher.dispatcherNames())
                    dispatchersMenu.setSelection(["Local"])
                    self.__dispatchersMenuSelectionChangedConnection = dispatchersMenu.selectionChangedSignal(
                    ).connect(Gaffer.WeakMethod(self.__dispatcherChanged))

                self.__frame = GafferUI.Frame(
                    borderStyle=GafferUI.Frame.BorderStyle.None, borderWidth=0)
                self.__dispatchButton = GafferUI.Button("Dispatch")
                self.__dispatchClickedConnection = self.__dispatchButton.clickedSignal(
                ).connect(Gaffer.WeakMethod(self.__dispatchClicked))

        self.__update()
示例#11
0
    def __init__(self, scriptNode, **kw):

        column = GafferUI.ListContainer()

        GafferUI.NodeSetEditor.__init__(self, column, scriptNode, **kw)

        self.__uvView = GafferSceneUI.UVView()

        with column:

            with GafferUI.Frame(borderWidth=4,
                                borderStyle=GafferUI.Frame.BorderStyle.None):
                toolbar = GafferUI.NodeToolbar.create(self.__uvView)

            self.__gadgetWidget = GafferUI.GadgetWidget(bufferOptions={
                GafferUI.GLWidget.BufferOptions.Double,
                GafferUI.GLWidget.BufferOptions.AntiAlias
            }, )

            Gaffer.NodeAlgo.applyUserDefaults(self.__uvView)
            self.__uvView.setContext(self.getContext())

            self.__gadgetWidget.setViewportGadget(
                self.__uvView.viewportGadget())
            self.__gadgetWidget.getViewportGadget().frame(
                imath.Box3f(imath.V3f(0, 0, 0), imath.V3f(1, 1, 0)))

        self.keyPressSignal().connect(Gaffer.WeakMethod(self.__keyPress),
                                      scoped=False)

        self._updateFromSet()
示例#12
0
	def __init__( self, path, previewTypes=[], allowMultipleSelection=False, **kw ) :
	
		self.__column = GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Vertical, spacing=8 )
		
		GafferUI.Widget.__init__( self, self.__column, **kw )
		
		# we use this temporary path for our child widgets while constructing, and then call
		# self.setPath() to replace it with the real thing. this lets us avoid duplicating the
		# logic we need in setPath().
		tmpPath = Gaffer.DictPath( {}, "/" )
		with self.__column :
		
			# row for manipulating current directory
			with GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Horizontal, spacing = 0 ) :
				
				self.__displayModeButton = GafferUI.Button( image = "pathListingTree.png", hasFrame=False )
				self.__displayModeButton.setToolTip( "Toggle between list and tree views" )
				self.__displayModeButtonClickedConnection = self.__displayModeButton.clickedSignal().connect( Gaffer.WeakMethod( self.__displayModeButtonClicked ) )
				
				reloadButton = GafferUI.Button( image = "refresh.png", hasFrame=False )
				reloadButton.setToolTip( "Refresh view" )
				self.__reloadButtonClickedConnection = reloadButton.clickedSignal().connect( Gaffer.WeakMethod( self.__reloadButtonClicked ) )
				
				upButton = GafferUI.Button( image = "pathUpArrow.png", hasFrame=False )
				upButton.setToolTip( "Up one level" )
				self.__upButtonClickedConnection = upButton.clickedSignal().connect( Gaffer.WeakMethod( self.__upButtonClicked ) )
				
				GafferUI.Spacer( IECore.V2i( 4, 4 ) )
				
				self.__dirPathWidget = GafferUI.PathWidget( tmpPath )
			
			# directory listing and preview widget
			with GafferUI.SplitContainer( GafferUI.SplitContainer.Orientation.Horizontal, expand=True ) as splitContainer :
			
				self.__directoryListing = GafferUI.PathListingWidget( tmpPath, allowMultipleSelection=allowMultipleSelection )
				self.__displayModeChangedConnection = self.__directoryListing.displayModeChangedSignal().connect( Gaffer.WeakMethod( self.__displayModeChanged ) )
				if len( previewTypes ) :
					self.__previewWidget = GafferUI.CompoundPathPreview( tmpPath, childTypes=previewTypes )
				else :
					self.__previewWidget = None
				
			if len( splitContainer ) > 1 :
				splitContainer.setSizes( [ 2, 1 ] ) # give priority to the listing over the preview
		
			# filter section
			self.__filterFrame = GafferUI.Frame( borderWidth=0, borderStyle=GafferUI.Frame.BorderStyle.None )
			self.__filter = None
				
			# path
			self.__pathWidget = GafferUI.PathWidget( tmpPath )
			self.__pathWidget.setVisible( allowMultipleSelection == False )
		
		self.__pathSelectedSignal = GafferUI.WidgetSignal()

		self.__listingSelectionChangedConnection = self.__directoryListing.selectionChangedSignal().connect( Gaffer.WeakMethod( self.__listingSelectionChanged ) )
		self.__listingSelectedConnection = self.__directoryListing.pathSelectedSignal().connect( Gaffer.WeakMethod( self.__pathSelected ) )
		self.__pathWidgetSelectedConnection = self.__pathWidget.activatedSignal().connect( Gaffer.WeakMethod( self.__pathSelected ) )
			
		self.__path = None
		self.setPath( path )
示例#13
0
    def testBorderStyle(self):

        f = GafferUI.Frame()
        self.assertEqual(f.getBorderStyle(), GafferUI.Frame.BorderStyle.Flat)

        f.setBorderStyle(GafferUI.Frame.BorderStyle.None)
        self.assertEqual(f.getBorderStyle(), GafferUI.Frame.BorderStyle.None)
示例#14
0
	def __init__( self, opInstance, title=None, sizeMode=GafferUI.Window.SizeMode.Manual, **kw ) :

		if title is None :
			title = IECore.CamelCase.toSpaced( opInstance.typeName() )

		GafferUI.Dialogue.__init__( self, title, sizeMode=sizeMode, **kw )
		
		self.__node = Gaffer.ParameterisedHolderNode()
		self.__node.setParameterised( opInstance )

		frame = GafferUI.Frame()
		frame.setChild( GafferUI.NodeUI.create( self.__node ) )
		
		self._setWidget( frame )
		
		self.__cancelButton = self._addButton( "Cancel" )
		self.__cancelButtonConnection = self.__cancelButton.clickedSignal().connect( Gaffer.WeakMethod( self.__buttonClicked ) )
		
		executeLabel = "OK"
		with IECore.IgnoredExceptions( KeyError ) :
			executeLabel = opInstance.userData()["UI"]["buttonLabel"].value
		self.__executeButton = self._addButton( executeLabel )
		self.__executeButtonConnection = self.__executeButton.clickedSignal().connect( Gaffer.WeakMethod( self.__buttonClicked ) )
		
		self.__opExecutedSignal = Gaffer.Signal1()
示例#15
0
    def __init__(self,
                 title,
                 borderWidth=8,
                 resizeable=None,
                 sizeMode=GafferUI.Window.SizeMode.Manual,
                 **kw):

        GafferUI.Window.__init__(self,
                                 title,
                                 borderWidth,
                                 resizeable,
                                 sizeMode=sizeMode,
                                 **kw)

        self._qtWidget().setWindowFlags(QtCore.Qt.WindowFlags(
            QtCore.Qt.Dialog))

        self.__column = GafferUI.ListContainer(
            GafferUI.ListContainer.Orientation.Vertical, spacing=8)

        self.__column.append(GafferUI.Frame(), True)

        self.__buttonRow = GafferUI.ListContainer(
            GafferUI.ListContainer.Orientation.Horizontal, spacing=8)
        self.__column.append(self.__buttonRow)

        self.setChild(self.__column)
示例#16
0
	def _updateFromSet( self ) :

		GafferUI.NodeSetEditor._updateFromSet( self )

		del self.__column[:]
		self.__nodeUI = None
		self.__nameWidget = None

		node = self._lastAddedNode()
		if not node :
			with self.__column :
				GafferUI.Spacer( imath.V2i( 0 ) )
			return

		with self.__column :
			with GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Horizontal, borderWidth=8, spacing=4 ) :

				GafferUI.Label( "<h4>Node Name</h4>" )
				self.__nameWidget = GafferUI.NameWidget( node )
				## \todo Make NameWidget support the readOnly metadata internally itself.
				# We can't do that easily right now, because it would need to be managing
				# the exact same `setEditable()` call that we're using here to propagate
				# our Widget readonlyness. Really our Widget readonlyness mechanism is a
				# bit lacking, and it should really be inherited automatically so we don't
				# have to propagate it like this.
				self.__nameWidget.setEditable( not self.getReadOnly() and not Gaffer.MetadataAlgo.readOnly( node ) )

				with GafferUI.ListContainer(
					GafferUI.ListContainer.Orientation.Horizontal,
					spacing=4,
					parenting = { "horizontalAlignment" : GafferUI.HorizontalAlignment.Right },
				) as infoSection :

					GafferUI.Label( "<h4>" + node.typeName().rpartition( ":" )[-1] + "</h4>" )

					button = GafferUI.Button( image = "info.png", hasFrame = False )
					url = Gaffer.Metadata.value( node, "documentation:url" )
					if url :
						button.clickedSignal().connect(
							lambda button : GafferUI.showURL( url ),
							scoped = False
						)

				toolTip = "<h3>" + node.typeName().rpartition( ":" )[2] + "</h3>"
				description = Gaffer.Metadata.value( node, "description" )
				if description :
					toolTip += "\n\n" + description
				infoSection.setToolTip( toolTip )

				GafferUI.MenuButton(
					image = "gear.png",
					hasFrame = False,
					menu = GafferUI.Menu( Gaffer.WeakMethod( self.__menuDefinition ) )
				)

		frame = GafferUI.Frame( borderStyle=GafferUI.Frame.BorderStyle.None, borderWidth=0 )
		self.__column.append( frame, expand=True )
		self.__nodeUI = GafferUI.NodeUI.create( node )
		self.__nodeUI.setReadOnly( self.getReadOnly() )
		frame.setChild( self.__nodeUI )
示例#17
0
	def __init__( self, **kw ) :

		GafferUI.Window.__init__( self, **kw )

		self.__dispatchers = {}
		for dispatcherType in GafferDispatch.Dispatcher.registeredDispatchers() :
			dispatcher = GafferDispatch.Dispatcher.create( dispatcherType )
			Gaffer.NodeAlgo.applyUserDefaults( dispatcher )
			self.__dispatchers[dispatcherType] = dispatcher

		defaultType = GafferDispatch.Dispatcher.getDefaultDispatcherType()
		self.__currentDispatcher = self.__dispatchers[ defaultType ]
		self.__nodes = []

		with self :

			with GafferUI.ListContainer( orientation = GafferUI.ListContainer.Orientation.Vertical, spacing = 2, borderWidth = 6 ) :

				with GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Horizontal, spacing = 4 ) :
					GafferUI.Label( "Dispatcher" )
					self.__dispatchersMenu = GafferUI.MultiSelectionMenu( allowMultipleSelection = False, allowEmptySelection = False )
					self.__dispatchersMenu.append( self.__dispatchers.keys() )
					self.__dispatchersMenu.setSelection( [ defaultType ] )
					self.__dispatchersMenu.selectionChangedSignal().connect( Gaffer.WeakMethod( self.__dispatcherChanged ), scoped = False )

				self.__frame = GafferUI.Frame( borderStyle=GafferUI.Frame.BorderStyle.None, borderWidth=0 )
				self.__dispatchButton = GafferUI.Button( "Dispatch" )
				self.__dispatchButton.clickedSignal().connect( Gaffer.WeakMethod( self.__dispatchClicked ), scoped = False )

		self.__update( resizeToFit = True )
示例#18
0
    def _updateFromSet(self):

        GafferUI.NodeSetEditor._updateFromSet(self)

        del self.__column[:]

        node = self._lastAddedNode()
        if not node:
            return

        with self.__column:
            with GafferUI.ListContainer(
                    GafferUI.ListContainer.Orientation.Horizontal,
                    borderWidth=8,
                    spacing=4):
                GafferUI.Label("<h4>Node Name</h4>")
                GafferUI.NameWidget(node)
                with GafferUI.ListContainer(
                        GafferUI.ListContainer.Orientation.Horizontal,
                        spacing=4) as infoSection:
                    GafferUI.Label("<h4>" +
                                   node.typeName().rpartition(":")[-1] +
                                   "</h4>")
                    GafferUI.Image("info.png")
                toolTip = "<h3>" + node.typeName().rpartition(":")[2] + "</h3>"
                description = GafferUI.Metadata.nodeDescription(node)
                if description:
                    toolTip += "\n\n" + description
                infoSection.setToolTip(toolTip)

        frame = GafferUI.Frame(borderStyle=GafferUI.Frame.BorderStyle.None,
                               borderWidth=0)
        self.__column.append(frame, expand=True)
        frame.setChild(GafferUI.NodeUI.create(node))
示例#19
0
    def __init__(self, plug, **kw):

        self.__frame = GafferUI.Frame(borderWidth=2)

        GafferUI.PlugValueWidget.__init__(self, self.__frame, plug, **kw)

        self.__inputLabel = GafferUI.NameLabel(
            None,
            horizontalAlignment=GafferUI.HorizontalAlignment.Center,
            formatter=self.__labelFormatter,
            numComponents=2,
        )

        row = GafferUI.ListContainer(
            GafferUI.ListContainer.Orientation.Horizontal)
        row.append(self.__inputLabel,
                   horizontalAlignment=GafferUI.HorizontalAlignment.Center,
                   expand=True)
        self.__frame.setChild(row)

        self.__connections = [
            self.__frame.buttonReleaseSignal().connect(
                Gaffer.WeakMethod(self.__buttonRelease)),
            self.__inputLabel.buttonReleaseSignal().connect(
                Gaffer.WeakMethod(self.__buttonRelease)),
            self.__frame.enterSignal().connect(
                IECore.curry(GafferUI.Frame.setHighlighted, highlighted=True)),
            self.__frame.leaveSignal().connect(
                IECore.curry(GafferUI.Frame.setHighlighted,
                             highlighted=False)),
        ]

        self._addPopupMenu(self.__frame)

        self._updateFromPlug()
示例#20
0
	def testSetSizes( self ) :

		c = GafferUI.SplitContainer()

		c.append( GafferUI.Frame() )
		c.append( GafferUI.Frame() )

		c.setVisible( True )
		originalSize = c.size()

		c.setSizes( [ 0.25, 0.75 ] )

		self.assertEqual( c.size(), originalSize )
		self.assertEqual( sum( c.getSizes() ) + c.handle( 0 ).size().y, originalSize.y )

		s = c.getSizes()
		self.assertAlmostEqual( float( s[0] ) / s[1], 1/3.0, 1 )
示例#21
0
	def __showSettings( self, menu ) :

		if self.__settingsWindow is None :

			self.__settingsWindow = GafferUI.Window( title = "Camera Settings" )
			with self.__settingsWindow :
				with GafferUI.ListContainer() :
					with GafferUI.Frame( borderStyle = GafferUI.Frame.BorderStyle.None, borderWidth = 4 ) :
						layout = GafferUI.PlugLayout( self.getPlug() )
					GafferUI.Spacer( imath.V2i( 0 ), parenting = { "expand" : True } )
示例#22
0
    def testRemoveChild(self):

        f = GafferUI.Frame()
        b = GafferUI.Button()

        f.setChild(b)
        self.assertTrue(b.parent() is f)

        f.removeChild(b)
        self.assertIsNone(b.parent())
示例#23
0
    def testRemoveChild(self):

        f = GafferUI.Frame()
        b = GafferUI.Button()

        f.setChild(b)
        self.failUnless(b.parent() is f)

        f.removeChild(b)
        self.failUnless(b.parent() is None)
示例#24
0
    def __init__(self, scriptNode, **kw):

        self.__gadgetWidget = GafferUI.GadgetWidget(bufferOptions=set(
            (GafferUI.GLWidget.BufferOptions.Depth,
             GafferUI.GLWidget.BufferOptions.Double)), )

        GafferUI.NodeSetEditor.__init__(self, self.__gadgetWidget, scriptNode,
                                        **kw)

        with GafferUI.ListContainer(borderWidth=2, spacing=2) as toolbarColumn:
            self.__nodeToolbarFrame = GafferUI.Frame(
                borderWidth=0, borderStyle=GafferUI.Frame.BorderStyle.None)
            self.__toolbarFrame = GafferUI.Frame(
                borderWidth=0, borderStyle=GafferUI.Frame.BorderStyle.None)
        self.__gadgetWidget.addOverlay(toolbarColumn)

        self.__views = []
        self.__currentView = None

        self._updateFromSet()
示例#25
0
    def _updateFromSet(self):

        GafferUI.NodeSetEditor._updateFromSet(self)

        del self.__column[:]
        self.__nodeUI = None
        self.__nameWidget = None

        node = self._lastAddedNode()
        if not node:
            return

        with self.__column:
            with GafferUI.ListContainer(
                    GafferUI.ListContainer.Orientation.Horizontal,
                    borderWidth=8,
                    spacing=4):

                GafferUI.Label("<h4>Node Name</h4>")
                self.__nameWidget = GafferUI.NameWidget(node)
                self.__nameWidget.setEditable(not self.getReadOnly())

                with GafferUI.ListContainer(
                        GafferUI.ListContainer.Orientation.Horizontal,
                        spacing=4) as infoSection:

                    GafferUI.Label("<h4>" +
                                   node.typeName().rpartition(":")[-1] +
                                   "</h4>")

                    button = GafferUI.Button(image="info.png", hasFrame=False)
                    url = Gaffer.Metadata.nodeValue(node, "documentation:url")
                    if url:
                        button.clickedSignal().connect(
                            lambda button: GafferUI.showURL(url), scoped=False)

                toolTip = "<h3>" + node.typeName().rpartition(":")[2] + "</h3>"
                description = Gaffer.Metadata.nodeDescription(node)
                if description:
                    toolTip += "\n\n" + description
                infoSection.setToolTip(toolTip)

                GafferUI.MenuButton(image="gear.png",
                                    hasFrame=False,
                                    menu=GafferUI.Menu(
                                        Gaffer.WeakMethod(
                                            self.__menuDefinition)))

        frame = GafferUI.Frame(borderStyle=GafferUI.Frame.BorderStyle.None,
                               borderWidth=0)
        self.__column.append(frame, expand=True)
        self.__nodeUI = GafferUI.NodeUI.create(node)
        self.__nodeUI.setReadOnly(self.getReadOnly())
        frame.setChild(self.__nodeUI)
示例#26
0
	def __init__( self, borderWidth = 4, alternate = False, **kw ) :
		
		self.__frame = GafferUI.Frame( borderWidth = borderWidth )
	
		GafferUI.Widget.__init__( self, self.__frame, **kw )

		self.__frame.setChild(
			 GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Horizontal, spacing = 4 )
		)
		
		self.setAlternate( alternate )
示例#27
0
    def __init__(self, scriptNode, **kw):

        self.__column = GafferUI.ListContainer(
            GafferUI.ListContainer.Orientation.Vertical)

        GafferUI.NodeSetEditor.__init__(self, self.__column, scriptNode, **kw)

        with self.__column:

            with GafferUI.ListContainer(
                    GafferUI.ListContainer.Orientation.Horizontal,
                    borderWidth=8,
                    spacing=4) as self.__header:

                # NameLabel with a fixed formatter, to be used as a drag source.
                self.__nameLabel = GafferUI.NameLabel(
                    None,
                    formatter=lambda graphComponents: "<h4>Node Name</h4>")
                # NameWidget to allow editing of the name.
                self.__nameWidget = GafferUI.NameWidget(None)

                with GafferUI.ListContainer(
                        GafferUI.ListContainer.Orientation.Horizontal,
                        spacing=4,
                        parenting={
                            "horizontalAlignment":
                            GafferUI.HorizontalAlignment.Right
                        },
                ) as self.__infoSection:

                    self.__typeLabel = GafferUI.Label()

                    infoButton = GafferUI.Button(image="info.png",
                                                 hasFrame=False)
                    infoButton.clickedSignal().connect(Gaffer.WeakMethod(
                        self.__infoButtonClicked),
                                                       scoped=False)

                GafferUI.MenuButton(image="gear.png",
                                    hasFrame=False,
                                    menu=GafferUI.Menu(
                                        Gaffer.WeakMethod(
                                            self.__menuDefinition)))

            self.__nodeUIFrame = GafferUI.Frame(
                borderStyle=GafferUI.Frame.BorderStyle.None_,
                borderWidth=0,
                parenting={"expand": True})

        self.__nodeUI = None
        self.__readOnly = False

        self._updateFromSet()
	def __init__( self, shaderView ) :

		GafferUI.Window.__init__( self, "ShaderView Settings" )

		with self :
			with GafferUI.ListContainer() :
				self.__frame = GafferUI.Frame( borderStyle = GafferUI.Frame.BorderStyle.None_, borderWidth = 4 )
				GafferUI.Spacer( imath.V2i( 0 ), parenting = { "expand" : True } )

		self.__shaderView = shaderView
		shaderView.sceneChangedSignal().connect( Gaffer.WeakMethod( self.__sceneChanged ), scoped = False )
		self.__updateNodeUI()
示例#29
0
    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:

            GafferUI.LayoutPlugValueWidget(plug)
示例#30
0
    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))