Exemple #1
0
    def __init__(self, *args, **kwargs):
        super(About_Dialog, self).__init__(*args, **kwargs)

        self.setWindowTitle("About Brick")

        layout = VBoxLayout(self)
        with layout:
            textEdit = qcreate(QtWidgets.QTextEdit)

            textEdit.setPlainText('''
https://github.com/r4inm4ker/brick

by Jefri Haryono, released under the term of MIT License

icons provided by https://icons8.com
            ''')

            textEdit.setReadOnly(True)

            # label = qcreate(QtWidgets.QLabel, "https://github.com/r4inm4ker/brick")
            # label.setAlignment(QtCore.Qt.AlignCenter)
            #
            # label = qcreate(QtWidgets.QLabel, "by Jefri Haryono, released under MIT License")
            # label.setAlignment(QtCore.Qt.AlignCenter)
            #
            # label = qcreate(QtWidgets.QLabel,"")
            #
            # label = qcreate(QtWidgets.QLabel, "icons provided by https://icons8.com")
            # label.setAlignment(QtCore.Qt.AlignCenter)

            label = qcreate(QtWidgets.QLabel, "")

            btn = qcreate(Button, "Ok")
            btn.clicked.connect(self.close)
Exemple #2
0
 def __init__(self, parent=None):
     super(PathField, self).__init__(parent)
     layout = HBoxLayout(self)
     with layout:
         self.scriptField = qcreate(QtWidgets.QLineEdit)
         self.scriptField.editingFinished.connect(self.emitSignal)
         self.editButton = qcreate(Button, "browse")
     self.editButton.clicked.connect(self.openFileDialog)
Exemple #3
0
    def __init__(self, *args, **kwargs):
        super(RenameAttrDialog, self).__init__(*args, **kwargs)
        layout = VBoxLayout(self)
        with layout:
            self.nameField = qcreate(StringField, label="attr name: ")
            self.okBtn = qcreate(Button, "Rename")

        self.okBtn.clicked.connect(self.emitRenameAttr)
        self.nameField.returnPressed.connect(self.emitRenameAttr)
Exemple #4
0
 def __init__(self, parent=None):
     super(NamedObjectField, self).__init__(parent)
     layout = HBoxLayout(self)
     layout.setContentsMargins(0, 0, 0, 0)
     with layout:
         self.scriptField = qcreate(QtWidgets.QLineEdit)
         self.scriptField.setEnabled(False)
         self.editButton = qcreate(Button, "edit")
     self.editButton.clicked.connect(self.openScriptEditor)
Exemple #5
0
    def _initUI(self):
        layout = VBoxLayout(self)
        with layout:
            self.hsplitter = qcreate(Splitter)
            with self.hsplitter:
                # left
                self.blockMenuWidget = qcreate(QtWidgets.QWidget,
                                               layoutType=VBoxLayout)
                self.blockMenuWidget.setMaximumWidth(200)
                self.blockMenuLayout = self.blockMenuWidget.layout()
                self._populateBlocks()

                # right
                self.blueprintWidget = qcreate(BlueprintWidget)
            self.hsplitter.setSizes([1, 100])
Exemple #6
0
    def initUI(self):
        self.setWindowTitle('Script Editor')
        layout = VBoxLayout(self)
        with layout:
            self.editor = qcreate(PythonTextEditor)

            with qcreate(HBoxLayout) as hlayout:
                icon = IconManager.get("save.png", type='icon')
                self.setBtn = qcreate(Button, 'Save', icon=icon)
                self.cancelBtn = qcreate(Button, 'Cancel')

            hlayout.setRatio(2, 1)

        layout.setRatio(1, 0)

        self.resize(800, 800)
Exemple #7
0
    def _initUI(self):
        self.setContentsMargins(0, 0, 0, 0)
        layout = VBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        with layout:
            splitter = qcreate(Splitter, mode="vertical")
            with splitter:
                self.headerWidget = qcreate(HeaderWidget)
                # self.blockMenu = qcreate(BlockMenuWidget,self)

                w2 = qcreate(QtWidgets.QGroupBox, layoutType=VBoxLayout)
                w2.setTitle("Blueprint")
                w2.setStyleSheet(
                    '''QGroupBox{ font-size: 14px; font-weight: bold;}''')
                w2.setAlignment(QtCore.Qt.AlignCenter)
                w2lay = w2.layout()
                w2lay.setContentsMargins(0, 0, 0, 0)
                with w2lay:
                    self.blockListWidget = BlockListWidget(
                        blueprintWidget=self)
                    w2lay.add(self.blockListWidget)

                    with qcreate(HBoxLayout):
                        icon = IconManager.get("rewind.png", type="icon")
                        self.rewindButton = qcreate(Button, icon, "")
                        self.rewindButton.setMinimumHeight(25)

                        icon = IconManager.get("step_back.png", type="icon")
                        self.stepBackButton = qcreate(Button, icon, "")
                        self.stepBackButton.setMinimumHeight(25)
                        self.stepBackButton.setMaximumWidth(30)

                        icon = IconManager.get("build_next.png", type="icon")
                        self.buildNextButton = qcreate(Button, icon, "")
                        self.buildNextButton.setMinimumHeight(25)

                        icon = IconManager.get("step_forward.png", type="icon")
                        self.stepForwardButton = qcreate(Button, icon, "")
                        self.stepForwardButton.setMinimumHeight(25)
                        self.stepForwardButton.setMaximumWidth(30)

                        icon = IconManager.get("fast_forward.png", type="icon")
                        self.fastForwardButton = qcreate(Button, icon, "")
                        self.fastForwardButton.setMinimumHeight(25)
            splitter.setSizes((50, 600))
Exemple #8
0
 def __init__(self, parent=None):
     super(HeaderWidget, self).__init__(parent=parent)
     # self.setFixedHeight(120)
     self.setContentsMargins(0, 0, 0, 0)
     self.setTitle("Global Attributes")
     self.setAlignment(QtCore.Qt.AlignCenter)
     self.setStyleSheet(
         '''QGroupBox{ font-size: 12px; font-weight: bold;}''')
     layout = VBoxLayout(self)
     layout.setContentsMargins(0, 0, 0, 0)
     with layout:
         self.attrTree = qcreate(AttrTree)
         self.attrTree.attrEdited.connect(self.syncData)
Exemple #9
0
    def __init__(self, parent=None):
        super(AddAttrDialog, self).__init__(parent=parent)

        self.setWindowTitle(self.title)
        layout = VBoxLayout(self)
        with layout:
            self.attrNameInput = qcreate(StringField, label="Attr Name: ")

            with qcreate(HBoxLayout):
                qcreate(QtWidgets.QLabel, "Attr Type: ")
                self.fieldWidget = qcreate(attrField.AttrTypeChooser)

            with qcreate(HBoxLayout):
                qcreate(Spacer, mode="horizontal")
                buttonBox = qcreate(QtWidgets.QDialogButtonBox)
                self.addButton = buttonBox.addButton(
                    "Add", QtWidgets.QDialogButtonBox.AcceptRole)

        self.addButton.clicked.connect(self._addAttr)
Exemple #10
0
    def _populateBlocks(self):
        blockMap = lib.collectBlocksByCategory()

        with self.blockMenuLayout:
            qcreate(Spacer, mode="vertical")
            for category, blockClasses in blockMap.items():
                gbox = qcreate(QtWidgets.QGroupBox, layoutType=VBoxLayout)
                gbox.setTitle(category)
                with gbox.layout():
                    lwidget = qcreate(BlockMenuListWidget)
                    for blockClass in blockClasses:
                        icon = IconManager.get(blockClass.ui_icon_name,
                                               type="icon")
                        item = QtWidgets.QListWidgetItem(
                            icon, blockClass.__name__)
                        item.blockClass = blockClass
                        item.setSizeHint(QtCore.QSize(100, 30))
                        lwidget.addItem(item)
            qcreate(Spacer, mode="vertical")
Exemple #11
0
    def _initUI(self):
        layout = VBoxLayout(self)
        layout.setContentsMargins(2, 0, 2, 0)
        with layout:
            mainLayout = qcreate(HBoxLayout)
            mainLayout.setContentsMargins(0, 0, 0, 0)
            with mainLayout:
                self.indicatorWidget = qcreate(QtWidgets.QStackedWidget)
                self.indicatorWidget.setFixedWidth(15)
                self.nothing = qcreate(QtWidgets.QLabel)
                self.nothing.setStyleSheet(
                    'background-color:rgb(126, 126, 126)')
                self.success = qcreate(QtWidgets.QLabel)
                self.success.setStyleSheet('background-color:rgb(52, 141, 3)')
                self.fail = qcreate(QtWidgets.QLabel)
                self.fail.setStyleSheet('background-color:rgb(149, 0, 2)')
                self.next = qcreate(QtWidgets.QLabel)
                self.next.setStyleSheet('background-color:rgb(244, 244, 0)')

                self.indicatorWidget.addWidget(self.nothing)
                self.indicatorWidget.addWidget(self.success)
                self.indicatorWidget.addWidget(self.fail)
                self.indicatorWidget.addWidget(self.next)

                # self.indicatorWidget.setCurrentIndex(1)

                self.frame = qcreate(QtWidgets.QFrame, layoutType=HBoxLayout)
                self.frame.layout().setContentsMargins(0, 0, 0, 0)
                with self.frame.layout():

                    self.activeCheckBox = qcreate(Checkbox)
                    icon = IconManager.get(self.block.ui_icon_name,
                                           type="path")

                    self.labelIcon = qcreate(Image, icon, w=15, h=15)

                    self.blockTypeLabel = qcreate(QtWidgets.QLabel,
                                                  "Block Type")
                    self.blockNameField = qcreate(StringField)

                    qcreate(Spacer)

                with qcreate(VBoxLayout):
                    with qcreate(HBoxLayout):
                        icon = IconManager.get("play.svg", type="icon")
                        self.runBlockButton = qcreate(Button, icon, "")

                        qcreate(QtWidgets.QLabel, "  ")

                        icon = IconManager.get("delete.svg", type="icon")
                        self.deleteButton = qcreate(Button, "", icon=icon)
                        self.deleteButton.setFixedSize(QtCore.QSize(15, 15))

                    # self.runBlockButton = qcreate(Button,">")
                    # self.runBlockButton.setFixedWidth(20)
                    # self.runBlockButton.setFixedHeight(60)

            qcreate(SeparatorLine)

        self.blockTypeLabel.setText("{} : ".format(
            self.block.__class__.__name__))
        self.blockTypeLabel.setText("{} : ".format(
            self.block.__class__.__name__))
        self.blockNameField.setValue(self.block.name)
        self.activeCheckBox.setValue(self.block.active)
        self.setEnableDisplay(self.block.active)
Exemple #12
0
    def _initUI(self):
        layout = VBoxLayout(self)
        layout.setContentsMargins(2, 0, 2, 0)
        with layout:
            mainLayout = qcreate(HBoxLayout)
            mainLayout.setContentsMargins(0, 0, 0, 0)
            with mainLayout:
                self.indicatorWidget = qcreate(QtWidgets.QStackedWidget)
                self.indicatorWidget.setFixedWidth(15)
                self.nothing = qcreate(QtWidgets.QLabel)
                self.indicatorWidget.addWidget(self.nothing)

                self.frame = qcreate(QtWidgets.QFrame, layoutType=HBoxLayout)
                self.frame.layout().setContentsMargins(0, 0, 0, 0)
                with self.frame.layout():
                    self.activeCheckBox = qcreate(Checkbox)
                    self.blockType = qcreate(QtWidgets.QLabel, "Break Point")
                    self.blockNameField = qcreate(StringField)
                    self.blockNameField.setHidden(True)
                    qcreate(Spacer)

                with qcreate(VBoxLayout):
                    icon = IconManager.get("delete.svg", type="icon")
                    self.deleteButton = qcreate(Button, "", icon=icon)
                    self.deleteButton.setFixedSize(QtCore.QSize(15, 15))

            qcreate(SeparatorLine)

        # self.setEnableDisplay(True)

        self.activeCheckBox.setValue(self.block.active)
        self.setEnableDisplay(self.block.active)
Exemple #13
0
 def _initUI(self):
     layout = VBoxLayout(self)
     with layout:
         self.printBtn = qcreate(Button,"print")
         self.errorBtn = qcreate(Button, "error")
         self.log = qcreate(OutputWidget)