Beispiel #1
0
def test_divider_class_method(qtbot, text, visible_text):
    """Test MDivider class methods."""
    main_widget = QWidget()
    main_lay = QVBoxLayout()
    main_widget.setLayout(main_lay)

    divider_left = MDivider.left(text)
    divider_center = MDivider.center(text)
    divider_right = MDivider.right(text)
    divider_ver = MDivider.vertical()
    main_lay.addWidget(divider_left)
    main_lay.addWidget(divider_center)
    main_lay.addWidget(divider_right)
    main_lay.addWidget(divider_ver)
    qtbot.addWidget(main_widget)
    main_widget.show()

    _asset_divider_perform(divider_left, True and visible_text, Qt.AlignLeft)
    _asset_divider_perform(divider_right, True and visible_text, Qt.AlignRight)
    _asset_divider_perform(divider_center, True and visible_text, Qt.AlignCenter)
    _asset_divider_perform(divider_ver, False, Qt.AlignCenter)

    assert divider_left.get_dayu_text() == text
    assert divider_right.get_dayu_text() == text
    assert divider_center.get_dayu_text() == text
    assert divider_ver.get_dayu_text() == ''
Beispiel #2
0
    def _init_ui(self):
        div1 = MDivider()
        div2 = MDivider('With Text')
        div3 = MDivider.left('Left Text')
        div4 = MDivider.center('Center Text')
        div5 = MDivider.right('Right Text')
        div6 = MDivider.vertical()
        div7 = MDivider.vertical()
        div8 = MDivider.left('orientation=Qt.Vertical')
        label1 = MLabel('Maya').strong()
        label2 = MLabel('Nuke').underline()
        label3 = MLabel('Houdini').mark()
        sub_lay = QHBoxLayout()
        sub_lay.addWidget(label1)
        sub_lay.addWidget(div6)
        sub_lay.addWidget(label2)
        sub_lay.addWidget(div7)
        sub_lay.addWidget(label3)
        sub_lay.addStretch()

        some_text = 'Steven Paul Jobs was an American entrepreneur and business magnate.'
        main_lay = QVBoxLayout()
        main_lay.addWidget(MLabel(some_text))
        main_lay.addWidget(div1)
        main_lay.addWidget(MLabel(some_text))
        main_lay.addWidget(div2)
        main_lay.addWidget(MLabel(some_text))
        main_lay.addWidget(div3)
        main_lay.addWidget(MLabel(some_text))
        main_lay.addWidget(div4)
        main_lay.addWidget(MLabel(some_text))
        main_lay.addWidget(div5)
        main_lay.addLayout(sub_lay)
        main_lay.addWidget(div8)
        main_lay.addStretch()
        self.setLayout(main_lay)