示例#1
0
 def createPanelFrame(parent):
     """
     Create a QFrame with consistent styling for a design view panel
     """
     frame = QtWidgets.QFrame(parent)
     frame.setObjectName("panelFrame")
     frame.setStyleSheet(
         ".QFrame#panelFrame{ background-color: rgba(255, 255, 255, 5); }")
     return frame
示例#2
0
    def setupUi(self, parent):
        layout = QtWidgets.QVBoxLayout(parent)

        self.treeView = QtWidgets.QTreeView(parent)
        self.treeView.setHeaderHidden(True)
        self.treeView.setDragEnabled(True)
        self.treeView.setDragDropMode(
            QtWidgets.QAbstractItemView.DragDropMode.InternalMove)
        self.treeView.setDefaultDropAction(
            QtCore.Qt.DropAction.MoveAction)
        self.treeView.setSelectionMode(
            QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection)
        self.treeView.setIndentation(14)
        self.treeView.installEventFilter(self)
        self.treeView.setModel(self.model)
        self.treeView.setSelectionModel(self.selectionModel)
        self.treeView.expandAll()
        layout.addWidget(self.treeView)
示例#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()
示例#4
0
    def setupUi(self, parent):
        layout = QtWidgets.QVBoxLayout(parent)

        # clear color btn
        clearBtn = QtWidgets.QPushButton(parent)
        clearBtn.setText("Remove Color")
        clearBtn.clicked.connect(
            cmd(pulse.editorutils.disableColorOverrideForSelected))
        layout.addWidget(clearBtn)

        bodyLayout = self.setupBodyUi(parent)
        layout.addLayout(bodyLayout)

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

        layout.setStretch(2, 1)
示例#5
0
    def setupUi(self, parent):
        widget = QtWidgets.QWidget(parent)
        widget.setMinimumWidth(300)
        self.setCentralWidget(widget)

        layout = QtWidgets.QVBoxLayout(parent)
        widget.setLayout(layout)

        buildToolbar = BuildToolbarWidget(parent)
        layout.addWidget(buildToolbar)

        tabWidget = QtWidgets.QTabWidget(parent)

        # config tab
        configTab = BlueprintEditorWidget(parent)
        tabWidget.addTab(configTab, "Config")

        # design tab
        designTab = DesignViewWidget(parent)
        tabWidget.addTab(designTab, "Design")

        # actions tab
        actionsTab = QtWidgets.QWidget(parent)
        actionsLayout = QtWidgets.QVBoxLayout(actionsTab)

        actionEditorBtn = QtWidgets.QPushButton(actionsTab)
        actionEditorBtn.setText("Action Editor")
        actionEditorBtn.clicked.connect(self.showActionEditor)
        actionsLayout.addWidget(actionEditorBtn)

        actionsSplitter = QtWidgets.QSplitter(parent)
        actionsSplitter.setOrientation(QtCore.Qt.Orientation.Vertical)
        actionsLayout.addWidget(actionsSplitter)

        actionTree = ActionTreeWidget(actionsTab)
        actionTree.layout().setMargin(0)
        actionsSplitter.addWidget(actionTree)

        actionButtons = ActionButtonsWidget(actionsTab)
        actionButtons.layout().setMargin(0)
        actionsSplitter.addWidget(actionButtons)

        tabWidget.addTab(actionsTab, "Actions")


        layout.addWidget(tabWidget)

        # debug controls
        refreshBtn = QtWidgets.QPushButton(parent)
        refreshBtn.setText('Refresh')
        model = ActionTreeItemModel.getSharedModel()
        refreshBtn.clicked.connect(model.reloadBlueprint)
        layout.addWidget(refreshBtn)
示例#6
0
    def __init__(self, parent=None):
        super(ActionTreeWindow, self).__init__(parent=parent)

        self.setWindowTitle('Pulse Action Tree')

        widget = QtWidgets.QWidget(self)
        self.setCentralWidget(widget)

        layout = QtWidgets.QVBoxLayout(self)
        widget.setLayout(layout)

        self.actionTree = ActionTreeWidget(self)
        layout.addWidget(self.actionTree)

        self.actionButtons = ActionButtonsWidget(self)
        layout.addWidget(self.actionButtons)

        layout.setStretch(layout.indexOf(self.actionTree), 2)
        layout.setStretch(layout.indexOf(self.actionButtons), 1)
示例#7
0
    def setupUi(self, parent):
        self.setupDefaultFormUi(parent)

        self.checkbox = QtWidgets.QCheckBox(parent)
        if self._isValueTypeValid(self.attrValue):
            self._setFormValue(self.attrValue)
        self.checkbox.setMinimumHeight(self.LABEL_HEIGHT)
        self.checkbox.stateChanged.connect(self._valueChanged)

        self.setDefaultFormWidget(self.checkbox)
示例#8
0
    def __init__(self, parent=None):
        super(CopyPastMatrixWindow, self).__init__(parent=parent)

        self.setWindowTitle('Copy Paste Matrix')

        layout = QtWidgets.QVBoxLayout(self)
        self.setLayout(layout)

        widget = CopyPastMatrixWidget(self)
        layout.addWidget(widget)
示例#9
0
    def setupUi(self, parent):
        self.setupDefaultFormUi(parent)

        self.lineEdit = QtWidgets.QLineEdit(parent)
        self.lineEdit.setMinimumHeight(self.LABEL_HEIGHT)
        if self._isValueTypeValid(self.attrValue):
            self._setFormValue(self.attrValue)
        self.lineEdit.editingFinished.connect(self._valueChanged)

        self.setDefaultFormWidget(self.lineEdit)
示例#10
0
    def setupKeywordCategoryUi(self, parent, name, keywords):
        """
        Build a keyword category layout and button grid.
        Returns the layout.

        Args:
            name: A string name of the category
            keywords: A list of string names of the keywords in the category
        """
        layout = QtWidgets.QVBoxLayout(parent)

        catLabel = self.createLabel(parent, pulse.names.toTitle(name))
        catLabel.setStyleSheet(
            'background-color: rgba(255, 255, 255, 5); border-radius: 2px')
        layout.addWidget(catLabel)

        catBtnGrid = QtWidgets.QGridLayout()

        # create button for all keywords
        x = 0
        y = 0
        for name in keywords:
            btn = QtWidgets.QPushButton()
            btn.setObjectName('keywordBtn_' + name)
            btn.setText(name)
            catBtnGrid.addWidget(btn, y, x, 1, 1)
            self.keywordBtns[name] = btn
            btn.installEventFilter(self)
            btn.clicked.connect(partial(self.onKeywordClicked, name))

            x += 1
            if x > 3:
                x = 0
                y += 1

        if y == 0:
            while x <= 3:
                spacer = QtWidgets.QLabel()
                catBtnGrid.addWidget(spacer, y, x, 1, 1)
                x += 1

        layout.addLayout(catBtnGrid)
        return layout
示例#11
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)
示例#12
0
    def setupBodyUi(self, parent):
        step = self.step()

        layout = QtWidgets.QVBoxLayout(parent)
        layout.setMargin(6)
        layout.setSpacing(0)

        if step.isAction():
            self.actionForm = BuildActionProxyForm(self.index, parent)
            layout.addWidget(self.actionForm)
示例#13
0
    def __init__(self, parent=None):
        super(BlueprintEditorWindow, self).__init__(parent=parent)

        self.setWindowTitle('Pulse Blueprint Editor')

        layout = QtWidgets.QVBoxLayout(self)
        self.setLayout(layout)

        widget = BlueprintEditorWidget(self)
        layout.addWidget(widget)
示例#14
0
    def setupUi(self, parent):
        super(BatchActionForm, self).setupUi(parent)

        # add action conversion button to header
        convertToActionBtn = QtWidgets.QPushButton(parent)
        convertToActionBtn.setIcon(
            viewutils.getIcon("convertBatchToAction.png"))
        convertToActionBtn.setFixedSize(QtCore.QSize(18, 18))
        convertToActionBtn.clicked.connect(self.convertToActionClicked.emit)
        self.headerLayout.addWidget(convertToActionBtn)
示例#15
0
 def _setFormValue(self, attrValue):
     while self.listWidget.takeItem(0):
         pass
     for node in attrValue:
         item = QtWidgets.QListWidgetItem(node.nodeName())
         uuid = meta.getUUID(node)
         item.setData(QtCore.Qt.UserRole, uuid)
         self.listWidget.addItem(item)
     # 13px line height per item, clamped in range 40..120, added 8px buffer
     newHeight = max(40, min(120, 8 + 13 * self.listWidget.count()))
     self.listWidget.setFixedHeight(newHeight)
示例#16
0
 def createControlShapeButton(text, shapeData):
     btn = QtWidgets.QPushButton(parent)
     btn.setStatusTip("Create a new control")
     if 'icon' in shapeData:
         btn.setIcon(getIcon("controls/" + shapeData["icon"]))
         btn.setIconSize(QtCore.QSize(32, 32))
     else:
         btn.setText(text)
     btn.clicked.connect(
         cmd(pulse.controlshapes.createControlsForSelected, shapeData))
     return btn
示例#17
0
    def __init__(self, parent=None):
        super(QuickNameWindow, self).__init__(parent=parent)

        self.setWindowTitle('Quick Name Editor')

        layout = QtWidgets.QVBoxLayout(self)
        layout.setMargin(0)
        self.setLayout(layout)

        widget = QuickNameWidget(self)
        layout.addWidget(widget)
示例#18
0
    def setupUi(self, parent):
        self.setupDefaultFormUi(parent)

        self.combo = QtWidgets.QComboBox(parent)
        for option in self.attr['options']:
            self.combo.addItem(option)
        if self._isValueTypeValid(self.attrValue):
            self._setFormValue(self.attrValue)
        self.combo.currentIndexChanged.connect(self._valueChanged)

        self.setDefaultFormWidget(self.combo)
示例#19
0
    def setupPanelUi(self, parent):
        layout = QtWidgets.QVBoxLayout(parent)
        layout.setMargin(0)
        layout.setSpacing(4)

        createFrame = self.createPanelFrame(parent)
        layout.addWidget(createFrame)
        self.setupCreateControlsUi(createFrame)

        editFrame = self.createPanelFrame(parent)
        layout.addWidget(editFrame)
        self.setupEditControlsUi(editFrame)
示例#20
0
        def createRotateComponentsButton(text, color, axis, degrees):
            _axes = {0: 'X', 1: 'Y', 2: 'Z'}

            btn = QtWidgets.QPushButton(parent)
            btn.setText(text)
            btn.setStatusTip(
                "Rotate the components of the selected controls "
                "{0} degrees around the {1} axis".format(degrees, _axes[axis]))
            btn.setStyleSheet(UIColors.asBGColor(color))
            btn.clicked.connect(
                cmd(editorutils.rotateSelectedComponentsAroundAxis, axis, degrees))
            return btn
示例#21
0
    def setupUi(self, parent):
        layout = QtWidgets.QVBoxLayout(parent)

        grpBtn = QtWidgets.QPushButton(parent)
        grpBtn.setText("New Group")
        grpBtn.clicked.connect(self.createBuildGroup)
        layout.addWidget(grpBtn)

        searchField = QtWidgets.QLineEdit(parent)
        searchField.setPlaceholderText("Search")
        layout.addWidget(searchField)

        tabScrollWidget = QtWidgets.QWidget(parent)
        tabScroll = QtWidgets.QScrollArea(parent)
        tabScroll.setFrameShape(QtWidgets.QScrollArea.NoFrame)
        tabScroll.setWidgetResizable(True)
        tabScroll.setWidget(tabScrollWidget)

        self.setupContentUi(tabScrollWidget)

        layout.addWidget(tabScroll)
示例#22
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
示例#23
0
    def setupUi(self, parent):
        self.setupDefaultFormUi(parent)

        self._didFailDecode = False

        self.textEdit = QtWidgets.QLineEdit(parent)
        self.textEdit.setStyleSheet('font: 8pt "Consolas";')
        if self._isValueTypeValid(self.attrValue):
            self._setFormValue(self.attrValue)
        self.textEdit.editingFinished.connect(self._valueChanged)

        self.setDefaultFormWidget(self.textEdit)
示例#24
0
    def setupBodyUi(self, parent):
        layout = QtWidgets.QVBoxLayout(parent)

        colors = self.config.get('colors', [])
        for colorData in colors:
            if 'name' in colorData and 'color' in colorData:
                name = colorData['name']
                color = pulse.colors.hexToRGB01(colorData['color'])
                btn = self.createColorButton(name, color, parent)
                layout.addWidget(btn)

        return layout
示例#25
0
    def setupVariantsUi(self, parent, layout):
        # variant header
        variantHeader = QtWidgets.QFrame(parent)
        variantHeader.setStyleSheet(
            ".QFrame{ background-color: rgb(255, 255, 255, 15); border-radius: 2px }"
        )
        layout.addWidget(variantHeader)

        variantHeaderLayout = QtWidgets.QHBoxLayout(variantHeader)
        variantHeaderLayout.setContentsMargins(10, 4, 4, 4)
        variantHeaderLayout.setSpacing(4)

        self.variantsLabel = QtWidgets.QLabel(variantHeader)
        self.variantsLabel.setText("Variants: ")
        variantHeaderLayout.addWidget(self.variantsLabel)

        spacer = QtWidgets.QSpacerItem(20, 4, QtWidgets.QSizePolicy.Expanding,
                                       QtWidgets.QSizePolicy.Minimum)
        layout.addItem(spacer)

        # add variant button
        addVariantBtn = QtWidgets.QPushButton(variantHeader)
        addVariantBtn.setText('+')
        addVariantBtn.setFixedSize(QtCore.QSize(20, 20))
        addVariantBtn.clicked.connect(self.addVariant)
        variantHeaderLayout.addWidget(addVariantBtn)

        # variant list layout
        self.variantListLayout = QtWidgets.QVBoxLayout(parent)
        self.variantListLayout.setContentsMargins(0, 0, 0, 0)
        self.variantListLayout.setSpacing(4)
        layout.addLayout(self.variantListLayout)
示例#26
0
    def setupUi(self, parent):
        outerLayout = QtWidgets.QVBoxLayout(parent)

        self.scrollArea = QtWidgets.QScrollArea(parent)
        self.scrollArea.setFrameShape(QtWidgets.QScrollArea.NoFrame)
        self.scrollArea.setWidgetResizable(True)
        outerLayout.addWidget(self.scrollArea)

        self.scrollWidget = QtWidgets.QWidget()
        self.scrollArea.setWidget(self.scrollWidget)

        # scroll layout contains the main layout and a spacer item
        self.scrollLayout = QtWidgets.QVBoxLayout(self.scrollWidget)
        self.scrollLayout.setMargin(0)

        self.mainLayout = QtWidgets.QVBoxLayout(self.scrollWidget)
        self.mainLayout.setSpacing(12)
        self.mainLayout.setMargin(4)
        self.scrollLayout.addLayout(self.mainLayout)

        spacer = QtWidgets.QSpacerItem(20, 20, QtWidgets.QSizePolicy.Minimum,
                                       QtWidgets.QSizePolicy.Expanding)
        self.scrollLayout.addItem(spacer)

        self.scrollWidget.setLayout(self.scrollLayout)
示例#27
0
    def setupContentUi(self, parent):
        """
        Build the content ui for this BatchBuildAction.
        Creates ui to manage the array of variant attributes.
        """

        # constants main layout
        self.constantsLayout = QtWidgets.QVBoxLayout(parent)
        self.constantsLayout.setContentsMargins(0, 0, 0, 0)
        self.mainLayout.addLayout(self.constantsLayout)

        spacer = QtWidgets.QSpacerItem(20, 4, QtWidgets.QSizePolicy.Expanding,
                                       QtWidgets.QSizePolicy.Minimum)
        self.mainLayout.addItem(spacer)

        # variant header
        variantHeader = QtWidgets.QFrame(parent)
        variantHeader.setStyleSheet(
            ".QFrame{ background-color: rgb(255, 255, 255, 15); border-radius: 2px }"
        )
        self.mainLayout.addWidget(variantHeader)

        variantHeaderLayout = QtWidgets.QHBoxLayout(variantHeader)
        variantHeaderLayout.setContentsMargins(10, 4, 4, 4)
        variantHeaderLayout.setSpacing(4)

        self.variantsLabel = QtWidgets.QLabel(variantHeader)
        self.variantsLabel.setText("Variants: {0}".format(
            len(self.buildItem.variantValues)))
        variantHeaderLayout.addWidget(self.variantsLabel)

        spacer = QtWidgets.QSpacerItem(20, 4, QtWidgets.QSizePolicy.Expanding,
                                       QtWidgets.QSizePolicy.Minimum)
        self.mainLayout.addItem(spacer)

        # add variant button
        addVariantBtn = QtWidgets.QPushButton(variantHeader)
        addVariantBtn.setText('+')
        addVariantBtn.setFixedSize(QtCore.QSize(20, 20))
        addVariantBtn.clicked.connect(self.addVariant)
        variantHeaderLayout.addWidget(addVariantBtn)

        # variant list main layout
        self.variantLayout = QtWidgets.QVBoxLayout(parent)
        self.variantLayout.setContentsMargins(0, 0, 0, 0)
        self.variantLayout.setSpacing(4)
        self.mainLayout.addLayout(self.variantLayout)

        self.setupConstantsUi(parent)
        self.setupVariantsUi(parent)
示例#28
0
    def setupUi(self, parent):
        """
        Build the content ui for this BatchBuildAction.
        Creates ui to manage the array of variant attributes.
        """

        layout = QtWidgets.QVBoxLayout(parent)
        layout.setSpacing(4)
        layout.setMargin(0)

        # form for all main / invariant attributes
        mainAttrForm = MainBuildActionDataForm(self.index, parent=parent)
        layout.addWidget(mainAttrForm)

        spacer = QtWidgets.QSpacerItem(20, 4, QtWidgets.QSizePolicy.Expanding,
                                       QtWidgets.QSizePolicy.Minimum)
        layout.addItem(spacer)

        # variant form list
        if self.shouldSetupVariantsUi():
            self.setupVariantsUi(parent, layout)
            self.hasVariantsUi = True
示例#29
0
    def setupSuffixesUi(self, parent):
        """
        Build the suffixes layout and button grid.
        Returns the layout.
        """
        suffixLayout = QtWidgets.QVBoxLayout(parent)

        suffixesLabel = self.createLabel(parent, "Suffixes", bold=True)
        suffixLayout.addWidget(suffixesLabel)

        self.suffixBtnGrid = QtWidgets.QGridLayout()
        self.suffixBtnGrid.setObjectName("suffixBtnGrid")

        # create button for all suffixes
        self.suffixBtns = {}
        suffixes = self.namesConfig.get('suffixes', {})
        x = 0
        y = 0
        for suffix in suffixes:
            name = suffix['name']
            btn = QtWidgets.QPushButton()
            btn.setText(name)
            btn.setCheckable(True)
            btn.clicked.connect(self.onPrefixOrSuffixClicked)
            self.suffixBtnGrid.addWidget(btn, y, x, 1, 1)
            self.suffixBtns[name] = btn

            x += 1
            if x > 1:
                x = 0
                y += 1

        suffixLayout.addLayout(self.suffixBtnGrid)

        spacerItem = QtWidgets.QSpacerItem(0, 2, QtWidgets.QSizePolicy.Minimum,
                                           QtWidgets.QSizePolicy.Expanding)
        suffixLayout.addItem(spacerItem)

        return suffixLayout
示例#30
0
    def setupUi(self, parent):
        self.setupDefaultFormUi(parent)

        self.spinBox = QtWidgets.QSpinBox(parent)
        self.spinBox.setMinimumHeight(self.LABEL_HEIGHT)
        self.spinBox.setMinimumWidth(self.FORM_WIDTH_SMALL)
        self.spinBox.setRange(self.attr.get('min', 0),
                              self.attr.get('max', 100))
        if self._isValueTypeValid(self.attrValue):
            self._setFormValue(self.attrValue)
        self.spinBox.valueChanged.connect(self._valueChanged)

        self.setDefaultFormWidget(self.spinBox)