コード例 #1
0
ファイル: WidgetTest.py プロジェクト: stefanfeess/gaffer
    def testAddressAndObject(self):

        button = GafferUI.Button()
        address = GafferUI._qtAddress(button._qtWidget())
        self.assertTrue(isinstance(address, int))
        widget = GafferUI._qtObject(address, QtWidgets.QPushButton)
        self.assertTrue(isinstance(widget, QtWidgets.QPushButton))
コード例 #2
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))
コード例 #3
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='timelinePlay.png')
            self.__stopButton = GafferUI.Button(image='timelineStop.png')

            self.__startPauseClickedConnection = self.__startPauseButton.clickedSignal(
            ).connect(Gaffer.WeakMethod(self.__startPauseClicked))
            self.__pauseClickedConnection = self.__stopButton.clickedSignal(
            ).connect(Gaffer.WeakMethod(self.__stopClicked))

        self._updateFromPlug()
コード例 #4
0
    def testParent(self):

        t = GafferUI.TabbedContainer()
        b = GafferUI.Button()

        t.append(b)
        self.assertEqual(b.parent(), t)
コード例 #5
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()
コード例 #6
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()