示例#1
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)
示例#2
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)
示例#3
0
    def createRotateAxisForm(self, parent):
        widget = QtWidgets.QWidget(parent)

        layout = QtWidgets.QHBoxLayout(parent)
        layout.setMargin(0)
        layout.setSpacing(2)
        widget.setLayout(layout)

        def createRotateOrientsButton(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(
                partial(self.rotateSelectedOrientsAroundAxis, axis, degrees))
            return btn

        btn = createRotateOrientsButton('- X', UIColors.RED, 0, -90)
        layout.addWidget(btn)
        btn = createRotateOrientsButton('+ X', UIColors.RED, 0, 90)
        layout.addWidget(btn)
        btn = createRotateOrientsButton('- Y', UIColors.GREEN, 1, -90)
        layout.addWidget(btn)
        btn = createRotateOrientsButton('+ Y', UIColors.GREEN, 1, 90)
        layout.addWidget(btn)
        btn = createRotateOrientsButton('- Z', UIColors.BLUE, 2, -90)
        layout.addWidget(btn)
        btn = createRotateOrientsButton('+ Z', UIColors.BLUE, 2, 90)
        layout.addWidget(btn)

        return widget
示例#4
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)
示例#5
0
 def createItemWidget(buildItem, parent=None):
     if isinstance(buildItem, pulse.BuildGroup):
         return BuildGroupForm(buildItem, parent=parent)
     elif isinstance(buildItem, pulse.BuildAction):
         return ActionForm(buildItem, parent=parent)
     elif isinstance(buildItem, pulse.BatchBuildAction):
         return BatchActionForm(buildItem, parent=parent)
     return QtWidgets.QWidget(parent=parent)
示例#6
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
示例#7
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)
示例#8
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)
示例#9
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