Beispiel #1
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()
    def create(self):
        widget = QtGui.QWidget()
        widget_a = QtGui.QWidget()
        widget_b = QtGui.QWidget()
        palette = widget.palette()
        palette.setColor(widget.backgroundRole(),
                         QtGui.QColor(0.14 * 255, 0.14 * 255, 0.14 * 255))
        widget.setPalette(palette)

        layout = QtGui.QVBoxLayout(widget)
        layout.setSpacing(5)
        layout.setContentsMargins(0, 0, 0, 0)
        layout_a = QtGui.QVBoxLayout(widget_a)
        layout_b = QtGui.QVBoxLayout(widget_b)
        layout_a.setContentsMargins(10, 10, 10, 10)
        layout_b.setContentsMargins(10, 10, 10, 10)
        widget_line = QtGui.QFrame()
        widget_line.setFrameShape(QtGui.QFrame.HLine)
        widget_line.setFrameShadow(QtGui.QFrame.Sunken)
        layout.addWidget(widget_a)
        layout.addWidget(widget_line)
        layout.addWidget(widget_b)

        self.pre_shot_image = kImageWidget()
        pre_shot_image_path = os.path.join(_iconsDir, "no-image.svg")
        pixmap = QtGui.QPixmap(pre_shot_image_path)
        self.pre_shot_image.setPixmap(pixmap)

        self.post_shot_image = kImageWidget()
        post_shot_image_path = os.path.join(_iconsDir, "no-image.svg")
        pixmap = QtGui.QPixmap(post_shot_image_path)
        self.post_shot_image.setPixmap(pixmap)

        self.pre_shot_label = QtGui.QLabel()
        self.pre_shot_label.setFont(
            QtGui.QFont("Rome times", 6, QtGui.QFont.Bold))
        self.pre_shot_label.setText(
            "<font color='white'>Pre Shot : None</font>")
        self.pre_shot_label.setAlignment(QtCore.Qt.AlignLeft)
        self.pre_shot_label.setGeometry(5, 5, 300, 100)
        self.pre_shot_label.setParent(self.pre_shot_image)
        self.post_shot_label = QtGui.QLabel()
        self.post_shot_label.setFont(
            QtGui.QFont("Rome times", 6, QtGui.QFont.Bold))
        self.post_shot_label.setText(
            "<font color='white'>Post Shot : None</font>")
        self.post_shot_label.setAlignment(QtCore.Qt.AlignLeft)
        self.post_shot_label.setGeometry(5, 5, 300, 100)
        self.post_shot_label.setParent(self.post_shot_image)

        layout_a.addWidget(self.pre_shot_image)
        layout_b.addWidget(self.post_shot_image)

        return widget
    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)
Beispiel #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)
 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)
    def widget(self):

        layoutsMenus = [
            x for x in QtGui.qApp.topLevelWidgets()
            if type(x).__name__ == 'LayoutsMenu'
        ]
        KatanaWindow = layoutsMenus[0].parent().parent()

        saveTo = self.getParameter('saveTo').getValue(0)

        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)

        if saveTo:
            title.setText("MaterialX baking succeeded!")
        else:
            title.setText("Please enter the saving path!")
        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("MaterialXAssign")
        widget.setLayout(mainLayout)
        widget.setFixedHeight(130)
        widget.show()
    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 = ""
Beispiel #8
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)
    def __buildListWidget(self, name, parentLayout):

        layout = QtGui.QVBoxLayout()

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

        parentLayout.addLayout(layout)

        return listWidget
Beispiel #10
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)
Beispiel #11
0
    def __init__(self, parent):
        BaseTab.__init__(self, parent)

        self.__runtime = None
        self.__client = None

        self.setLayout(QtGui.QVBoxLayout())
        self.layout().setSpacing(2)
        self.layout().setMargin(0)

        self.__locationsLabel = QtGui.QLabel('Locations')
        self.layout().addWidget(self.__locationsLabel)

        self.__locationInfoLabel = QtGui.QLabel('Info')
        self.layout().addWidget(self.__locationInfoLabel)

        self.__infoFrame = QtGui.QFrame()
        self.__infoFrame.setLayout(QtGui.QVBoxLayout())
        self.layout().addWidget(self.__infoFrame)

        self.__setLocations()
        self.__connectSignals()
Beispiel #12
0
    def __init__(self):
        """Builds the initial combose box UI"""

        QtGui.QFrame.__init__(self)

        QtGui.QVBoxLayout(self)

        assetFrame = QtGui.QFrame(self)
        QtGui.QHBoxLayout(assetFrame)
        self.layout().addWidget(assetFrame)

        assetFrame.layout().addWidget(QtGui.QLabel("show:"))
        self.__showCombobox = QtGui.QComboBox()
        assetFrame.layout().addWidget(self.__showCombobox)

        assetFrame.layout().addWidget(QtGui.QLabel("shot:"))
        self.__shotCombobox = QtGui.QComboBox()
        assetFrame.layout().addWidget(self.__shotCombobox)

        assetFrame.layout().addWidget(QtGui.QLabel("asset:"))
        self.__assetCombobox = QtGui.QComboBox()
        assetFrame.layout().addWidget(self.__assetCombobox)

        assetFrame.layout().addWidget(QtGui.QLabel("version:"))
        self.__versionCombobox = QtGui.QComboBox()
        assetFrame.layout().addWidget(self.__versionCombobox)

        self.connect(self.__showCombobox,
                     QtCore.SIGNAL("currentIndexChanged(QString)"),
                     self.__updateShow)
        self.connect(self.__shotCombobox,
                     QtCore.SIGNAL("currentIndexChanged(QString)"),
                     self.__updateShot)
        self.connect(self.__assetCombobox,
                     QtCore.SIGNAL("currentIndexChanged(QString)"),
                     self.__updateAsset)
        self.connect(self.__versionCombobox,
                     QtCore.SIGNAL("currentIndexChanged(QString)"),
                     self.__updateVersion)

        # Modify the integrated QListViews to lay out the items every time the
        # view is resized, so that changes in the application font preferences
        # are correctly reflected
        for combobox in (self.__showCombobox, self.__shotCombobox,
                         self.__assetCombobox, self.__versionCombobox):
            combobox.view().setResizeMode(QtGui.QListView.Adjust)

        self.__sandboxCheckBox = QtGui.QCheckBox('Save to Sandbox', self)
        self.layout().addWidget(self.__sandboxCheckBox)

        self.__showCombobox.addItems(_getShows())
    def __init__(self):
        self.__building = True
        
        self._buildPresets()

        QtGui.QDialog.__init__(self)
        self.setWindowTitle('Public Interface Automator')

        QtGui.QVBoxLayout(self)
        
        self.__splitter = QtGui.QSplitter(QtCore.Qt.Vertical, self)
        self.layout().addWidget(self.__splitter)
        
        self.__splitTop = QtGui.QWidget(None)
        QtGui.QVBoxLayout(self.__splitTop)
        self.__splitter.addWidget(self.__splitTop)
        self.__splitTop.setMinimumHeight(350)

        self.__splitBottom = QtGui.QWidget(None)
        
        QtGui.QVBoxLayout(self.__splitBottom)
        self.__splitter.addWidget(self.__splitBottom)
        
        self.__splitter.setChildrenCollapsible(False)
        
        self.__buildToolbar(self.__splitTop)
        self.__buildTree(self.__splitTop)
        self.__buildScriptArea(self.__splitBottom)

        self._loadPreset( self.__presetNames[0] )
        
        self.__building = False
        
        self.__refresh()
        
        self.setMinimumWidth(600)
        self.setMinimumHeight(550)
    def __init__(self, parent):
        QtGui.QWidget.__init__(self, parent)
        QtGui.QVBoxLayout(self)

        self._pre_shot_name = None
        self._post_shot_name = None
        self._pre_shot_frame = None
        self._post_shot_frame = None
        self._pre_shot_frame_range = None
        self._post_shot_frame_range = None

        # add title
        commonLabel = kTitleLabel()
        commonLabel.setIcon(os.path.join(_iconsDir, "settings-work-tool.png"))
        commonLabel.button.clicked.connect(
            lambda arg=None, args=None: self.buttonScript())
        commonLabel.setHeight(40)
        commonLabel.setMinimumWidth(330)
        palette = QtGui.QPalette()
        palette.setColor(QtGui.QPalette.Background,
                         QtGui.QColor(0.5 * 255, 0.5 * 255, 0.6 * 255))
        palette.setColor(QtGui.QPalette.WindowText,
                         QtGui.QColor(0.0, 0.0, 0.0))
        commonLabel.setAutoFillBackground(True)
        commonLabel.setText("Lighting Shot Color Reference")
        commonLabel.setPalette(palette)
        commonLabel.setAlignment(QtCore.Qt.AlignCenter)
        commonLabel.setFont(QtGui.QFont("Rome times", 10, QtGui.QFont.Bold))

        self.layout().setContentsMargins(0, 0, 0, 0)
        self.layout().setSpacing(0)
        self.layout().addWidget(commonLabel)
        main_widget = self.create()
        scroll = QtGui.QScrollArea()
        scroll.setWidget(main_widget)
        scroll.setWidgetResizable(True)
        self.layout().addWidget(scroll)

        SettingWidget.init(self)
Beispiel #15
0
    def __init__(self, parent, node):
        """
        Initialize the editor and set up UI
        """
        self.__node = node
        self.__frozen = True
        
        QtGui.QWidget.__init__(self, parent)
        QtGui.QVBoxLayout(self)
        
        self.__tabs = QtGui.QTabWidget(self)
        
        #  Create Passes tab
        self.__renderPassTab = RenderPassTab(None, node)

        #  Add tab to UI
        try:
            self.__tabs.addTab(self.__renderPassTab, 'Render Passes')
        except Exception as exception:
            log.exception('Error adding "Render Passes" tab for "%s" node: %s'
                          % (node.getName(), str(exception)))
        
        self.layout().addWidget(self.__tabs)
        self.layout().addStretch()
Beispiel #16
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')
        passesParameter = self.__node.getParameter('passes')
        saveToParameter = self.__node.getParameter('saveTo')
        writeMatexOutButton = self.__node.getParameter("writeMaterialxOut")

        CreateParameterPolicy = UI4.FormMaster.CreateParameterPolicy
        self.__rootLocationsParameterPolicy = CreateParameterPolicy(
            None, rootLocationsParameter)

        self.__passesParameterPolicy = CreateParameterPolicy(
            None, passesParameter)

        self.__saveToParameterPolicy = CreateParameterPolicy(
            None, saveToParameter)

        self.__writeMatexOutButtonPolicy = CreateParameterPolicy(
            None, writeMatexOutButton)

        WidgetFactory = UI4.FormMaster.KatanaFactory.ParameterWidgetFactory
        rootLocationsWidget = WidgetFactory.buildWidget(
            self, self.__rootLocationsParameterPolicy)
        passesWidget = WidgetFactory.buildWidget(self,
                                                 self.__passesParameterPolicy)
        saveToWidget = WidgetFactory.buildWidget(self,
                                                 self.__saveToParameterPolicy)
        writeMatexOutButtonWidget = WidgetFactory.buildWidget(
            self, self.__writeMatexOutButtonPolicy)

        # Build a group widget
        self.group_layout = passesWidget.getPopdownWidget().layout()
        self.add_button = QtGui.QPushButton("Add New Pass")
        self.remove_button = QtGui.QPushButton("Remove Last Pass")
        self.connect(self.add_button, QtCore.SIGNAL('clicked(bool)'),
                     self.onAddButtonPressed)
        self.connect(self.remove_button, QtCore.SIGNAL('clicked(bool)'),
                     self.onRemoveButtonPressed)

        # parameter = self.__node.getParameters().getChild("look_origin")
        # if not parameter:
        #     parameter = self.__node.getParameters().createChildString("look_origin", 'default')
        # policy = UI4.FormMaster.CreateParameterPolicy(None, parameter)
        # widget = WidgetFactory.buildWidget(self, policy)

        if not passesParameter.getChild("default"):
            passesParameter.createChildString("default", 'default')

        self.button_layout = QtGui.QHBoxLayout()
        self.button_layout.addWidget(self.add_button)
        self.button_layout.addWidget(self.remove_button)
        self.group_layout.addLayout(self.button_layout)

        line = QtGui.QFrame()
        line.setFrameShape(QtGui.QFrame.HLine)
        line.setFrameShadow(QtGui.QFrame.Sunken)

        # Create a layout and add the parameter editing widgets to it
        mainLayout = QtGui.QVBoxLayout()
        mainLayout.addWidget(rootLocationsWidget)
        mainLayout.addWidget(passesWidget)
        mainLayout.addWidget(line)
        mainLayout.addWidget(saveToWidget)
        mainLayout.addWidget(writeMatexOutButtonWidget)
        # Apply the layout to the widget
        self.setLayout(mainLayout)
Beispiel #17
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
        tagetsParameter = self.__node.getParameter('tagets')
        tunningParameter = self.__node.getParameter('tuning')
        translateParameter = self.__node.getParameter('translate')
        rotatexyzParameter = self.__node.getParameter('rotatexyz')
        scalebackParameter = self.__node.getParameter('scaleback')

        #######################################################################
        # 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.__tagetsParameterPolicy = CreateParameterPolicy(
            None, tagetsParameter)
        self.__tagetsParameterPolicy.addCallback(
            self.tagetsParameterChangedCallback)
        self.__tunningParameterPolicy = CreateParameterPolicy(
            None, tunningParameter)
        self.__rotationxParameterPolicy = CreateParameterPolicy(
            None, translateParameter)
        self.__rotatexyzParameterPolicy = CreateParameterPolicy(
            None, rotatexyzParameter)
        self.__scalebackParameterPolicy = CreateParameterPolicy(
            None, scalebackParameter)
        #######################################################################
        # 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
        tagetsWidget = WidgetFactory.buildWidget(
            self, self.__tagetsParameterPolicy)
        tunningWidget = WidgetFactory.buildWidget(
            self, self.__tunningParameterPolicy)
        translateWidget = WidgetFactory.buildWidget(
            self, self.__rotationxParameterPolicy)
        rotatexyzWidget = WidgetFactory.buildWidget(
            self, self.__rotatexyzParameterPolicy)
        scalebackWidget = WidgetFactory.buildWidget(
            self, self.__scalebackParameterPolicy)

        self.tunning_layout = tunningWidget.getPopdownWidget().layout()

        self.dial_topdown = QtGui.QDial()
        self.dial_topdown.setWrapping(True)
        self.dial_topdown.setNotchesVisible(True)

        self.dial_leftright = QtGui.QDial()
        self.dial_leftright.setWrapping(True)
        self.dial_leftright.setNotchesVisible(True)

        HBoxLayout = QtGui.QHBoxLayout()
        HBoxLayout_dial = QtGui.QHBoxLayout()
        VBoxLayout_button = QtGui.QVBoxLayout()
        VBoxLayout_data = QtGui.QVBoxLayout()
        VBoxLayout_data.addWidget(translateWidget)
        VBoxLayout_data.addWidget(rotatexyzWidget)
        VBoxLayout_data.addWidget(scalebackWidget)
        HBoxLayout_dial.addWidget(self.dial_topdown)
        HBoxLayout_dial.addSpacing(15)
        HBoxLayout_dial.addWidget(self.dial_leftright)
        # VBoxLayout_data.setFixedWidget
        HBoxLayout.addSpacing(50)
        HBoxLayout.addLayout(HBoxLayout_dial)
        HBoxLayout.addSpacing(30)
        HBoxLayout.addLayout(VBoxLayout_data)
        self.tunning_layout.addLayout(HBoxLayout)
        mainLayout = QtGui.QVBoxLayout()
        mainLayout.addWidget(tagetsWidget)
        mainLayout.addWidget(tunningWidget)
        # Apply the layout to the widget
        self.setLayout(mainLayout)
Beispiel #18
0
    def __buildUI(self):
        layout = QtGui.QVBoxLayout(self)

        fileLayout = QtGui.QHBoxLayout()

        formatLayout = QtGui.QHBoxLayout()

        filenamePolicy = UI4.FormMaster.CreateParameterPolicy(
            None, self.__node.getParameter('Filename'))
        factory = UI4.FormMaster.KatanaFactory.ParameterWidgetFactory
        filenameLine = factory.buildWidget(self, filenamePolicy)
        fileLayout.addWidget(filenameLine)

        formatPolicy = UI4.FormMaster.CreateParameterPolicy(
            None, self.__node.getParameter('Format'))
        formatParam = factory.buildWidget(self, formatPolicy)

        BitDepthPolicy = UI4.FormMaster.CreateParameterPolicy(
            None, self.__node.getParameter('BitDepth'))
        BitDepthParam = factory.buildWidget(self, BitDepthPolicy)

        tiledPolicy = UI4.FormMaster.CreateParameterPolicy(
            None, self.__node.getParameter('Tiled'))
        tiledParam = factory.buildWidget(self, tiledPolicy)

        mergePolicy = UI4.FormMaster.CreateParameterPolicy(
            None, self.__node.getParameter('MergeAOVs'))
        mergeParam = factory.buildWidget(self, mergePolicy)

        formatLayout.addWidget(formatParam)
        formatLayout.addWidget(BitDepthParam)
        formatLayout.addWidget(tiledParam)

        overallListLayout = QtGui.QHBoxLayout()

        globalListLayout = QtGui.QVBoxLayout()
        sceneListLayout = QtGui.QVBoxLayout()

        __labelAOV1 = QtGui.QLabel('AOV List')
        __labelAOV2 = QtGui.QLabel('Scene AOVs')
        globalListLayout.addWidget(__labelAOV1)
        sceneListLayout.addWidget(__labelAOV2)

        self.globalAovsList = QtGui.QListWidget()
        self.globalAovsList.setSelectionMode(
            QtGui.QAbstractItemView.ExtendedSelection)
        self.globalAovsList.itemDoubleClicked.connect(self.__addButtonClicked)
        globalListLayout.addWidget(self.globalAovsList)

        self.scenAovsList = QtGui.QListWidget()
        self.scenAovsList.setSelectionMode(
            QtGui.QAbstractItemView.ExtendedSelection)
        self.scenAovsList.itemDoubleClicked.connect(self.__removeButtonClicked)
        self.scenAovsList.itemClicked.connect(self.showNodeParams)
        sceneListLayout.addWidget(self.scenAovsList)

        btnLayout = QtGui.QHBoxLayout()
        __addAovBtn = QtGui.QPushButton('>>')
        self.connect(__addAovBtn, QtCore.SIGNAL('clicked()'),
                     self.__addButtonClicked)
        globalListLayout.addWidget(__addAovBtn)

        customBtn = QtGui.QPushButton('Custom')
        customBtn.clicked.connect(self.__customClicket)
        btnLayout.addWidget(customBtn)

        __removeAovBtn = QtGui.QPushButton('<<')
        self.connect(__removeAovBtn, QtCore.SIGNAL('clicked()'),
                     self.__removeButtonClicked)
        btnLayout.addWidget(__removeAovBtn)

        __scrollWidget = QtGui.QWidget()
        # __scrollWidget.setMinimumHeight(350)
        __scrollWidget.setSizePolicy(QtGui.QSizePolicy.Expanding,
                                     QtGui.QSizePolicy.Expanding)
        self.scrollLayout = QtGui.QVBoxLayout(__scrollWidget)

        scrollArea = QtGui.QScrollArea()
        scrollArea.setWidgetResizable(True)
        scrollArea.setSizePolicy(QtGui.QSizePolicy.Expanding,
                                 QtGui.QSizePolicy.Expanding)
        scrollArea.setMinimumHeight(200)
        scrollArea.setWidget(__scrollWidget)

        sceneListLayout.addLayout(btnLayout)
        overallListLayout.addLayout(globalListLayout)
        overallListLayout.addLayout(sceneListLayout)

        layout.addLayout(fileLayout)
        layout.addLayout(formatLayout)
        layout.addWidget(mergeParam)
        layout.addWidget(QHLine())
        layout.addLayout(overallListLayout)
        # layout.addLayout(btnLayout)
        layout.addWidget(scrollArea)
Beispiel #19
0
    def __init__(self, parent, node):
        """
        Initializes an instance of the class.
        """
        QtGui.QWidget.__init__(self, parent)

        self.__node = node

        #######################################################################
        # Obtain references to the parameters we'd like to display.
        #
        # This is your Model in the MVC pattern.
        #######################################################################

        # Get the SuperTool's parameters
        locationParameter = self.__node.getParameter('location')
        filePathParameter = self.__node.getParameter('filePath')

        # Get a parameter that belongs to a node within our internal node
        # network.
        attributeSetNode = SA.GetRefNode(self.__node, 'attributes')
        numberValueParameter = None
        if attributeSetNode:
            numberValueParameter = attributeSetNode.getParameter('numberValue')

        if numberValueParameter is None:
            log.error('Could not get numberValue array parameter.')

        #######################################################################
        # 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.__locationParameterPolicy = CreateParameterPolicy(
            None, locationParameter)
        self.__locationParameterPolicy.addCallback(
            self.locationParameterChangedCallback)

        self.__filePathParameterPolicy = CreateParameterPolicy(
            None, filePathParameter)
        self.__filePathParameterPolicy.addCallback(
            self.filePathParameterChangedCallback)

        self.__numberValueParameterPolicy = CreateParameterPolicy(
            None, numberValueParameter)
        self.__numberValueParameterPolicy.addCallback(
            self.numberValueParameterChangedCallback)

        #######################################################################
        # 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
        locationWidget = WidgetFactory.buildWidget(
            self, self.__locationParameterPolicy)
        filePathWidget = WidgetFactory.buildWidget(
            self, self.__filePathParameterPolicy)
        numberValueArrayWidget = WidgetFactory.buildWidget(
            self, self.__numberValueParameterPolicy)

        # Create a custom widget that hasn't come from Katana's widget factory
        self.__simpleImageWithOverlayWidget = SimpleImageWithOverlayWidget(
            self, filePathParameter.getValue(0))

        # Create a layout and add the parameter editing widgets to it
        mainLayout = QtGui.QVBoxLayout()
        mainLayout.addWidget(locationWidget)
        mainLayout.addWidget(filePathWidget)
        mainLayout.addWidget(self.__simpleImageWithOverlayWidget)
        mainLayout.addWidget(numberValueArrayWidget)

        # Apply the layout to the widget
        self.setLayout(mainLayout)
Beispiel #20
0
    def __init__(self, parent, node):
        """
        Initialize the editor and set up UI
        """
        self.__node = node
        self.__preselectionKey = None
        self.__lightselectionKey = None
        self.__editorKey = None
        self.__updating = False
        
        QtGui.QWidget.__init__(self, parent)
        QtGui.QHBoxLayout(self)
        
        self.__treeLayout = QtGui.QVBoxLayout()
        self.layout().addLayout(self.__treeLayout)
        
        
        # toolbar {
        self.__treeToolbarLayout = QtGui.QHBoxLayout()
        self.__treeLayout.addLayout(self.__treeToolbarLayout)
        
        self.__addButton = UI4.Widgets.ToolbarButton(
                'Add Render Pass', self,
                UI4.Util.IconManager.GetPixmap('Icons/plus16.png'),
                rolloverPixmap = UI4.Util.IconManager.GetPixmap(
                        'Icons/plusHilite16.png'))
        @connectsignal(self.__addButton, 'clicked()')
        def addButtonClick():
            renderPass = self.__node.addRenderPass('pass1')
            self.__preselectionKey = hash(renderPass.getShadowBranchNode())
        
        self.__treeToolbarLayout.addWidget(self.__addButton)
        self.__treeToolbarLayout.addStretch()
        # }
        
        
        self.__treeStretchBox = UI4.Widgets.StretchBox(self,
                allowHorizontal=True, allowVertical=True)
        self.__treeLayout.addWidget(self.__treeStretchBox)
        
        
        #######################################################################
        # Set up the treeWidget which represents the passes
        treeWidget = QT4Widgets.SortableTreeWidget(self.__treeStretchBox)
        treeWidget.setHeaderLabels(['Name'])
        treeWidget.setSelectionMode(QtGui.QTreeWidget.ExtendedSelection)
        treeWidget.setAllColumnsShowFocus(True)
        treeWidget.setRootIsDecorated(False)
        treeWidget.header().setResizeMode(QtGui.QHeaderView.ResizeToContents)
        treeWidget.header().setClickable(False)
        treeWidget.header().hide()
        treeWidget.setDraggable(True)
        
        #######################################################################
        # treeWidget events
        @connectsignal(treeWidget, 'mousePressEvent')
        def treeWidgetMousePressEvent(event):
            """
            Handle mouse events
            """
            # Set up context menu (right-click)
            if event.button() == QtCore.Qt.RightButton:
                item = treeWidget.itemAt(event.pos())
                if not item:
                    return
                
                scriptItem = item.getItemData()                
                item.setHiliteColor(QtGui.QColor(32,32,32))
                treeWidget.update(treeWidget.indexFromItem(item))
                
                menu = QtGui.QMenu(None)
                
                # Add 'Delete' action
                menu.addAction('Delete', scriptItem.delete)
                menu.addSeparator()
                
                # Add 'View From ShadowBranch Node' action
                def viewNode():
                    NodegraphAPI.SetNodeViewed(
                        scriptItem.getShadowBranchNode(), True, exclusive=True)
                action = menu.addAction('View From ShadowBranch Node',viewNode)
                action.setIcon(UI4.Util.IconManager.GetIcon(
                        'Icons/AttributeEditor/blue_snapback.png'))                
                
                # Show menu
                pos = event.pos()
                pos = treeWidget.mapToGlobal(QtCore.QPoint(
                                pos.x(), pos.y()))
                
                try:
                    menu.exec_(pos)
                finally:
                    item.setHiliteColor(None)
                    treeWidget.update(treeWidget.indexFromItem(item))
                    event.accept()
        
        @connectsignal(treeWidget, 'keyPressEvent')
        def keyPressEvent(event):
            """
            Handle key events
            """
            selectedItems = treeWidget.selectedItems()
            if not selectedItems:
                return
            
            # Single selection for now
            scriptItem = selectedItems[0].getItemData()
            
            # Delete key: Remove selected items
            if event.key() == QtCore.Qt.Key_Delete:
                for item in selectedItems:
                    item.getItemData().delete()


        # Configure treeWidget callbacks and delegates
        self.__treeWidget = treeWidget        
        self.__treeWidget.setItemDelegate(
                self.RenderPassItemDelegate(self.__treeWidget))        
        self.__handleDragEvents(self.__treeWidget)
        self.connect(treeWidget, QtCore.SIGNAL('itemSelectionChanged()'),
                self.__selectionChangedCallback)

        # Add treeWidget to layout
        self.__treeStretchBox.layout().addWidget(treeWidget)
        self.__treeStretchBox.setFixedHeight(160)
        self.__treeStretchBox.setFixedWidth(120)
        self.__treeLayout.addStretch()
        
        # Layout settings
        self.__editorMainLayout = QtGui.QVBoxLayout()
        self.layout().addLayout(self.__editorMainLayout, 10)
        self.__editorMainLayout.addSpacing(4)        
        self.__editorWidget = QtGui.QWidget(self)
        self.__editorMainLayout.addWidget(self.__editorWidget)
        QtGui.QVBoxLayout(self.__editorWidget)
        self.__editorMainLayout.addStretch()
        
        # Create lightSettings widget containing the UI for a light
        self.__lightSettingsWidget = QtGui.QWidget(self)
        self.__editorWidget.layout().addWidget(self.__lightSettingsWidget)
        QtGui.QVBoxLayout(self.__lightSettingsWidget)
Beispiel #21
0
    def __init__(self, parent, node):
        node.upgrade()

        self.__node = node

        QtGui.QWidget.__init__(self, parent)
        QtGui.QVBoxLayout(self)

        self.__frozen = True
        self.__updateTreeOnIdle = False
        self.__selectedPonyPolicy = None
        self.__preselectName = None

        # location FormWidget
        locationPolicy = UI4.FormMaster.CreateParameterPolicy(
            None, self.__node.getParameter('location'))
        factory = UI4.FormMaster.KatanaFactory.ParameterWidgetFactory
        w = factory.buildWidget(self, locationPolicy)
        self.layout().addWidget(w)

        # toolbar
        self.__toolbarLayout = QtGui.QHBoxLayout()
        self.layout().addItem(self.__toolbarLayout)

        self.__addButton = UI4.Widgets.ToolbarButton(
            'Add Pony',
            self,
            UI4.Util.IconManager.GetPixmap('Icons/plus16.png'),
            rolloverPixmap=UI4.Util.IconManager.GetPixmap(
                'Icons/plusHilite16.png'))
        self.connect(self.__addButton, QtCore.SIGNAL('clicked()'),
                     self.__addButtonClicked)
        self.__toolbarLayout.addWidget(self.__addButton)
        self.__toolbarLayout.addStretch()

        # tree widget
        self.__treeStretchBox = UI4.Widgets.StretchBox(self,
                                                       allowHorizontal=False,
                                                       allowVertical=True)
        self.layout().addWidget(self.__treeStretchBox)

        self.__treeWidget = QT4Widgets.SortableTreeWidget(
            self.__treeStretchBox)
        self.__treeWidget.setHeaderLabels(['Name'])
        self.__treeWidget.setSelectionMode(QtGui.QTreeWidget.SingleSelection)
        self.__treeWidget.setAllColumnsShowFocus(True)
        self.__treeWidget.setRootIsDecorated(False)
        self.__treeWidget.header().setResizeMode(
            QtGui.QHeaderView.ResizeToContents)
        self.__treeWidget.header().setClickable(False)

        self.connect(self.__treeWidget,
                     QtCore.SIGNAL('itemSelectionChanged()'),
                     self.__treeWidgetSelectionChanged)
        self.connect(self.__treeWidget, QtCore.SIGNAL('keyPressEvent'),
                     self.__treeWidgetKeyPressCallback)

        self.__treeStretchBox.layout().addWidget(self.__treeWidget)
        self.__treeStretchBox.setFixedHeight(120)

        self.__formItemTree = QT4FormWidgets.FormItemTree(self)
        self.layout().addWidget(self.__formItemTree)

        self.__updateTreeContents()

        self.layout().addStretch()
Beispiel #22
0
    def buildUI(self):

        layout = QtGui.QVBoxLayout(self)

        #########################################################

        # upper row

        controlWidget = QtGui.QWidget()
        controlLayout = QtGui.QHBoxLayout(controlWidget)
        layout.addWidget(controlWidget)

        # reload
        reloadBtn = QtGui.QPushButton('RELOAD')
        reloadBtn.setStyleSheet("background-color: #1f366b;")

        reloadBtn.clicked.connect(self.clearSearch)
        reloadBtn.clicked.connect(self.populate)
        reloadBtn.clicked.connect(self.categories)

        # standard MTL
        createStd = QtGui.QPushButton('Standard Material')
        createStd.setStyleSheet("background-color: #36743f;")
        createStd.clicked.connect(self.createStandard)
        createStd.setMaximumWidth(110)

        # thumbnail size
        self.icon_size = QtGui.QSpinBox()
        self.icon_size.setRange(60, 260)
        self.icon_size.setValue(128)
        self.icon_size.setSingleStep(20)
        self.icon_size.valueChanged.connect(self.populate)
        self.icon_size.setMaximumWidth(50)

        label = QtGui.QLabel()
        label.setText('Thumbnail size:')
        label.setMaximumWidth(100)

        #layout
        controlLayout.addWidget(label)
        controlLayout.addWidget(self.icon_size)
        controlLayout.addWidget(reloadBtn)
        controlLayout.addWidget(createStd)

        #########################################################

        # second row

        searchWidget = QtGui.QWidget()
        searchLayout = QtGui.QHBoxLayout(searchWidget)
        layout.addWidget(searchWidget)

        # search field
        label1 = QtGui.QLabel()
        label1.setText('Search:')
        label1.setMaximumWidth(50)

        self.searchField = QtGui.QLineEdit()
        self.searchField.returnPressed.connect(self.populate)
        # self.searchField.textChanged.connect(self.searchCmd)
        self.searchField.setMaximumWidth(650)

        # categories

        label2 = QtGui.QLabel()
        label2.setText('Category:')
        label2.setMaximumWidth(80)

        self.catedoryCB = QtGui.QComboBox()
        self.catedoryCB.currentIndexChanged.connect(self.populate)
        self.catedoryCB.setMaximumWidth(100)

        # layout
        searchLayout.addWidget(label1)
        searchLayout.addWidget(self.searchField)
        searchLayout.addWidget(label2)
        searchLayout.addWidget(self.catedoryCB)

        #########################################################

        # main list view

        self.listWidget = QtGui.QListWidget()
        self.listWidget.setViewMode(QtGui.QListWidget.IconMode)

        self.listWidget.setResizeMode(QtGui.QListWidget.Adjust)
        self.listWidget.itemDoubleClicked.connect(self.doubleCkicked)

        self.listWidget.setStyleSheet("QListWidget::item {"
                                      "border-style: solid;"
                                      "border-width:3px;"
                                      "background-color: #252525;"
                                      "}"
                                      "QListWidget::item:selected {"
                                      "background-color: #1e1e1e;"
                                      "}")

        layout.addWidget(self.listWidget)