Beispiel #1
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)
Beispiel #2
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)
Beispiel #3
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)
Beispiel #4
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()
Beispiel #5
0
    def setupUi(self, parent):
        layout = QtWidgets.QVBoxLayout(parent)
        layout.setMargin(0)
        self.setLayout(layout)

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

        # main tab widget (Config / Design / Actions)
        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)

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

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

        # actions tab widget (Palette / Editor)
        actionsTabWidget = QtWidgets.QTabWidget(parent)
        actionsSplitter.addWidget(actionsTabWidget)

        actionPalette = ActionPaletteWidget(actionsTab)
        actionPalette.layout().setMargin(0)
        actionsTabWidget.addTab(actionPalette, "Palette")

        actionEditor = ActionEditorWidget(actionsTab)
        actionEditor.layout().setMargin(0)
        actionsTabWidget.addTab(actionEditor, "Editor")

        tabWidget.addTab(actionsTab, "Actions")

        layout.addWidget(tabWidget)

        self.mainTabWidget = tabWidget
        self.actionsTabWidget = actionsTabWidget
Beispiel #6
0
    def setupPanelUi(self, parent):
        layout = QtWidgets.QVBoxLayout(parent)
        layout.setMargin(0)

        frame = self.createPanelFrame(parent)
        layout.addWidget(frame)

        gridLayout = QtWidgets.QGridLayout(frame)
        gridLayout.setMargin(0)
        gridLayout.setSpacing(2)

        snapToTargetsBtn = QtWidgets.QPushButton(frame)
        snapToTargetsBtn.setText("Snap To Targets")
        snapToTargetsBtn.setStatusTip(
            "Snap controls and linked objects to their target positions")
        snapToTargetsBtn.clicked.connect(cmd(
            editorutils.snapToLinkForSelected))

        linkEditorBtn = QtWidgets.QPushButton(frame)
        linkEditorBtn.setText("Link Editor")
        linkEditorBtn.setStatusTip(
            "Open the Layout Link Editor for managing how nodes are connected "
            "to each other during blueprint design")
        linkEditorBtn.clicked.connect(cmd(LayoutLinkEditorWindow.toggleWindow))

        gridItems = [
            [snapToTargetsBtn, linkEditorBtn],
        ]
        viewutils.addItemsToGrid(gridLayout, gridItems)
    def setupDefaultFormUi(self, parent):
        """
        Optional UI setup that builds a standardized layout.
        Includes a form layout and a label with the attributes name.
        Should be called at the start of setupUi if desired.
        """
        layout = QtWidgets.QVBoxLayout(parent)
        layout.setContentsMargins(0, 0, 0, 0)

        self.frame = QtWidgets.QFrame(parent)
        layout.addWidget(self.frame)

        self.formLayout = QtWidgets.QFormLayout(self.frame)
        # margin that will give us some visible area of
        # the frame that can change color based on valid state
        self.formLayout.setContentsMargins(2, 2, 2, 2)
        self.formLayout.setFieldGrowthPolicy(
            QtWidgets.QFormLayout.ExpandingFieldsGrow)
        self.formLayout.setLabelAlignment(QtCore.Qt.AlignRight
                                          | QtCore.Qt.AlignTop
                                          | QtCore.Qt.AlignTrailing)
        self.formLayout.setHorizontalSpacing(10)

        # attribute name
        self.label = QtWidgets.QLabel(self.frame)
        self.label.setMinimumSize(
            QtCore.QSize(self.LABEL_WIDTH, self.LABEL_HEIGHT))
        self.label.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing
                                | QtCore.Qt.AlignTop)
        # add some space above the label so it lines up
        self.label.setMargin(2)
        self.label.setText(pulse.names.toTitle(self.attr['name']))
        self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole,
                                  self.label)
Beispiel #8
0
    def setupUi(self, parent):
        layout = QtWidgets.QVBoxLayout(self)

        formLayout1 = QtWidgets.QFormLayout(self)
        rigNameLabel = QtWidgets.QLabel(self)
        rigNameLabel.setText("Rig Name")
        self.rigNameText = QtWidgets.QLineEdit(self)
        self.rigNameText.setText(self.blueprintModel.getRigName())
        self.rigNameText.textChanged.connect(self.rigNameTextChanged)
        formLayout1.setWidget(0, QtWidgets.QFormLayout.LabelRole, rigNameLabel)
        formLayout1.setWidget(0, QtWidgets.QFormLayout.FieldRole,
                              self.rigNameText)
        layout.addLayout(formLayout1)

        initBtn = QtWidgets.QPushButton(self)
        initBtn.setText("Initialize Blueprint")
        initBtn.clicked.connect(self.initBlueprint)
        layout.addWidget(initBtn)

        debugPrintBtn = QtWidgets.QPushButton(self)
        debugPrintBtn.setText("Debug Print YAML")
        debugPrintBtn.clicked.connect(self.debugPrintSerialized)
        layout.addWidget(debugPrintBtn)

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

        self.refreshState()
Beispiel #9
0
    def setupPanelUi(self, parent):
        layout = QtWidgets.QVBoxLayout(parent)
        layout.setMargin(0)

        frame = self.createPanelFrame(parent)
        layout.addWidget(frame)

        gridLayout = QtWidgets.QGridLayout(frame)
        gridLayout.setSpacing(4)

        jointToolBtn = QtWidgets.QPushButton(frame)
        jointToolBtn.setText("Joint Tool")
        jointToolBtn.clicked.connect(buttonCommand(pm.mel.JointTool))
        gridLayout.addWidget(jointToolBtn, 0, 0, 1, 1)

        insertToolBtn = QtWidgets.QPushButton(frame)
        insertToolBtn.setText("Insert Joint Tool")
        insertToolBtn.clicked.connect(buttonCommand(pm.mel.InsertJointTool))
        gridLayout.addWidget(insertToolBtn, 0, 1, 1, 1)

        centerBtn = QtWidgets.QPushButton(frame)
        centerBtn.setText("Center")
        centerBtn.clicked.connect(buttonCommand(pulse.joints.centerSelectedJoints))
        gridLayout.addWidget(centerBtn, 1, 0, 1, 1)

        insertBtn = QtWidgets.QPushButton(frame)
        insertBtn.setText("Insert")
        insertBtn.clicked.connect(buttonCommand(pulse.joints.insertJointForSelected))
        gridLayout.addWidget(insertBtn, 1, 1, 1, 1)

        disableSSCBtn = QtWidgets.QPushButton(frame)
        disableSSCBtn.setText("Disable Scale Compensate")
        disableSSCBtn.clicked.connect(buttonCommand(pulse.joints.disableSegmentScaleCompensateForSelected))
        gridLayout.addWidget(disableSSCBtn, 2, 0, 1, 2)
Beispiel #10
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)
    def __init__(self, parent=None):
        super(BlueprintEditorWidget, self).__init__(parent=parent)

        self.model = ActionTreeItemModel.getSharedModel()
        self.model.modelReset.connect(self.onBlueprintLoaded)

        layout = QtWidgets.QVBoxLayout(self)

        self.rigNameText = QtWidgets.QLineEdit(self)
        self.rigNameText.setText(self.blueprint.rigName)
        self.rigNameText.textChanged.connect(self.rigNameTextChanged)
        layout.addWidget(self.rigNameText)

        createBtn = QtWidgets.QPushButton(self)
        createBtn.setText("Create Default Blueprint")
        createBtn.clicked.connect(self.createDefaultBlueprint)
        layout.addWidget(createBtn)

        saveBtn = QtWidgets.QPushButton(self)
        saveBtn.setText("Debug Save Blueprint")
        saveBtn.clicked.connect(self.debugSaveBlueprint)
        layout.addWidget(saveBtn)

        debugPrintBtn = QtWidgets.QPushButton(self)
        debugPrintBtn.setText("Debug Print Serialized")
        debugPrintBtn.clicked.connect(self.debugPrintSerialized)
        layout.addWidget(debugPrintBtn)

        debugOpenBpBtn = QtWidgets.QPushButton(self)
        debugOpenBpBtn.setText("Debug Open Blueprint Scene")
        debugOpenBpBtn.clicked.connect(self.debugOpenBlueprintScene)
        layout.addWidget(debugOpenBpBtn)

        spacer = QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        layout.addItem(spacer)
Beispiel #12
0
    def setupUi(self, parent):
        """
        Create a basic header and body layout to contain the generic
        or action proxy forms.
        """
        step = self.step()
        if not step:
            return

        # main layout containing header and body
        layout = QtWidgets.QVBoxLayout(parent)
        layout.setSpacing(4)
        layout.setMargin(0)

        # header frame
        headerFrame = QtWidgets.QFrame(parent)
        headerColor = "rgba({0}, {1}, {2}, 40)".format(
            *self.getStepColor(step))
        headerFrame.setStyleSheet(
            ".QFrame{{ background-color: {color}; "
            "border-radius: 2px; }}".format(color=headerColor))
        layout.addWidget(headerFrame)

        self.setupHeaderUi(headerFrame)

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

        self.setupBodyUi(bodyFrame)
Beispiel #13
0
    def setupUi(self, parent):
        layout = QtWidgets.QVBoxLayout(parent)
        self.setLayout(layout)

        copyBtn = QtWidgets.QPushButton(parent)
        copyBtn.setText('Copy')
        copyBtn.setStatusTip('Copy the world matrices of the selected nodes')
        copyBtn.clicked.connect(self.copySelected)
        layout.addWidget(copyBtn)

        pasteBtn = QtWidgets.QPushButton(parent)
        pasteBtn.setText('Paste')
        copyBtn.setStatusTip('Paste copied matrices onto the selected nodes')
        pasteBtn.clicked.connect(self.pasteSelected)
        layout.addWidget(pasteBtn)

        relativeCopyBtn = QtWidgets.QPushButton(parent)
        relativeCopyBtn.setText('Relative Copy')
        copyBtn.setStatusTip(
            'Copy the relative matrices of the selected nodes')
        relativeCopyBtn.clicked.connect(self.relativeCopySelected)
        layout.addWidget(relativeCopyBtn)

        relativePasteBtn = QtWidgets.QPushButton(parent)
        relativePasteBtn.setText('Relative Paste')
        copyBtn.setStatusTip(
            'Paste copied matrices on the selected nodes relative '
            'to the node used during copy or first selected node')
        relativePasteBtn.clicked.connect(self.relativePasteSelected)
        layout.addWidget(relativePasteBtn)
Beispiel #14
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)
Beispiel #15
0
    def setupUi(self, parent):
        layout = QtWidgets.QVBoxLayout(self)

        propertiesHeader = createHeaderLabel(parent, "Rig Properties")
        layout.addWidget(propertiesHeader)

        rigNameLabel = QtWidgets.QLabel(parent)
        rigNameLabel.setText("Rig Name")

        self.rigNameText = QtWidgets.QLineEdit(parent)
        self.rigNameText.setText(self.blueprintModel.getRigName())
        self.rigNameText.textChanged.connect(self.rigNameTextChanged)

        formLayout1 = QtWidgets.QFormLayout(parent)
        formLayout1.setWidget(0, QtWidgets.QFormLayout.LabelRole, rigNameLabel)
        formLayout1.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.rigNameText)
        layout.addLayout(formLayout1)

        fileNameLabel = QtWidgets.QLabel(parent)
        fileNameLabel.setText("File Name")

        self.fileNameText = QtWidgets.QLineEdit(parent)
        self.fileNameText.setText(self.getSceneRelativeFilePath(self.blueprintModel.getBlueprintFilepath()))
        self.fileNameText.setReadOnly(True)

        formLayout2 = QtWidgets.QFormLayout(parent)
        formLayout2.setWidget(0, QtWidgets.QFormLayout.LabelRole, fileNameLabel)
        formLayout2.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.fileNameText)
        layout.addLayout(formLayout2)

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

        self.refreshState()
Beispiel #16
0
    def setupPanelUi(self, parent):
        layout = QtWidgets.QVBoxLayout(parent)
        layout.setMargin(0)

        frame = self.createPanelFrame(parent)
        layout.addWidget(frame)

        self.setupContentUi(frame)
Beispiel #17
0
    def setupUi(self, parent):
        self.layout = QtWidgets.QHBoxLayout(parent)
        self.layout.setMargin(0)
        self.setLayout(self.layout)

        self.attrListLayout = QtWidgets.QVBoxLayout(parent)
        self.attrListLayout.setMargin(0)
        self.attrListLayout.setSpacing(0)
        self.layout.addLayout(self.attrListLayout)
Beispiel #18
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)
Beispiel #19
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)
Beispiel #20
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)
Beispiel #21
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)
Beispiel #22
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)
Beispiel #23
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)
Beispiel #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
Beispiel #25
0
    def setupVariantsUi(self, parent):
        viewutils.clearLayout(self.variantLayout)

        self.variantsLabel.setText("Variants: {0}".format(
            len(self.buildItem.variantValues)))
        for i, variant in enumerate(self.buildItem.variantValues):

            if i > 0:
                # divider line
                dividerLine = QtWidgets.QFrame(parent)
                dividerLine.setStyleSheet(
                    ".QFrame{ background-color: rgb(0, 0, 0, 15); border-radius: 2px }"
                )
                dividerLine.setMinimumHeight(2)
                self.variantLayout.addWidget(dividerLine)

            variantHLayout = QtWidgets.QHBoxLayout(parent)

            # remove variant button
            removeVariantBtn = QtWidgets.QPushButton(parent)
            removeVariantBtn.setText('x')
            removeVariantBtn.setFixedSize(QtCore.QSize(20, 20))
            removeVariantBtn.clicked.connect(
                partial(self.removeVariantAtIndex, i))
            variantHLayout.addWidget(removeVariantBtn)

            # create attr form for all variant attributes
            variantVLayout = QtWidgets.QVBoxLayout(parent)
            variantVLayout.setSpacing(0)
            variantHLayout.addLayout(variantVLayout)

            if self.buildItem.variantAttributes:
                for attr in self.buildItem.actionClass.config['attrs']:
                    if attr['name'] not in self.buildItem.variantAttributes:
                        continue
                    attrValue = variant[attr['name']]
                    # context = variant
                    attrForm = ActionAttrForm.createForm(attr,
                                                         attrValue,
                                                         parent=parent)
                    attrForm.valueChanged.connect(
                        partial(self.attrValueChanged, variant, attrForm))
                    variantVLayout.addWidget(attrForm)
            else:
                noAttrsLabel = QtWidgets.QLabel(parent)
                noAttrsLabel.setText("No variant attributes")
                noAttrsLabel.setMinimumHeight(24)
                noAttrsLabel.setContentsMargins(10, 0, 0, 0)
                noAttrsLabel.setEnabled(False)
                variantVLayout.addWidget(noAttrsLabel)

            self.variantLayout.addLayout(variantHLayout)
Beispiel #26
0
    def setupContentUi(self, parent):
        layout = QtWidgets.QVBoxLayout(parent)

        # make button for each action
        registeredActions = pulse.getRegisteredActions().values()
        categories = list(
            set([
                ac.config.get('category', 'Default')
                for ac in registeredActions
            ]))
        categoryLayouts = {}

        # create category layouts
        for i, cat in enumerate(sorted(categories)):
            # add category layout
            catLay = QtWidgets.QVBoxLayout(parent)
            catLay.setSpacing(4)
            layout.addLayout(catLay)
            categoryLayouts[cat] = catLay
            # add label
            label = self.createLabel(parent, cat)
            catLay.addWidget(label)

        for actionClass in registeredActions:
            cat = actionClass.config.get('category', 'Default')
            color = self.getActionColor(actionClass)
            btn = QtWidgets.QPushButton(parent)
            btn.setText(actionClass.config['displayName'])
            btn.setStyleSheet(
                'background-color:rgba({0}, {1}, {2}, 30)'.format(*color))
            btn.setMinimumHeight(22)
            cmd = lambda x=actionClass.getTypeName(): self.createBuildAction(x)
            btn.clicked.connect(cmd)
            categoryLayouts[cat].addWidget(btn)

        spacer = QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Minimum,
                                       QtWidgets.QSizePolicy.Expanding)
        layout.addItem(spacer)
Beispiel #27
0
    def setupContentUi(self, parent):
        """ Build the action buttons UI """
        layout = QtWidgets.QVBoxLayout(parent)

        allActionConfigs = pulse.getRegisteredActionConfigs()

        # make button for each action
        categories = [c.get('category', 'Default') for c in allActionConfigs]
        categories = list(set(categories))
        categoryLayouts = {}

        # create category layouts
        for cat in sorted(categories):
            # add category layout
            catLay = QtWidgets.QVBoxLayout(parent)
            catLay.setSpacing(4)
            layout.addLayout(catLay)
            categoryLayouts[cat] = catLay
            # add label
            label = createHeaderLabel(parent, cat)
            catLay.addWidget(label)

        for actionConfig in allActionConfigs:
            actionId = actionConfig['id']
            actionCategory = actionConfig.get('category', 'Default')
            color = self.getActionColor(actionConfig)
            btn = QtWidgets.QPushButton(parent)
            btn.setText(actionConfig['displayName'])
            btn.setStyleSheet(
                'background-color:rgba({0}, {1}, {2}, 30)'.format(*color))
            btn.setMinimumHeight(22)
            cmd = lambda x=actionId: self.createBuildAction(x)
            btn.clicked.connect(cmd)
            categoryLayouts[actionCategory].addWidget(btn)

        spacer = QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Minimum,
                                       QtWidgets.QSizePolicy.Expanding)
        layout.addItem(spacer)
Beispiel #28
0
    def setupKeywordsUi(self, parent):
        """
        Build the keywords layout and all categories and button grids.
        Returns the layout.
        """
        keywordsLayout = QtWidgets.QVBoxLayout(parent)

        keywordsLabel = self.createLabel(parent, "Names", bold=True)
        keywordsLayout.addWidget(keywordsLabel)

        scrollArea = QtWidgets.QScrollArea(parent)
        scrollArea.setFrameShape(QtWidgets.QScrollArea.NoFrame)
        scrollArea.setWidgetResizable(True)
        scrollWidget = QtWidgets.QWidget()

        scrollLayout = QtWidgets.QVBoxLayout(scrollWidget)

        # create category and btn grid for all keywords
        self.keywordBtns = {}
        keywords = self.namesConfig.get('keywords', {})
        categoryNames = sorted(keywords.keys())
        for catName in categoryNames:
            catKeywords = keywords[catName]
            catLayout = self.setupKeywordCategoryUi(scrollWidget, catName,
                                                    catKeywords)
            scrollLayout.addLayout(catLayout)

        keywordsSpacer = QtWidgets.QSpacerItem(20, 40,
                                               QtWidgets.QSizePolicy.Minimum,
                                               QtWidgets.QSizePolicy.Expanding)
        scrollLayout.addItem(keywordsSpacer)

        scrollArea.setWidget(scrollWidget)
        keywordsLayout.addWidget(scrollArea)

        return keywordsLayout
Beispiel #29
0
    def __init__(self, parent=None):
        super(ActionTreeWindow, self).__init__(parent=parent)

        self.setWindowTitle('Pulse Action Tree')

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

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

        self.actionPalette = ActionPaletteWidget(self)
        layout.addWidget(self.actionPalette)

        layout.setStretch(layout.indexOf(self.actionTree), 2)
        layout.setStretch(layout.indexOf(self.actionPalette), 1)
Beispiel #30
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.DragDrop)
        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)