Exemplo n.º 1
0
    def __init__(self, *args):
        """
        Initialize and configure the button widget
        """
        Widgets.FilterablePopupButton.__init__(self, *args)
        self.setFixedHeight(24)
        self.setFlat(False)
        self.setSorting(False)

        QtCore.QObject.connect(self, QtCore.SIGNAL('aboutToShow'),
                               self.__on_aboutToShow)
        QtCore.QObject.connect(self, QtCore.SIGNAL('itemChosen'),
                               self.__on_itemChosen)

        self.__pathToDisplayInfo = {}
        self.__pixmaps = \
           {'camera': QtGui.QPixmap(ScenegraphIconManager.GetPixmap('camera')),
            'light': QtGui.QPixmap(ScenegraphIconManager.GetPixmap('light'))}

        self.__scenegraphPixmap = None

        # Argument is reference to the widget which allows us to get the node
        if args[0]:
            self.__node = args[0].getNode()


        # displayMode will be set to either <DISPLAY_LIGHTS, DISPLAY_CAMERAS,
        # DISPLAY_LIGHTS | DISPLAY_CAMERAS> if the mode is
        # DISPLAY_LIGHTS | DISPLAY_CAMERAS, then this indicates that the button
        # is the big center one at the bottom of the viewports. It will draw
        # the camera/light name in text, rather than pixmaps as its icon.
        self.__displayMode = 0

        self.setAcceptDrops(True)
    def do_add_command(self, menu, name, cmd, hot_key=None, icon=None):
        # TODO add hot key

        # From the PyQt documentation:
        # PySide.QtGui.QAction.triggered([checked = false])
        # Parameters:    checked – PySide.QtCore.bool
        # If your callback signature is cmd(*args), the signal sent will have an arg, False, which corresponds
        # to the checked state of the menu item. But if it's cmd(), then it won't.
        # since the apps registered commands are defined as wrappers, callback_wrapper(*args, **kwargs)
        #  (see /rdo/rodeo/repositories/tank/studio/install/core/python/tank/platform/engine.py,
        # register_command function), they will pass the False argument to the callbacks registered by the
        # apps, for example for tk-multi-contextSwitcher:
        # menu_callback = lambda : app_payload.contextSwitcher.show_dialog(self)
        # this will fail since the callback does not take any arguments.
        # By "wrapping the wrapper" with this lambda, the function attached to triggered has no args and
        # everything works.
        cb = lambda: cmd()
        if hot_key:
            action = QtGui.QAction(name, menu, triggered=cb, icon=icon)
        else:
            if icon:
                new_icon = QtGui.QIcon(icon)
                action = QtGui.QAction(name, menu, triggered=cb, icon=new_icon)
            else:
                action = QtGui.QAction(name, menu, triggered=cb)
        menu.addAction(action)
Exemplo n.º 3
0
    def showNodeParams(self):
        self.__clearCmd()

        vertSpacer = QtGui.QSpacerItem(10, 10, QtGui.QSizePolicy.Maximum,
                                       QtGui.QSizePolicy.Expanding)
        vertSpacer1 = QtGui.QSpacerItem(5, 5, QtGui.QSizePolicy.Maximum,
                                        QtGui.QSizePolicy.Expanding)

        factory = UI4.FormMaster.KatanaFactory.ParameterWidgetFactory
        name = self.scenAovsList.currentItem().text()
        for node in self.__node.getChildren():
            if node.getParameter('aov'):
                if node.getParameter('aov').getValue(0) == name:
                    self.aov = node

        self.aocd = self.aov.getChildByIndex(0)
        self.rod = self.aov.getChildByIndex(1)

        typePolicy = UI4.FormMaster.CreateParameterPolicy(
            None, self.aocd.getParameter('type'))
        typeParam = factory.buildWidget(self, typePolicy)

        filterPolicy = UI4.FormMaster.CreateParameterPolicy(
            None, self.aocd.getParameter('filter'))
        filterParam = factory.buildWidget(self, filterPolicy)

        lpePolicy = UI4.FormMaster.CreateParameterPolicy(
            None, self.aocd.getParameter('lightPathExpression'))
        lpeParam = factory.buildWidget(self, lpePolicy)

        lGrpPolicy = UI4.FormMaster.CreateParameterPolicy(
            None, self.aocd.getParameter('lightGroups'))
        lGrpParam = factory.buildWidget(self, lGrpPolicy)

        cust_lGrpPolicy = UI4.FormMaster.CreateParameterPolicy(
            None, self.aocd.getParameter('customLightGroup'))
        cust_lGrpParam = factory.buildWidget(self, cust_lGrpPolicy)

        self.__nameLine = QtGui.QLineEdit('')
        self.__nameLine.setText(str(
            self.aocd.getParameter('name').getValue(0)))
        self.__nameLine.returnPressed.connect(self.__nameReturnPressed)

        nameLayout = QtGui.QHBoxLayout()
        self.__label = QtGui.QLabel('AOV Name')
        nameLayout.addWidget(self.__label)
        nameLayout.addWidget(self.__nameLine)

        self.scrollLayout.addItem(vertSpacer1)
        self.scrollLayout.addLayout(nameLayout)
        self.scrollLayout.addWidget(QHLine())
        self.scrollLayout.addWidget(typeParam)
        self.scrollLayout.addWidget(filterParam)
        self.scrollLayout.addWidget(QHLine())

        self.scrollLayout.addWidget(lpeParam)
        self.scrollLayout.addWidget(lGrpParam)
        self.scrollLayout.addWidget(cust_lGrpParam)

        self.scrollLayout.addItem(vertSpacer)
Exemplo n.º 4
0
    def __init__(self, parent):
        """
        Initializes the tab with a 'greetings' list widget.
        """
        BaseTab.__init__(self, parent)

        # Show a message at the top of the tab to mention the separate Keyboard
        # Shortcuts tab
        self.__iconLabelFrame = UI4.Widgets.IconLabelFrame(
            SceneGraphViewIconManager.GetPixmap('muteHeader'),
            'Have a look at the <a href="Keyboard Shortcuts"><b>Keyboard '
            'Shortcuts</b></a> tab for the list of defined keyboard '
            'shortcuts.', margin=8, parent=self)
        self.__iconLabelFrame.setLinkClickCallback(self.__linkClickCallback)
        self.__iconLabelFrame.setMaximumHeight(32)

        # Create a QListWidget for showing greeting messages created through
        # keyboard shortcuts
        self.__greetingsListWidget = QtGui.QListWidget(self)

        # Initialize the instance variable that stores a QLabel that is shown
        # when the user presses down a key, and hidden when the user releases
        # that key
        self.__popupLabel = None

        # Create the tab's layout
        layout = QtGui.QVBoxLayout()
        layout.addWidget(self.__iconLabelFrame)
        layout.addWidget(self.__greetingsListWidget)
        self.setLayout(layout)
Exemplo n.º 5
0
 def __init__(self, parent=None):
     QtGui.QWidget.__init__(self, parent)
     layout = QtGui.QHBoxLayout(self)
     self.label = QtGui.QLabel()
     self.label.setFixedWidth(150)
     self.label.setAlignment(QtCore.Qt.AlignRight)
     self.edited = QtGui.QLineEdit()
     layout.addWidget(self.label)
     layout.addWidget(self.edited)
    def __init__(self, *args, **kargs):
        QtGui.QFrame.__init__(self, *args)

        QtGui.QVBoxLayout(self)

        self.__assetIdLayout = QtGui.QHBoxLayout()
        self.__widget = None
        self.__saveMode = False
        self.__context = ""
        self.__requestedLocation = ""
    def __buildListWidget(self, name, parentLayout):

        layout = QtGui.QVBoxLayout()

        layout.addWidget(QtGui.QLabel(name))
        listWidget = QtGui.QListWidget()
        layout.addWidget(listWidget)

        parentLayout.addLayout(layout)

        return listWidget
Exemplo n.º 8
0
 def drawDecoration(self, painter, option, rect, pixmap):
     if self.__drawViewBadge:
         painter.fillRect(rect, QtGui.QBrush(QtGui.QColor(93,93,187)))
         painter.save()
         painter.setPen(QtGui.QPen(QtGui.QColor(80,80,160)))
         painter.drawRect(rect)
         painter.restore()
         self.__drawViewBadge = False
     if pixmap:
         painter.drawPixmap(rect.left()+1,
             rect.top()+(rect.height()-pixmap.height())/2, pixmap)
Exemplo n.º 9
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)

        main_lay = QtGui.QHBoxLayout()
        self.listWidget = QtGui.QListView()

        self.editorWidget = QtGui.QWidget()
        main_lay.addWidget(self.listWidget)
        main_lay.addWidget(self.editorWidget)

        self.setLayout(main_lay)
Exemplo n.º 10
0
        def lightListWidgetMousePressEvent(event):
            """
            Handle mouse events
            """
            # Set up context menu (right-click)
            if event.button() == QtCore.Qt.RightButton:
                item = lightListWidget.itemAt(event.pos())
                if not item:
                    return

                scriptItem = item.getItemData()
                item.setHiliteColor(QtGui.QColor(32,32,32))
                lightListWidget.update(lightListWidget.indexFromItem(item))

                menu = QtGui.QMenu(None)

                # Render options
                UI4.Util.RenderMenu.AddRenderItemsToMenu(
                        menu, scriptItem.getRenderNode(), None)
                menu.addSeparator()

                # Add 'Delete' action
                def delete():
                    # Delete selected light pass items
                    for item in lightListWidget.selectedItems():
                        item.getItemData().delete()


                menu.addAction('Delete', delete)
                menu.addSeparator()

                # Add 'View From Render Node' action
                def viewNode():
                    NodegraphAPI.SetNodeViewed(
                            scriptItem.getRenderNode(), True, exclusive=True)
                action = menu.addAction('View From Render Node', viewNode)
                action.setIcon(UI4.Util.IconManager.GetIcon(
                        'Icons/AttributeEditor/blue_snapback.png'))

                # Show menu
                pos = event.pos()
                pos = lightListWidget.mapToGlobal(QtCore.QPoint(
                         pos.x(), pos.y() + lightListWidget.header().height()))
                try:
                    menu.exec_(pos)
                finally:
                    item.setHiliteColor(None)
                    lightListWidget.update(lightListWidget.indexFromItem(item))
                    event.accept()
                    self.updateLightList()
Exemplo n.º 11
0
    def makeItems(self, directory, mats):
        for mat in mats:
            material = QtGui.QListWidgetItem(mat)
            screenshot = os.path.join(directory, mat + '.png')

            if not mat + '.png' in os.listdir(directory):
                screenshot = os.path.join(self.resources, 'dummyIcon.png')

            icon = QtGui.QIcon(screenshot)

            material.setData(QtCore.Qt.UserRole, directory)
            material.setIcon(icon)

            self.listWidget.addItem(material)
Exemplo n.º 12
0
 def do_add_command(self, menu, name, cmd, hot_key=None, icon=None):
     # TODO add hot key
     if hot_key:
         action = QtGui.QAction(name, menu, triggered=cmd, icon=icon)
     else:
         if icon:
             new_icon = QtGui.QIcon(icon)
             action = QtGui.QAction(name,
                                    menu,
                                    triggered=cmd,
                                    icon=new_icon)
         else:
             action = QtGui.QAction(name, menu, triggered=cmd)
     menu.addAction(action)
Exemplo n.º 13
0
    def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent)
        self.setWindowTitle("Color Reference Setting")
        main_layout = QtGui.QVBoxLayout(self)

        group_layout = QtGui.QHBoxLayout()
        pre_group = QtGui.QGroupBox()
        pre_group.setTitle("Pre Shot")
        post_group = QtGui.QGroupBox()
        post_group.setTitle("Post Shot")
        group_layout.addWidget(pre_group)
        group_layout.addWidget(post_group)

        self.pre_shot_widget = kLineTextLabel()
        self.pre_shot_widget.setLabel("shot name")
        self.pre_frame_widget = kLineTextLabel()
        self.pre_frame_widget.setLabel("shot frame")
        pre_group_layout = QtGui.QVBoxLayout(pre_group)
        pre_group_layout.setContentsMargins(5,5,5,5)
        pre_group_layout.addWidget(self.pre_shot_widget)
        pre_group_layout.addWidget(self.pre_frame_widget)

        self.post_shot_widget = kLineTextLabel()
        self.post_shot_widget.setLabel("shot name")
        self.post_frame_widget = kLineTextLabel()
        self.post_frame_widget.setLabel("shot frame")
        post_group_layout = QtGui.QVBoxLayout(post_group)
        post_group_layout.setContentsMargins(5,5,5,5)
        post_group_layout.addWidget(self.post_shot_widget)
        post_group_layout.addWidget(self.post_frame_widget)

        if parent is not None:
            if parent._pre_shot_name is not None:
                self.pre_shot_widget.setText(parent._pre_shot_name)
            if parent._pre_shot_frame is not None:
                self.pre_frame_widget.setText(parent._pre_shot_frame)
            if parent._post_shot_name is not None:
                self.post_shot_widget.setText(parent._post_shot_name)
            if parent._post_shot_frame is not None:
                self.post_frame_widget.setText(parent._post_shot_frame)

        ok_button = QtGui.QPushButton("ok")
        ok_button.clicked.connect(
            lambda arg=False, args=parent:self.clicked_ok(args))
        cancel_button = QtGui.QPushButton("cancel")
        cancel_button.clicked.connect(self.close)
        button_layout = QtGui.QHBoxLayout()
        button_layout.addWidget(ok_button)
        button_layout.addWidget(cancel_button)

        main_layout.addLayout(group_layout)
        main_layout.addSpacing(25)
        main_layout.addLayout(button_layout)
Exemplo n.º 14
0
def __create_tank_error_menu():
    """
    Creates a std "error" tank menu and grabs the current context.
    Make sure that this is called from inside an except clause.
    """
    (exc_type, exc_value, exc_traceback) = sys.exc_info()
    message = ""
    message += "Message: Shotgun encountered a problem starting the Engine.\n"
    message += "Please contact [email protected]\n\n"
    message += "Exception: %s - %s\n" % (exc_type, exc_value)
    message += "Traceback (most recent call last):\n"
    message += "\n".join(traceback.format_tb(exc_traceback))

    if Configuration.get("KATANA_UI_MODE"):
        sg_menu = MenuGenerator.get_or_create_root_menu("Shotgun")
        if sg_menu is not None:
            sg_menu.clear()
            cmd = lambda m=message: __show_tank_message(
                "Shotgun Pipeline Toolkit caught an error", m)
            action = QtGui.QAction("[Shotgun Error - Click for details]",
                                   sg_menu,
                                   triggered=cmd)
            sg_menu.addAction(action)
    else:
        print("The Shotgun Pipeline Toolkit caught an error: %s" % message)
    def __init__(self):
        QtGui.QFrame.__init__(self)

        QtGui.QHBoxLayout(self)

        self.__showList = self.__buildListWidget("Show", self.layout())
        self.__shotList = self.__buildListWidget("Shot", self.layout())
        self.__nameList = self.__buildListWidget("Asset", self.layout())
        self.__versionList = self.__buildListWidget("Version", self.layout())

        self.connect(self.__showList, QtCore.SIGNAL("itemSelectionChanged()"),
                     self.__updateShow)
        self.connect(self.__shotList, QtCore.SIGNAL("itemSelectionChanged()"),
                     self.__updateShot)
        self.connect(self.__nameList, QtCore.SIGNAL("itemSelectionChanged()"),
                     self.__updateAsset)
        self.connect(self.__versionList,
                     QtCore.SIGNAL("itemSelectionChanged()"),
                     self.__updateVersion)

        self.__widgetsDict = {
            "show": self.__showList,
            "shot": self.__shotList,
            "name": self.__nameList,
            "version": self.__versionList,
        }

        self.__showList.clear()
        self.__showList.addItems(_getShows())
Exemplo n.º 16
0
 def __init__(self, parent):
     UI4.Tabs.BaseTab.__init__(self, parent)
     QtGui.QVBoxLayout(self)
     self.layout().setContentsMargins(4, 4, 4, 4)
     self._MonitorColorControl__monitorGammaWidget = QT4Color.MonitorGammaWidget(
         self)
     self.layout().addWidget(self._MonitorColorControl__monitorGammaWidget,
                             0)
     self.connect(self._MonitorColorControl__monitorGammaWidget,
                  QtCore.SIGNAL('valueChanged'),
                  self._MonitorColorControl__monitorChanged_CB)
     self._MonitorColorControl__colorGradeWidget = QT4Color.ColorGradeWidget(
         self, title='Primary Color Grade', createChildrenInScroll=True)
     self.layout().addWidget(self._MonitorColorControl__colorGradeWidget,
                             10)
     self.connect(self._MonitorColorControl__colorGradeWidget,
                  QtCore.SIGNAL('valueChanged'),
                  self._MonitorColorControl__gradeChanged_CB)
     self._MonitorColorControl__updateTimer = QtCore.QTimer(self)
     self.connect(self._MonitorColorControl__updateTimer,
                  QtCore.SIGNAL('timeout()'),
                  self._MonitorColorControl__timer_CB)
     Utils.EventModule.RegisterCollapsedHandler(
         self._MonitorColorControl__monitor_drawStateUpdated_CB,
         'monitor_drawStateUpdated', None, True)
Exemplo n.º 17
0
    def listItemRightClicked(self, QPos):
        self.listMenu = QtGui.QMenu()

        self.listMenu.setStyleSheet("""
            QMenu {
                background-color: #313131;
                border: 1px solid ;
            }
            QMenu::item::selected {
                background-color: #1e1e1e;
            }
        """)

        import_mtl = self.listMenu.addAction("Import Material")
        import_klf = self.listMenu.addAction("Import Lookfile")
        import_Lmtl = self.listMenu.addAction("Create Material")
        delete_mtl = self.listMenu.addAction("Delete Material")

        self.connect(import_mtl, QtCore.SIGNAL("triggered()"), self.importMtl)
        self.connect(import_klf, QtCore.SIGNAL("triggered()"), self.importKlf)
        self.connect(import_Lmtl, QtCore.SIGNAL("triggered()"),
                     self.importLmtl)
        self.connect(delete_mtl, QtCore.SIGNAL("triggered()"), self.deleteMtl)
        parentPosition = self.listWidget.mapToGlobal(QtCore.QPoint(0, 0))
        self.listMenu.move(parentPosition + QPos)
        self.listMenu.show()
Exemplo n.º 18
0
 def displayImage(self, filePath):
     """
     Changes the image displayed by the widget.
     """
     self.__filePath = filePath
     if self.__filePath:
         self.setPixmap(QtGui.QPixmap(self.__filePath))
Exemplo n.º 19
0
    def paintEvent(self, event):
        """
        Overrides the base paint event so we can overlay our circle.
        """
        QtGui.QLabel.paintEvent(self, event)

        if self.__xPoint > 0 and self.__yPoint > 0:
            paint = QtGui.QPainter()
            paint.begin(self)
            paint.setRenderHint(QtGui.QPainter.Antialiasing)

            paint.setPen(QtGui.QColor(0, 255, 0))
            paint.setBrush(QtGui.QColor(0, 255, 0))
            center = QtCore.QPoint(self.__xPoint, self.__yPoint)
            paint.drawEllipse(center, 5, 5)

            paint.end()
Exemplo n.º 20
0
 def deleteMtl(self):
     msg = QtGui.QMessageBox()
     msg.setIcon(QtGui.QMessageBox.Warning)
     msg.setText("Are you sure you want to delete this material?")
     msg.setWindowTitle("Warning!")
     msg.setStandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
     msg.buttonClicked.connect(self.deleteCmd)
     msg.exec_()
Exemplo n.º 21
0
 def __init__(self, parent=None):
     QtGui.QToolButton.__init__(self, parent)
     self.resized.connect(self.setButtonGeometry)
     self.h = 40
     self.button = QtGui.QToolButton()
     self.button.setAutoRaise(True)
     self.button.setIconSize(QtCore.QSize(28, 28))
     self.button.setParent(self)
    def buildWidgets(self, hints):
        """Creates most of the UI widgets"""
        label = QtGui.QLabel(" (PyMock)", self)
        label.setProperty('smallFont', True)
        label.setProperty('boldFont', True)
        p = label.palette()
        p.setColor(QtGui.QPalette.WindowText, QtGui.QColor(255, 200, 0))
        p.setColor(QtGui.QPalette.Text, QtGui.QColor(255, 200, 0))
        label.setPalette(p)
        self.layout().addWidget(label)

        self.layout().addWidget(QtGui.QLabel("mock://"))
        self.__showEdit = QT4FormWidgets.InputWidgets.InputLineEdit(self)
        self.layout().addWidget(self.__showEdit)

        self.layout().addWidget(QtGui.QLabel("/"))
        self.__shotEdit = QT4FormWidgets.InputWidgets.InputLineEdit(self)
        self.layout().addWidget(self.__shotEdit)

        self.layout().addWidget(QtGui.QLabel("/"))
        self.__assetEdit = QT4FormWidgets.InputWidgets.InputLineEdit(self)
        self.layout().addWidget(self.__assetEdit)

        self.layout().addWidget(QtGui.QLabel("/"))
        self.__versionEdit = QT4FormWidgets.InputWidgets.InputLineEdit(self)
        self.layout().addWidget(self.__versionEdit)

        self.connect(self.__showEdit, QtCore.SIGNAL("lostFocus"),
                     self.__lostFocus)
        self.connect(self.__shotEdit, QtCore.SIGNAL("lostFocus"),
                     self.__lostFocus)
        self.connect(self.__assetEdit, QtCore.SIGNAL("lostFocus"),
                     self.__lostFocus)
        self.connect(self.__versionEdit, QtCore.SIGNAL("lostFocus"),
                     self.__lostFocus)
    def buildWidgets(self, hints):
        """
        This will construct the UI for the render widget for the asset 
        management system.
        """
        label = QtGui.QLabel(" (PyMock)", self)
        label.setProperty('smallFont', True)
        label.setProperty('boldFont', True)
        p = label.palette()
        p.setColor(QtGui.QPalette.WindowText, QtGui.QColor(255, 200, 0))
        p.setColor(QtGui.QPalette.Text, QtGui.QColor(255, 200, 0))
        label.setPalette(p)
        self.layout().addWidget(label)

        assetIdWidget = QtGui.QWidget(self)
        assetIdHBox = QtGui.QHBoxLayout(assetIdWidget)
        assetIdLabel = QtGui.QLabel("Output Asset:", assetIdWidget)
        assetIdLabel.setEnabled(False)
        assetIdHBox.addWidget(assetIdLabel, 0)
        self.__assetIdLabel = QtGui.QLineEdit("", assetIdWidget)
        self.__assetIdLabel.setReadOnly(True)
        assetIdHBox.addWidget(self.__assetIdLabel, 0)
        self.layout().addWidget(assetIdWidget)

        self.updateWidgets()
Exemplo n.º 24
0
def setMessage(message):
    from Katana import QtCore, QtGui
    layoutsMenus = [x for x in QtGui.qApp.topLevelWidgets() if type(x).__name__ == 'LayoutsMenu']
    KatanaWindow = layoutsMenus[0].parent().parent()

    widget  = QtGui.QDialog(parent=KatanaWindow)
    title_layout = QtGui.QVBoxLayout()
    button_layout = QtGui.QHBoxLayout()
    title = QtGui.QLabel()
    button = QtGui.QPushButton()
    font = QtGui.QFont()
    font.setPixelSize(16)

    title.setText(message)
    title.setFont(font)
    title.setAlignment(QtCore.Qt.AlignHCenter)
    button.setText("Confirm!")
    button.clicked.connect(widget.close)
    button.setFixedHeight(30)

    title_layout.addStretch()
    title_layout.addWidget(title)
    title_layout.addStretch()
    button_layout.addStretch()
    button_layout.addWidget(button)
    button_layout.addStretch()

    mainLayout = QtGui.QVBoxLayout()
    mainLayout.addLayout(title_layout)
    mainLayout.addLayout(button_layout)

    widget.setWindowTitle("GafferThreeRigs.Warning")
    widget.setLayout(mainLayout)
    widget.setFixedHeight(130)
    widget.show()
Exemplo n.º 25
0
    def __populate(self):
        self.globalAovsList.clear()
        self.scenAovsList.clear()

        sceneAovs = self.__getSceneAovs()
        # globalAovs = list(set(aovList)-set(sceneAovs))
        pip = []
        for i in sceneAovs:
            pip.append(re.sub(r'\d+$', '', i))
        globalAovs = [x for x in aovList if x not in pip]

        for aov in sorted(globalAovs):
            item = QtGui.QListWidgetItem(aov)
            self.globalAovsList.addItem(item)

        for aov in sorted(sceneAovs):
            item = QtGui.QListWidgetItem(aov)
            self.scenAovsList.addItem(item)
Exemplo n.º 26
0
    def add_command_to_menu(self, menu):
        """
        Add a new QAction representing this AppCommand to a given QMenu.
        """
        action = menu.addAction(self.name)

        key_sequence = self.properties.get("hotkey")
        if key_sequence:
            action.setShortcut(QtGui.QKeySequence(key_sequence))

        icon_path = self.properties.get("icon")
        if icon_path:
            icon = QtGui.QIcon(icon_path)
            if not icon.isNull():
                action.setIcon(icon)

        # Wrap to avoid passing args
        action.triggered.connect(lambda: self.callback())
        return action
Exemplo n.º 27
0
    def __init__(self, parent, node):
        """
        Initializes an instance of the class.
        """
        QtGui.QWidget.__init__(self, parent)

        self.__node = node

        # Get the SuperTool's parameters
        rootLocationsParameter = self.__node.getParameter('rootLocations')

        #######################################################################
        # Create parameter policies from the parameters and register callbacks
        # to be notified if anything changes in the underlying parameter.
        #
        # This is your Controller in the MVC pattern.
        #######################################################################
        CreateParameterPolicy = UI4.FormMaster.CreateParameterPolicy

        self.__rootLocationsParameterPolicy = CreateParameterPolicy(
            None, rootLocationsParameter)
        self.__rootLocationsParameterPolicy.addCallback(
            self.rootLocationsParameterChangedCallback)

        #######################################################################
        # Create UI widgets from the parameter policies to display the values
        # contained in the parameter.
        #
        # The widget factory will return an appropriate widget based on the
        # parameters type and any widget hints you've specified. For example
        # for a string parameter the factory will return a simple text editing
        # widget. But if you specify a widget hint of
        # 'widget': 'newScenegraphLocation' the factory will return a widget
        # that interacts with the Scene Graph tab.
        #
        # Other widget types you can use are:
        #   number -> Number Editor Widget
        #   assetIdInput -> Widget that provides hooks to your Asset system.
        #   color -> Widget to display a color
        #
        # This is your View in the MVC pattern.
        #######################################################################
        WidgetFactory = UI4.FormMaster.KatanaFactory.ParameterWidgetFactory
        rootLocationsWidget = WidgetFactory.buildWidget(
            self, self.__rootLocationsParameterPolicy)

        mainLayout = QtGui.QVBoxLayout()
        mainLayout.addWidget(rootLocationsWidget)
        # mainLayout.addWidget(threePointLightingWidget)
        # mainLayout.addWidget(settingWidget)
        # mainLayout.addWidget(importLightSetsWidget)

        # Apply the layout to the widget
        self.setLayout(mainLayout)
Exemplo n.º 28
0
    def _add_context_menu(self, menu_handle):
        """
        Adds a context menu which displays the current context
        """

        ctx = self._engine.context
        ctx_name = str(ctx)

        # create the menu object
        ctx_menu = menu_handle.addMenu(ctx_name)

        action = QtGui.QAction('Jump to Shotgun', self.root_menu,triggered=self._jump_to_sg)
        ctx_menu.addAction(action)

        action = QtGui.QAction('Jump to File System', self.root_menu,triggered=self._jump_to_fs)
        ctx_menu.addAction(action)

        ctx_menu.addSeparator()

        return ctx_menu
Exemplo n.º 29
0
 def messageKeyPressCallback(self):
     """
     Shows a message label.
     """
     if self.__popupLabel is None:
         self.__popupLabel = QtGui.QLabel("Key is being pressed!", self)
     w = 150
     h = 50
     self.__popupLabel.setGeometry((self.width() - w) / 2,
                                   (self.height() - h) / 2, w, h)
     self.__popupLabel.show()
Exemplo n.º 30
0
    def __init__(self, parent, node):
        """
        Initializes an instance of the class.
        """
        QtGui.QWidget.__init__(self, parent)

        self.__node = node

        # Get the SuperTool's parameters
        nameParameter = self.__node.getParameter('name')
        arnoldOperatorParameter = self.__node.getParameter('arnoldOperator')
        selectionParameter = self.__node.getParameter('arnoldOperator.selection')
        lookParameter = self.__node.getParameter('arnoldOperator.look')
        filenameParameter = self.__node.getParameter('arnoldOperator.filename')
        searchParameter = self.__node.getParameter('arnoldOperator.search_path')

        CreateParameterPolicy = UI4.FormMaster.CreateParameterPolicy

        self.__nameParameterPolicy = CreateParameterPolicy(
            None, nameParameter)
        self.__arnoldOperatorParameterPolicy = CreateParameterPolicy(
            None, arnoldOperatorParameter)
        self.__selectionParameterPolicy = CreateParameterPolicy(
            None, selectionParameter)
        self.__lookParameterPolicy = CreateParameterPolicy(
            None, lookParameter)
        self.__filenameParameterPolicy = CreateParameterPolicy(
            None, filenameParameter)
        self.__searchParameterPolicy = CreateParameterPolicy(
            None, searchParameter)

        self.__nameParameterPolicy.addCallback(
            self.nameChangedCallback)
        self.__selectionParameterPolicy.addCallback(
            self.selectionChangedCallback)
        self.__lookParameterPolicy.addCallback(
            self.lookChangedCallback)
        self.__filenameParameterPolicy.addCallback(
            self.filenameChangedCallback)
        self.__searchParameterPolicy.addCallback(
            self.searchChangedCallback)

        WidgetFactory = UI4.FormMaster.KatanaFactory.ParameterWidgetFactory
        nameParameterWidget = WidgetFactory.buildWidget(
            self, self.__nameParameterPolicy)
        arnoldOperatorWidget = WidgetFactory.buildWidget(
            self, self.__arnoldOperatorParameterPolicy)
        mainLayout = QtGui.QVBoxLayout()
        mainLayout.addWidget(nameParameterWidget)
        mainLayout.addWidget(arnoldOperatorWidget)

        # Apply the layout to the widget
        self.setLayout(mainLayout)