コード例 #1
0
ファイル: UVInspector.py プロジェクト: whitemoonstone/gaffer
    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()
コード例 #2
0
ファイル: InstancerUI.py プロジェクト: themissingcow/gaffer
    def __init__(self, plug, overrideName=None):

        self.__row = GafferUI.ListContainer(
            GafferUI.ListContainer.Orientation.Horizontal, spacing=4)

        GafferUI.PlugValueWidget.__init__(self, self.__row, plug)

        with self.__row:
            GafferUI.StringPlugValueWidget(
                self.getPlug()["name"]).textWidget()._qtWidget().setFixedWidth(
                    GafferUI.PlugWidget.labelWidth())

            GafferUI.BoolPlugValueWidget(
                self.getPlug()["enabled"],
                displayMode=GafferUI.BoolWidget.DisplayMode.Switch)

            GafferUI.PlugValueWidget.create(self.getPlug()["quantize"])
            toolTipPrefix = "Number of unique values of this context variable, which contribute to the total number of evaluations of the `prototypes` scene."
            if overrideName:
                _VariationsPlugValueWidget(self.getPlug().node()["variations"],
                                           overrideName, "", toolTipPrefix)
            else:
                _VariationsPlugValueWidget(self.getPlug().node()["variations"],
                                           self.getPlug()["name"], "",
                                           toolTipPrefix)

        self._updateFromPlugs()
コード例 #3
0
ファイル: CompoundEditor.py プロジェクト: adamearle/gaffer
    def __init__(self, cornerWidget=None, **kw):

        GafferUI.TabbedContainer.__init__(self, cornerWidget, **kw)

        with GafferUI.ListContainer(
                GafferUI.ListContainer.Orientation.Horizontal,
                spacing=2,
                borderWidth=1) as cornerWidget:

            self.__pinningButton = GafferUI.Button(
                image="targetNodesUnlocked.png", hasFrame=False)

            layoutButton = GafferUI.MenuButton(image="layoutButton.png",
                                               hasFrame=False)
            layoutButton.setMenu(
                GafferUI.Menu(Gaffer.WeakMethod(self.__layoutMenuDefinition)))
            layoutButton.setToolTip("Click to modify the layout")

        self.setCornerWidget(cornerWidget)

        self.__pinningButtonClickedConnection = self.__pinningButton.clickedSignal(
        ).connect(Gaffer.WeakMethod(self.__pinningButtonClicked))
        self.__currentTabChangedConnection = self.currentChangedSignal(
        ).connect(Gaffer.WeakMethod(self.__currentTabChanged))
        self.__dragEnterConnection = self.dragEnterSignal().connect(
            Gaffer.WeakMethod(self.__dragEnter))
        self.__dragLeaveConnection = self.dragLeaveSignal().connect(
            Gaffer.WeakMethod(self.__dragLeave))
        self.__dropConnection = self.dropSignal().connect(
            Gaffer.WeakMethod(self.__drop))
コード例 #4
0
    def __sectionColumn(self, sectionName):

        sectionColumn = self.__sectionColumns.get(sectionName, None)
        if sectionColumn is None:

            sectionColumn = GafferUI.ListContainer(
                GafferUI.ListContainer.Orientation.Vertical, spacing=4)

            if self.__displayMode == self.DisplayMode.Bare:
                sectionContainer = sectionColumn
            else:
                sectionContainer = GafferUI.ScrolledContainer(
                    horizontalMode=GafferUI.ScrolledContainer.ScrollMode.Never,
                    borderWidth=8)
                sectionContainer.setChild(sectionColumn)

            if self.__displayMode == self.DisplayMode.Tabbed:
                newTabIndex = 0
                if len(self.__tabbedContainer
                       ) and self.__tabbedContainer.getLabel(
                           self.__tabbedContainer[0]
                       ) == self.__defaultSectionName:
                    # make sure the default tab always comes first
                    newTabIndex = 1
                self.__tabbedContainer.insert(newTabIndex,
                                              sectionContainer,
                                              label=sectionName)
            else:
                self.__mainColumn.append(sectionContainer, expand=True)

            self.__sectionColumns[sectionName] = sectionColumn

        return sectionColumn
コード例 #5
0
ファイル: ScriptWindow.py プロジェクト: ljkart/gaffer
    def __init__(self, script, **kw):

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

        self.__script = script

        self.__listContainer = GafferUI.ListContainer(
            GafferUI.ListContainer.Orientation.Vertical, spacing=2)

        menuDefinition = self.menuDefinition(script.applicationRoot(
        )) if script.applicationRoot() else IECore.MenuDefinition()
        self.__listContainer.append(GafferUI.MenuBar(menuDefinition))

        applicationRoot = self.__script.ancestor(Gaffer.ApplicationRoot)
        layouts = GafferUI.Layouts.acquire(
            applicationRoot) if applicationRoot is not None else None
        if layouts is not None and "Default" in layouts.names():
            self.setLayout(layouts.create("Default", script))
        else:
            self.setLayout(GafferUI.CompoundEditor(script))

        self.setChild(self.__listContainer)

        self.__closedConnection = self.closedSignal().connect(
            Gaffer.WeakMethod(self.__closed))

        self.__scriptPlugSetConnection = script.plugSetSignal().connect(
            Gaffer.WeakMethod(self.__scriptPlugChanged))

        self.__updateTitle()

        ScriptWindow.__instances.append(weakref.ref(self))
コード例 #6
0
    def __init__(self, plug):

        row = GafferUI.ListContainer(
            GafferUI.ListContainer.Orientation.Horizontal)

        GafferUI.PlugValueWidget.__init__(self, row, plug)

        with row:

            GafferUI.Spacer(IECore.V2i(GafferUI.PlugWidget.labelWidth(), 1))

            menuButton = GafferUI.MenuButton(
                image="plus.png",
                hasFrame=False,
                menu=GafferUI.Menu(Gaffer.WeakMethod(self.__menuDefinition),
                                   title="Add " +
                                   ("Input" if plug.direction()
                                    == plug.Direction.In else "Output")),
                toolTip="Add " + ("Input" if plug.direction()
                                  == plug.Direction.In else "Output"),
            )
            menuButton.setEnabled(not Gaffer.MetadataAlgo.readOnly(plug))

            GafferUI.Spacer(IECore.V2i(1),
                            IECore.V2i(999999, 1),
                            parenting={"expand": True})
コード例 #7
0
	def __init__( self, pathFilter, **kw ) :

		self.__row = GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Horizontal, spacing=2, borderWidth=0 )

		GafferUI.PathFilterWidget.__init__( self, self.__row, pathFilter, **kw )

		with self.__row :

			self.__enabledWidget = GafferUI.BoolWidget()
			self.__enabledStateChangedConnection = self.__enabledWidget.stateChangedSignal().connect( Gaffer.WeakMethod( self.__enabledStateChanged ) )

			self.__propertyButton = GafferUI.MenuButton(
				image = "collapsibleArrowDown.png",
				hasFrame = False,
				menu = GafferUI.Menu( Gaffer.WeakMethod( self.__propertyMenuDefinition ) ),
			)

			self.__patternWidget = GafferUI.TextWidget()

			if hasattr( self.__patternWidget._qtWidget(), "setPlaceholderText" ) :
				# setPlaceHolderText appeared in qt 4.7, nuke (6.3 at time of writing) is stuck on 4.6.
				self.__patternWidget._qtWidget().setPlaceholderText( "Filter..." )

			self.__patternEditingFinishedConnection = self.__patternWidget.editingFinishedSignal().connect( Gaffer.WeakMethod( self.__patternEditingFinished ) )
			self.__patternTextChangedConnection = self.__patternWidget.textChangedSignal().connect( Gaffer.WeakMethod( self.__patternTextChanged ) )

		self._updateFromPathFilter()
コード例 #8
0
    def __init__(self, node):

        self.__node = node
        self.__row = GafferUI.ListContainer(
            GafferUI.ListContainer.Orientation.Horizontal)

        GafferUI.Widget.__init__(self, self.__row)

        with self.__row:

            GafferUI.Spacer(imath.V2i(GafferUI.PlugWidget.labelWidth(), 1))

            menuButton = GafferUI.Button(image="plus.png", hasFrame=False)
            menuButton.clickedSignal().connect(Gaffer.WeakMethod(
                self.__showMenu),
                                               scoped=False)

            GafferUI.Spacer(imath.V2i(1),
                            imath.V2i(999999, 1),
                            parenting={"expand": True})

        node.childAddedSignal().connect(Gaffer.WeakMethod(
            self.__updateVisibility),
                                        scoped=False)
        node.childRemovedSignal().connect(Gaffer.WeakMethod(
            self.__updateVisibility),
                                          scoped=False)

        self.__updateVisibility()
コード例 #9
0
ファイル: PlugLayout.py プロジェクト: yarwelp/gaffer
    def __init__(self, orientation, **kw):

        self.__column = GafferUI.ListContainer(orientation, spacing=4)

        _Layout.__init__(self, self.__column, orientation, **kw)

        self.__collapsibles = {}  # Indexed by section name
コード例 #10
0
    def __init__(self, plug, **kw):

        row = GafferUI.ListContainer(
            GafferUI.ListContainer.Orientation.Horizontal, spacing=2)

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

        self.__imagePrefix = Gaffer.Metadata.value(
            plug, "togglePlugValueWidget:imagePrefix")
        with row:

            self.__button = GafferUI.Button("",
                                            self.__imagePrefix + "Off.png",
                                            hasFrame=False)
            self.__button.clickedSignal().connect(Gaffer.WeakMethod(
                self.__clicked),
                                                  scoped=False)

            if not isinstance(plug, Gaffer.BoolPlug):
                plugValueWidget = GafferUI.PlugValueWidget.create(
                    plug, useTypeOnly=True)
                plugValueWidget.numericWidget().setFixedCharacterWidth(5)

        self.__toggleValue = Gaffer.Metadata.value(
            plug, "togglePlugValueWidget:defaultToggleValue")
        self._updateFromPlug()
コード例 #11
0
    def __init__(self, plug):

        self.__row = GafferUI.ListContainer(
            GafferUI.ListContainer.Orientation.Horizontal, spacing=4)

        GafferUI.PlugValueWidget.__init__(self, self.__row, plug)

        nameWidget = GafferUI.StringPlugValueWidget(plug["name"])
        nameWidget.textWidget()._qtWidget().setFixedWidth(
            GafferUI.PlugWidget.labelWidth())

        self.__row.append(
            nameWidget, verticalAlignment=GafferUI.Label.VerticalAlignment.Top)

        self.__row.append(
            GafferUI.BoolPlugValueWidget(
                plug["enabled"],
                displayMode=GafferUI.BoolWidget.DisplayMode.Switch),
            verticalAlignment=GafferUI.Label.VerticalAlignment.Top,
        )

        modeWidget = GafferUI.PlugValueWidget.create(plug["mode"])
        modeWidget._qtWidget().setFixedWidth(80)
        modeWidget._qtWidget().layout().setSizeConstraint(
            QtWidgets.QLayout.SetDefaultConstraint)
        self.__row.append(modeWidget)

        self.__row.append(GafferUI.PlugValueWidget.create(plug["value"]),
                          expand=True)

        self._updateFromPlug()
コード例 #12
0
    def __init__(self, path):

        tmpPath = Gaffer.DictPath(
            {}, "/")  # empty path we can use till we get an indexed io file
        with GafferUI.ListContainer(borderWidth=8, spacing=8) as column:

            self.__pathWidget = GafferUI.PathWidget(tmpPath)

            with GafferUI.SplitContainer(
                    GafferUI.SplitContainer.Orientation.Horizontal):

                self.__pathListing = GafferUI.PathListingWidget(
                    tmpPath,
                    columns=[
                        GafferUI.PathListingWidget.defaultNameColumn,
                        GafferUI.PathListingWidget.
                        defaultIndexedIODataTypeColumn,
                    ],
                    displayMode=GafferUI.PathListingWidget.DisplayMode.Tree,
                )

                self.__pathPreview = GafferUI.DataPathPreview(tmpPath)

        GafferUI.DeferredPathPreview.__init__(self, column, path)

        self.__prevPath = tmpPath
        self._updateFromPath()
コード例 #13
0
    def __init__(self, childPlug):

        self.__row = GafferUI.ListContainer(
            GafferUI.ListContainer.Orientation.Horizontal, spacing=4)

        GafferUI.PlugValueWidget.__init__(self, self.__row, childPlug)

        ## \todo We should support no plugs here. Move the UI configuration into setPlugs
        assert (len(self.getPlugs()) > 0)

        # We use a non-editable label for the name for non-dynamic plugs, or any that request it

        anyStatic = any([
            not p.getFlags(Gaffer.Plug.Flags.Dynamic) for p in self.getPlugs()
        ])
        anyIgnoreName = any([
            Gaffer.Metadata.value(
                p, "nameValuePlugPlugValueWidget:ignoreNamePlug")
            for p in self.getPlugs()
        ])

        if anyStatic or anyIgnoreName:
            nameWidget = GafferUI.LabelPlugValueWidget(
                self.getPlugs(),
                horizontalAlignment=GafferUI.Label.HorizontalAlignment.Right,
                verticalAlignment=GafferUI.Label.VerticalAlignment.Center,
            )
            nameWidget.label()._qtWidget().setFixedWidth(
                GafferUI.PlugWidget.labelWidth())
            # cheat to get the height of the label to match the height of a line edit
            # so the label and plug widgets align nicely. ideally we'd get the stylesheet
            # sorted for the QLabel so that that happened naturally, but QLabel sizing appears
            # somewhat unpredictable (and is sensitive to HTML in the text as well), making this
            # a tricky task.
            nameWidget.label()._qtWidget().setFixedHeight(20)
        else:
            nameWidget = GafferUI.StringPlugValueWidget(
                {plug["name"]
                 for plug in self.getPlugs()})
            nameWidget.textWidget()._qtWidget().setFixedWidth(
                GafferUI.PlugWidget.labelWidth())

        self.__row.append(
            nameWidget, verticalAlignment=GafferUI.Label.VerticalAlignment.Top)

        if all(["enabled" in plug for plug in self.getPlugs()]):
            self.__row.append(
                GafferUI.BoolPlugValueWidget(
                    {plug["enabled"]
                     for plug in self.getPlugs()},
                    displayMode=GafferUI.BoolWidget.DisplayMode.Switch),
                verticalAlignment=GafferUI.Label.VerticalAlignment.Top,
            )

        self.__row.append(GafferUI.PlugValueWidget.create(
            {plug["value"]
             for plug in self.getPlugs()}),
                          expand=True)

        self._updateFromPlugs()
コード例 #14
0
    def __init__(self, plug, *args, **kwargs):

        row = GafferUI.ListContainer(
            GafferUI.ListContainer.Orientation.Horizontal)
        GafferUI.PlugValueWidget.__init__(self, row, plug)

        with row:
            self.__startPauseButton = GafferUI.Button(image='renderStart.png',
                                                      highlightOnOver=False)
            self.__stopButton = GafferUI.Button(image='renderStop.png',
                                                highlightOnOver=False)

        GafferUI.WidgetAlgo.joinEdges(row)

        # Sadly unable to use setFixedWidth on row to take effect, regardless of size policies...
        self.__startPauseButton._qtWidget().setFixedWidth(25)
        self.__stopButton._qtWidget().setFixedWidth(25)
        # The button retaining focus causes problems when embedding in other UIs
        self.__startPauseButton._qtWidget().setFocusPolicy(QtCore.Qt.NoFocus)
        self.__stopButton._qtWidget().setFocusPolicy(QtCore.Qt.NoFocus)

        self.__startPauseButton.clickedSignal().connect(Gaffer.WeakMethod(
            self.__startPauseClicked),
                                                        scoped=False)
        self.__stopButton.clickedSignal().connect(Gaffer.WeakMethod(
            self.__stopClicked),
                                                  scoped=False)

        self.__stateIcons = {
            GafferScene.InteractiveRender.State.Running: 'renderPause.png',
            GafferScene.InteractiveRender.State.Paused: 'renderResume.png',
            GafferScene.InteractiveRender.State.Stopped: 'renderStart.png'
        }

        self._updateFromPlug()
コード例 #15
0
ファイル: RampPlugValueWidget.py プロジェクト: shdwdln/gaffer
    def __init__(self, plug, **kw):

        column = GafferUI.ListContainer(
            GafferUI.ListContainer.Orientation.Vertical, spacing=4)

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

        with column:
            with GafferUI.ListContainer(
                    GafferUI.ListContainer.Orientation.Horizontal, spacing=4):
                GafferUI.Spacer(IECore.V2i(0), parenting={"expand": True})
                GafferUI.LabelPlugValueWidget(plug["basis"],
                                              horizontalAlignment=GafferUI.
                                              Label.HorizontalAlignment.Right)
                GafferUI.SplineBasisPlugValueWidget(plug)

            self.__splineWidget = GafferUI.SplineWidget()
            self.__splineWidget.setDrawMode(self.__splineWidget.DrawMode.Ramp)
            self.__splineWidget._qtWidget().setMinimumHeight(50)

            self.__slider = GafferUI.Slider()
            self.__slider.setSizeEditable(True)
            self.__slider.setMinimumSize(2)
            self.__positionsChangedConnection = self.__slider.positionChangedSignal(
            ).connect(Gaffer.WeakMethod(self.__positionsChanged))
            self.__indexRemovedConnection = self.__slider.indexRemovedSignal(
            ).connect(Gaffer.WeakMethod(self.__indexRemoved))
            self.__selectedIndexChangedConnection = self.__slider.selectedIndexChangedSignal(
            ).connect(Gaffer.WeakMethod(self.__selectedIndexChanged))

            self.__lastPositionChangedReason = None
            self.__positionsMergeGroupId = 0

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

                self.__positionLabel = GafferUI.LabelPlugValueWidget(
                    plug.pointXPlug(0))
                self.__positionField = GafferUI.NumericPlugValueWidget(
                    plug.pointXPlug(0))

                self.__valueLabel = GafferUI.LabelPlugValueWidget(
                    plug.pointYPlug(0))
                self.__valueField = GafferUI.ColorPlugValueWidget(
                    plug.pointYPlug(0))

        self.setPlug(plug)
コード例 #16
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>")
                    GafferUI.Image("info.png")
                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)
コード例 #17
0
ファイル: SceneInspector.py プロジェクト: ljkart/gaffer
	def __init__( self, scriptNode, sections = None, **kw ) :
		
		mainColumn = GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Vertical, borderWidth = 8 )
		
		GafferUI.NodeSetEditor.__init__( self, mainColumn, scriptNode, **kw )
		
		self.__sections = []

		if sections is not None :
			
			for section in sections :
				mainColumn.append( section )
				self.__sections.append( section )

			mainColumn.append( GafferUI.Spacer( IECore.V2i( 0 ) ), expand = True )
			
		else :
		
			columns = {}
			with mainColumn :
				columns[None] = GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Vertical, spacing = 8 )
				tabbedContainer = GafferUI.TabbedContainer()
			
			for registration in self.__sectionRegistrations :
				section = registration.section()
				column = columns.get( registration.tab )
				if column is None :
					with tabbedContainer :
						with GafferUI.ScrolledContainer( horizontalMode = GafferUI.ScrolledContainer.ScrollMode.Never, parenting = { "label" : registration.tab } ) :
							column = GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Vertical, borderWidth = 4, spacing = 8 )
							columns[registration.tab] = column
				column.append( section )
				self.__sections.append( section )
		
			for tab, column in columns.items() :
				if tab is not None :
					column.append( GafferUI.Spacer( IECore.V2i( 0 ) ), expand = True )
		
		self.__visibilityChangedConnection = self.visibilityChangedSignal().connect( Gaffer.WeakMethod( self.__visibilityChanged ) )
		
		self.__pendingUpdate = False
		self.__targetPaths = None
		
		self.__playback = None
		self.__acquirePlayback()

		self._updateFromSet()
コード例 #18
0
    def testSliceSetItemAtEnd(self):

        c = GafferUI.ListContainer(GafferUI.ListContainer.Orientation.Vertical)
        c.append(TestWidget("a"))

        c[1:] = [TestWidget("b")]
        self.assertEqual(c[0].s, "a")
        self.assertEqual(c[1].s, "b")
コード例 #19
0
	def __init__( self, node, **kw ) :

		self.__row = GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Horizontal, spacing = 4 )

		GafferUI.NodeToolbar.__init__( self, node, self.__row, **kw )

		self.__row.append( GafferUI.Spacer( IECore.V2i( 1, 1 ) ), expand = True )
		self.__row.append( GafferUI.PlugLayout( node, orientation = GafferUI.ListContainer.Orientation.Horizontal ) )
コード例 #20
0
	def __init__( self, plug, **kw ) :

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

			GafferUI.PlugValueWidget.create( plug["mode"] )
			GafferUI.PlugValueWidget.create( plug["frame"] )

		GafferUI.PlugValueWidget.__init__( self, self.__row, plug, **kw )
コード例 #21
0
    def __init__(self, title):

        GafferUI.Window.__init__(self, title, borderWidth=8)

        with self:
            with GafferUI.ListContainer(
                    GafferUI.ListContainer.Orientation.Horizontal, spacing=4):
                with GafferUI.ListContainer(
                        GafferUI.ListContainer.Orientation.Vertical,
                        spacing=6):

                    buttonSpecs = [
                        (IECore.Msg.Level.Error,
                         "Errors. These may chill you to your very core. Click to scroll to the next one (if you can stomach it)."
                         ),
                        (IECore.Msg.Level.Warning,
                         "Warnings. These may give you pause for thought. Click to scroll to the next thinking point."
                         ),
                        (IECore.Msg.Level.Info,
                         "Information. You may find this edifying. Click to scroll to the next enlightening nugget."
                         ),
                        (IECore.Msg.Level.Debug,
                         "Debug information. You may find this very dull. Click to scroll to the next item."
                         ),
                    ]
                    self.__levelButtons = {}
                    self.__buttonClickedConnections = []
                    for buttonSpec in buttonSpecs:
                        button = GafferUI.Button(
                            image=IECore.Msg.levelAsString(
                                buttonSpec[0]).lower() + "Notification.png",
                            hasFrame=False,
                        )
                        button.__level = buttonSpec[0]
                        self.__levelButtons[buttonSpec[0]] = button
                        self.__buttonClickedConnections.append(
                            button.clickedSignal().connect(
                                Gaffer.WeakMethod(self.__buttonClicked)))
                        button.setVisible(False)
                        button.setToolTip(buttonSpec[1])

                    GafferUI.Spacer(IECore.V2i(10))

                self.__text = GafferUI.MultiLineTextWidget(editable=False)

        self.setResizeable(True)
コード例 #22
0
ファイル: WedgeUI.py プロジェクト: yarwelp/gaffer
	def __init__( self, node, **kw ) :

		self.__row = GafferUI.ListContainer( GafferUI.ListContainer.Orientation.Horizontal )
		self.__row._qtWidget().setFixedHeight( 100 )

		_ValuesPreview.__init__( self, self.__row, node, **kw )

		self._update()
コード例 #23
0
ファイル: NodeEditor.py プロジェクト: TRiGGER80/gaffer
    def __init__(self, scriptNode, **kw):

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

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

        self._updateFromSet()
コード例 #24
0
    def __init__(self, node, **kw):

        column = GafferUI.ListContainer(spacing=4)
        GafferUI.Widget.__init__(self, column, **kw)

        self.__node = node

        with column:

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

                GafferUI.Label("Language")
                self.__languageMenu = GafferUI.MenuButton(
                    "",
                    menu=GafferUI.Menu(
                        Gaffer.WeakMethod(self.__languageMenuDefinition)))
                self.__languageMenu.setEnabled(
                    not Gaffer.MetadataAlgo.readOnly(node))

            self.__textWidget = GafferUI.MultiLineTextWidget(
                role=GafferUI.MultiLineTextWidget.Role.Code)
            self.__textWidget.setEditable(
                not Gaffer.MetadataAlgo.readOnly(node))

            self.__textWidget.activatedSignal().connect(Gaffer.WeakMethod(
                self.__activated),
                                                        scoped=False)
            self.__textWidget.editingFinishedSignal().connect(
                Gaffer.WeakMethod(self.__editingFinished), scoped=False)
            self.__textWidget.dropTextSignal().connect(Gaffer.WeakMethod(
                self.__dropText),
                                                       scoped=False)
            self.__textWidget.contextMenuSignal().connect(Gaffer.WeakMethod(
                self.__expressionContextMenu),
                                                          scoped=False)

            self.__messageWidget = GafferUI.MessageWidget()

        self.__node.expressionChangedSignal().connect(Gaffer.WeakMethod(
            self.__expressionChanged),
                                                      scoped=False)
        self.__node.errorSignal().connect(Gaffer.WeakMethod(self.__error),
                                          scoped=False)

        self.__update()
コード例 #25
0
    def __init__(self, plug):

        # TODO - would be nice if this stuff didn't need to be added to the instance as metadata
        # John has said that in the future we may be able to use match patterns to register metadata
        # to children of a plug type, like we can do with nodes.
        # This would allow us to use dynamic metadata to hide the value plug when in "Remove" mode

        Gaffer.Metadata.registerValue(
            plug['name'],
            "description",
            "The name of the parameter to apply the tweak to.",
            persistent=False)
        Gaffer.Metadata.registerValue(plug['mode'],
                                      "plugValueWidget:type",
                                      "GafferUI.PresetsPlugValueWidget",
                                      persistent=False)

        presetNames = ["Replace"]

        # Identify plugs which are derived from NumericPlug or CompoundNumericPlug
        plugIsNumeric = hasattr(plug["value"], "hasMinValue")
        if plugIsNumeric:
            presetNames += ["Add", "Subtract", "Multiply"]

        if Gaffer.Metadata.value(plug, "tweakPlugValueWidget:allowRemove"):
            presetNames += ["Remove"]

        for name in presetNames:
            Gaffer.Metadata.registerValue(
                plug['mode'],
                "preset:" + name,
                GafferScene.TweakPlug.Mode.names[name],
                persistent=False)

        self.__row = GafferUI.ListContainer(
            GafferUI.ListContainer.Orientation.Horizontal, spacing=4)

        GafferUI.PlugValueWidget.__init__(self, self.__row, plug)

        nameWidget = GafferUI.StringPlugValueWidget(plug["name"])
        nameWidget.textWidget()._qtWidget().setFixedWidth(
            GafferUI.PlugWidget.labelWidth())

        self.__row.append(
            nameWidget, verticalAlignment=GafferUI.Label.VerticalAlignment.Top)

        self.__row.append(
            GafferUI.BoolPlugValueWidget(
                plug["enabled"],
                displayMode=GafferUI.BoolWidget.DisplayMode.Switch),
            verticalAlignment=GafferUI.Label.VerticalAlignment.Top,
        )

        self.__row.append(GafferUI.PlugValueWidget.create(plug["mode"]))
        self.__row.append(GafferUI.PlugValueWidget.create(plug["value"]),
                          expand=True)

        self._updateFromPlug()
コード例 #26
0
    def setView(self, view):

        if view == self.__view:
            return

        if view not in self.__viewEntries:

            if view is not None:
                tools = [
                    GafferUI.Tool.create(n, view)
                    for n in GafferUI.Tool.registeredTools(view.typeId())
                ]
                tools.sort(
                    key=lambda v: Gaffer.Metadata.nodeValue(v, "order") if
                    Gaffer.Metadata.nodeValue(v, "order") is not None else 999)
            else:
                tools = []

            with GafferUI.ListContainer(spacing=1) as widgets:

                for tool in tools:

                    image = tool.typeName().replace(":", "")
                    image = image[:1].lower() + image[1:] + ".png"

                    toolTip = tool.getName()
                    description = Gaffer.Metadata.nodeDescription(tool)
                    if description:
                        toolTip += "\n\n" + IECore.StringUtil.wrap(
                            description, 80)

                    shortCut = Gaffer.Metadata.value(tool, "viewer:shortCut")
                    if shortCut is not None:
                        toolTip += "\n\nShortcut : " + shortCut

                    widget = GafferUI.BoolWidget(
                        image=image,
                        toolTip=toolTip,
                        displayMode=GafferUI.BoolWidget.DisplayMode.Tool)
                    widget.__stateChangedConnection = widget.stateChangedSignal(
                    ).connect(
                        functools.partial(Gaffer.WeakMethod(
                            self.__stateChanged),
                                          tool=tool))

            GafferUI.WidgetAlgo.joinEdges(widgets)

            self.__viewEntries[view] = self.__ViewEntry(tools, widgets)

        self.setChild(self.__viewEntries[view].widgets)
        self.__view = view

        if self.getTool():
            self.toolChangedSignal()(self)
        elif len(self.tools()):
            self.setTool(self.tools()[0])
        else:
            self.setTool(None)
コード例 #27
0
    def testSliceGetItem(self):

        c = GafferUI.ListContainer(GafferUI.ListContainer.Orientation.Vertical)
        with c:
            ca = TestWidget("a")
            cb = TestWidget("b")
            cc = TestWidget("c")

        self.assertEqual(c[:2], [ca, cb])
コード例 #28
0
ファイル: BoxPlugValueWidget.py プロジェクト: yarwelp/gaffer
	def __init__( self, plug, **kw ) :

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

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

		with self.__column :
			GafferUI.PlugValueWidget.create( plug["min"] )
			GafferUI.PlugValueWidget.create( plug["max"] )
コード例 #29
0
    def __init__(self, scriptNode=None):

        GafferUI.NodeSetEditor.__init__(self, gtk.EventBox(), scriptNode)

        self._column = GafferUI.ListContainer(
            GafferUI.ListContainer.Orientation.Vertical)
        self.gtkWidget().add(self._column.gtkWidget())

        self._updateFromSet()
コード例 #30
0
    def __init__(self, node):

        self._currentColumn = GafferUI.ListContainer(
            GafferUI.ListContainer.Orientation.Vertical)
        GafferUI.Widget.__init__(self, self._currentColumn.gtkWidget())

        self.__node = node

        self._build()