예제 #1
0
    def _init_ui(self):
        progress_1 = MProgressBar()
        progress_1.setValue(1)
        progress_1.setAlignment(Qt.AlignCenter)
        progress_2 = MProgressBar()
        progress_2.setValue(80)

        progress_normal = MProgressBar()
        progress_normal.setValue(30)
        progress_success = MProgressBar(status=MProgressBar.SuccessStatus)
        progress_success.setValue(100)
        progress_error = MProgressBar(status=MProgressBar.ErrorStatus)
        progress_error.setValue(50)
        form_lay = QFormLayout()
        form_lay.addRow('Primary:', progress_normal)
        form_lay.addRow('Success:', progress_success)
        form_lay.addRow('Error:', progress_error)

        main_lay = QVBoxLayout()
        main_lay.addWidget(MDivider('Basic'))

        main_lay.addWidget(progress_1)
        main_lay.addWidget(progress_2)
        main_lay.addWidget(MDivider('different type'))
        main_lay.addLayout(form_lay)
        main_lay.addStretch()
        self.setLayout(main_lay)
예제 #2
0
    def _init_ui(self):
        progress_1 = MProgressBar()
        progress_1.setValue(10)
        progress_1.setAlignment(QtCore.Qt.AlignCenter)
        progress_2 = MProgressBar()
        progress_2.setValue(80)

        progress_normal = MProgressBar()
        progress_normal.setValue(30)
        progress_success = MProgressBar().success()
        progress_success.setValue(100)
        progress_error = MProgressBar().error()
        progress_error.setValue(50)
        form_lay = QtWidgets.QFormLayout()
        form_lay.addRow("Primary:", progress_normal)
        form_lay.addRow("Success:", progress_success)
        form_lay.addRow("Error:", progress_error)

        self.progress_count = 0
        self.timer = QtCore.QTimer()
        self.timer.setInterval(10)
        self.timer.timeout.connect(self.slot_timeout)
        run_button = MPushButton(text="Run Something")
        run_button.clicked.connect(self.slot_run)
        self.auto_color_progress = MProgressBar().auto_color()
        auto_color_lay = QtWidgets.QVBoxLayout()
        auto_color_lay.addWidget(run_button)
        auto_color_lay.addWidget(self.auto_color_progress)

        main_lay = QtWidgets.QVBoxLayout()
        main_lay.addWidget(MDivider("Basic"))

        main_lay.addWidget(progress_1)
        main_lay.addWidget(progress_2)
        main_lay.addWidget(MDivider("different type"))
        main_lay.addLayout(form_lay)
        main_lay.addWidget(MDivider("auto color"))
        main_lay.addLayout(auto_color_lay)
        main_lay.addStretch()
        self.setLayout(main_lay)
예제 #3
0
    def setupUI(self):

        self.setMaximumWidth(Data.getWindowWidth() / 3)

        self.ui = loadUi(file_path + "\\res\\UI\\ParameterWindow.ui")

        self.ui.setParent(self)
        self.setLayout(QVBoxLayout())
        self.layout().addWidget(self.ui)

        self.widget_1 = self.ui.findChild(QWidget, "widget")
        self.widget_2 = self.ui.findChild(QWidget, "widget_2")
        self.widget_3 = self.ui.findChild(QWidget, "widget_3")
        self.widget_4 = self.ui.findChild(QWidget, "widget_4")
        self.widget_1.setLayout(QVBoxLayout())
        self.widget_2.setLayout(QVBoxLayout())
        self.widget_4.setLayout(QVBoxLayout())
        self.widget_2.layout().setSpacing(8)
        #设置布局

        tab_card = MTabWidget()
        self.label_filePic = MLabel("")
        self.widget_1.setMinimumSize(Data.getWindowHeight() / 2.8,
                                     Data.getWindowHeight() / 2.8)
        tab_card.addTab(self.label_filePic, u'预览图')

        # Todo 加载3d视口
        # self.model_widget = QWidget()
        self.model_widget = CefBrowser(self, url="editor")
        # self.model_widget.setLayout(QVBoxLayout())
        tab_card.addTab(self.model_widget, u'3D视口')

        self.widget_1.layout().addWidget(tab_card)
        self.widget_1.layout().setContentsMargins(0, 0, 0, 0)

        self.widget_2.layout().addWidget(MDivider(u'操作面板'))

        self.let_filename = MLineEdit(text='filename')
        tool_button = MLabel(text=u'文件名').mark().secondary()
        tool_button.setAlignment(Qt.AlignCenter)
        tool_button.setFixedWidth(80)
        self.let_filename.set_prefix_widget(tool_button)
        self.widget_2.layout().addWidget(self.let_filename)

        self.let_path = MLineEdit(text='filepath')
        tool_button_2 = MLabel(text=u'文件地址').mark().secondary()
        tool_button_2.setAlignment(Qt.AlignCenter)
        tool_button_2.setFixedWidth(80)
        self.let_path.set_prefix_widget(tool_button_2)
        self.widget_2.layout().addWidget(self.let_path)
        self.widget_2.layout().addWidget(MLabel(u'标签'))

        self.let_tag = MLineEdit(text='tag')
        self.btn_reviseTag = MPushButton(text=u'修改').primary()
        self.btn_reviseTag.setFixedWidth(80)
        self.let_tag.set_suffix_widget(self.btn_reviseTag)
        self.widget_2.layout().addWidget(self.let_tag)
        self.btn_export = MPushButton(u'导出到houdini').primary()
        self.widget_2.layout().addWidget(self.btn_export)
        self.btn_exportToMaya = MPushButton(u'导出到Maya').primary()
        self.widget_2.layout().addWidget(self.btn_exportToMaya)

        self.timer = QTimer()
        self.timer.setInterval(0.1)
        self.timer.timeout.connect(self.slot_timeout)
        self.auto_color_progress = MProgressBar().auto_color()

        self.widget_2.layout().addWidget(self.auto_color_progress)

        self.widget_4.layout().addWidget(MDivider(u'操作记录'))
        self.setWindowTitle(u"参数面板")

        # #获取控件

        self.tableWidget_operationNote = self.ui.findChild(
            QTableWidget, "tableWidget_operationNote")

        self.tableWidget_operationNote.setStyleSheet(Data.getQSS())
        #设置默认值
        self.let_filename.setReadOnly(True)  #只读
        self.let_path.setReadOnly(True)  #只读
        self.let_tag.setReadOnly(True)  #只读
        self.tableWidget_operationNote.setHorizontalHeaderLabels(
            [u'用户', u'操作', u'时间'])

        # #连接信号与槽
        self.btn_export.clicked.connect(self.slot_run)
        self.btn_reviseTag.clicked.connect(lambda: self.reviseTag())
        # self.tableWidget_operationNote.setColumnCount(3)
        setSectionResizeMode(self.tableWidget_operationNote.horizontalHeader(),
                             QHeaderView.Stretch)  # 自适应
def test_progress_bar_init(qtbot):
    bar = MProgressBar()
    bar.setRange(0, 10)
    bar.setValue(5)
    assert bar.text() == "50%"