Exemple #1
0
    def data(self, index, role=QtCore.Qt.DisplayRole):
        if not index.isValid():
            return

        step = self.stepForIndex(index)
        if not step:
            return

        if role == QtCore.Qt.DisplayRole:
            return step.getDisplayName()

        elif role == QtCore.Qt.EditRole:
            return step.name

        elif role == QtCore.Qt.DecorationRole:
            iconFile = step.getIconFile()
            if iconFile:
                return QtGui.QIcon(iconFile)

        elif role == QtCore.Qt.SizeHintRole:
            return QtCore.QSize(0, 20)

        elif role == QtCore.Qt.ForegroundRole:
            color = step.getColor()
            if color:
                return QtGui.QColor(*[c * 255 for c in color])
Exemple #2
0
    def data(self, column, role=QtCore.Qt.DisplayRole):
        if role == QtCore.Qt.DisplayRole:
            if isinstance(self.buildItem, pulse.BuildGroup):
                return '{0} ({1})'.format(self.buildItem.getDisplayName(),
                                          self.buildItem.getChildCount())
            elif isinstance(self.buildItem, pulse.BatchBuildAction):
                return '{0} (x{1})'.format(self.buildItem.getDisplayName(),
                                           self.buildItem.getActionCount())
            else:
                return self.buildItem.getDisplayName()

        elif role == QtCore.Qt.EditRole:
            return self.buildItem.getDisplayName()

        elif role == QtCore.Qt.DecorationRole:
            iconFile = self.buildItem.getIconFile()
            if iconFile:
                return QtGui.QIcon(iconFile)

        elif role == QtCore.Qt.SizeHintRole:
            return QtCore.QSize(0, 20)

        elif role == QtCore.Qt.ForegroundRole:
            color = self.buildItem.getColor()
            if color:
                return QtGui.QColor(*[c * 255 for c in color])
Exemple #3
0
    def setupUi(self, parent):
        layout = QtWidgets.QVBoxLayout(parent)
        layout.setMargin(4)

        self.frame = QtWidgets.QFrame(parent)
        self.frame.setObjectName("panelFrame")
        layout.addWidget(self.frame)

        hlayout = QtWidgets.QHBoxLayout(self.frame)

        labelLayout = QtWidgets.QVBoxLayout(parent)
        hlayout.addLayout(labelLayout)

        font = QtGui.QFont()
        font.setPointSize(10)
        font.setWeight(75)
        font.setBold(True)
        self.rigNameLabel = QtWidgets.QLabel(parent)
        self.rigNameLabel.setFont(font)
        self.rigNameLabel.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                        QtWidgets.QSizePolicy.Minimum)
        self.rigNameLabel.setText(
            self.getRigNameText(self.blueprintModel.getRigName()))
        labelLayout.addWidget(self.rigNameLabel)

        font = QtGui.QFont()
        font.setItalic(True)
        self.rigOrBlueprintLabel = QtWidgets.QLabel(parent)
        self.rigOrBlueprintLabel.setFont(font)
        labelLayout.addWidget(self.rigOrBlueprintLabel)

        self.checkBtn = QtWidgets.QPushButton(parent)
        self.checkBtn.setText("Validate")
        self.checkBtn.setMaximumWidth(80)
        self.checkBtn.clicked.connect(self.runValidation)
        hlayout.addWidget(self.checkBtn)

        self.buildBtn = QtWidgets.QPushButton(parent)
        self.buildBtn.setText("Build")
        self.buildBtn.setMaximumWidth(80)
        self.buildBtn.clicked.connect(self.runBuild)
        hlayout.addWidget(self.buildBtn)

        self.openBPBtn = QtWidgets.QPushButton(parent)
        self.openBPBtn.setText("Open Blueprint")
        self.openBPBtn.clicked.connect(self.openBlueprintAndReload)
        hlayout.addWidget(self.openBPBtn)

        self.cleanState()
Exemple #4
0
    def setupUi(self, parent):
        """
        Build a collapsible panel ui that can be used
        by all design panels.

        All panel widgets should be attached to `self.panelWidget`
        """
        self.mainLayout = QtWidgets.QVBoxLayout(parent)
        self.mainLayout.setMargin(0)
        self.mainLayout.setSpacing(2)

        # header frame
        self.headerFrame = CollapsibleFrame(parent)
        headerColor = 'rgba({0}, {1}, {2}, 40)'.format(*self.getPanelColor())
        self.headerFrame.setStyleSheet(".CollapsibleFrame{{ background-color: {color}; border-radius: 2px; }}".format(color=headerColor))
        self.headerFrame.collapsedChanged.connect(self.onCollapsedChanged)
        # header layout
        self.headerLayout = QtWidgets.QHBoxLayout(self.headerFrame)
        self.headerLayout.setContentsMargins(10, 2, 2, 2)
        # display name label
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.displayNameLabel = QtWidgets.QLabel(self.headerFrame)
        self.displayNameLabel.setMinimumHeight(18)
        self.displayNameLabel.setFont(font)
        self.displayNameLabel.setText(self.getPanelDisplayName())
        self.headerLayout.addWidget(self.displayNameLabel)

        self.mainLayout.addWidget(self.headerFrame)

        self.panelWidget = QtWidgets.QWidget(parent)
        self.mainLayout.addWidget(self.panelWidget)
Exemple #5
0
def getIcon(filename):
    """
    Return a QIcon for an icon by name

    Args:
        filename: A string representing the icon's file name
    """
    return QtGui.QIcon(getIconPath(filename))
Exemple #6
0
def createHeaderLabel(parent, text):
    font = QtGui.QFont()
    font.setWeight(75)
    font.setBold(True)
    label = QtWidgets.QLabel(parent)
    label.setText(text)
    label.setMinimumHeight(20)
    label.setContentsMargins(10, 2, 2, 2)
    label.setFont(font)
    label.setStyleSheet(
        'background-color: rgba(0, 0, 0, 40); border-radius: 2px')
    return label
Exemple #7
0
    def setupHeaderUi(self, parent):
        step = self.step()

        layout = QtWidgets.QHBoxLayout(parent)
        layout.setContentsMargins(10, 4, 4, 4)

        # display name label
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.displayNameLabel = QtWidgets.QLabel(parent)
        self.displayNameLabel.setMinimumHeight(18)
        self.displayNameLabel.setFont(font)
        self.displayNameLabel.setText(step.getDisplayName())
        layout.addWidget(self.displayNameLabel)
Exemple #8
0
    def setupUi(self, parent):
        """
        Build the UI for the main body of the window
        """
        layout = QtWidgets.QVBoxLayout(parent)

        # preview text
        self.namePreviewBtn = QtWidgets.QPushButton(parent)
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setWeight(75)
        font.setBold(True)
        self.namePreviewBtn.setFont(font)
        self.namePreviewBtn.setStatusTip("The current constructed name. "
                                         "Click to apply to the selected node")
        # self.namePreviewBtn.setAlignment(QtCore.Qt.AlignCenter)
        self.namePreviewBtn.setContentsMargins(10, 10, 10, 10)
        # self.namePreviewBtn.setStyleSheet(
        #     'background-color: rgba(0, 0, 0, 40); border-radius: 2px')
        self.namePreviewBtn.clicked.connect(self.onPreviewBtnClicked)
        layout.addWidget(self.namePreviewBtn)

        # prefixes / suffixes
        self.prefixSuffixLayout = QtWidgets.QHBoxLayout()

        prefixLayout = self.setupPrefixesUi(parent)
        self.prefixSuffixLayout.addLayout(prefixLayout)

        suffixLayout = self.setupSuffixesUi(parent)
        self.prefixSuffixLayout.addLayout(suffixLayout)

        layout.addLayout(self.prefixSuffixLayout)

        # keywords
        keywordsLayout = self.setupKeywordsUi(parent)
        layout.addLayout(keywordsLayout)

        # help text
        self.helpText = QtWidgets.QLabel()
        self.helpText.setFont(style.UIFonts.getHelpTextFont())
        layout.addWidget(self.helpText)

        layout.setStretch(2, 1)
Exemple #9
0
    def setupUi(self, parent):
        """
        Create the UI that is common to all BuildItem editors, including
        a basic header and layout.
        """
        # main layout containing header and body
        layout = QtWidgets.QVBoxLayout(parent)
        layout.setSpacing(4)
        layout.setMargin(0)

        # header frame
        self.headerFrame = QtWidgets.QFrame(parent)
        headerColor = 'rgba({0}, {1}, {2}, 40)'.format(*self.getItemColor())
        self.headerFrame.setStyleSheet(
            ".QFrame{{ background-color: {color}; border-radius: 2px; }}".
            format(color=headerColor))
        layout.addWidget(self.headerFrame)
        # header layout
        self.headerLayout = QtWidgets.QHBoxLayout(self.headerFrame)
        self.headerLayout.setContentsMargins(10, 4, 4, 4)
        # display name label
        font = QtGui.QFont()
        font.setWeight(75)
        font.setBold(True)
        self.displayNameLabel = QtWidgets.QLabel(self.headerFrame)
        self.displayNameLabel.setMinimumHeight(18)
        self.displayNameLabel.setFont(font)
        self.displayNameLabel.setText(self.getItemDisplayName())
        self.headerLayout.addWidget(self.displayNameLabel)

        # body layout
        bodyFrame = QtWidgets.QFrame(parent)
        bodyFrame.setObjectName("bodyFrame")
        bodyColor = 'rgba(255, 255, 255, 5)'.format(*self.getItemColor())
        bodyFrame.setStyleSheet(
            ".QFrame#bodyFrame{{ background-color: {color}; }}".format(
                color=bodyColor))
        layout.addWidget(bodyFrame)

        self.mainLayout = QtWidgets.QVBoxLayout(bodyFrame)
        self.mainLayout.setMargin(6)
        self.mainLayout.setSpacing(0)
Exemple #10
0
 def getHelpTextFont():
     font = QtGui.QFont()
     font.setItalic(True)
     return font
Exemple #11
0
 def getItemIcon(self):
     iconFile = self.buildItem.getIconFile()
     if iconFile:
         return QtGui.QIcon(iconFile)