Exemple #1
0
 def __init__(self, parent=None):
     super(CardExample, self).__init__(parent)
     geo = QApplication.desktop().screenGeometry()
     self.setGeometry(geo.width() / 4,
                      geo.height() / 4,
                      geo.width() / 1.5,
                      geo.height() / 2)
     self._init_ui()
Exemple #2
0
 def _slot_show_detail(self):
     dialog = QTextEdit(self)
     dialog.setReadOnly(True)
     geo = QApplication.desktop().screenGeometry()
     dialog.setGeometry(geo.width() / 2,
                        geo.height() / 2,
                        geo.width() / 4,
                        geo.height() / 4)
     dialog.setWindowTitle(self.tr('Error Detail Information'))
     dialog.setText(self.property('history'))
     dialog.setWindowFlags(Qt.Dialog)
     dialog.show()
Exemple #3
0
def test_cursor_mixin(qtbot):
    @mixin.cursor_mixin
    class _TestClass(QPushButton):
        def __init__(self, parent=None):
            super(_TestClass, self).__init__(parent)
            geo = QApplication.desktop().screenGeometry()
            self.setGeometry(geo.width() / 4, geo.height() / 4, geo.width() / 2, geo.height() / 2)

    main_widget = QWidget()
    button_test = _TestClass()
    button_normal = QPushButton()
    test_lay = QVBoxLayout()
    test_lay.addWidget(button_test)
    test_lay.addWidget(button_normal)
    main_widget.setLayout(test_lay)

    qtbot.addWidget(main_widget)
    main_widget.show()
    button_test.setEnabled(False)
    assert QApplication.overrideCursor() is None  # Not override cursor

    qtbot.mouseMove(button_test)  # mouse enter

    def check_cursor():
        assert QApplication.overrideCursor() is not None
        assert QApplication.overrideCursor().shape() == Qt.ForbiddenCursor

    qtbot.waitUntil(check_cursor)

    qtbot.mouseMove(button_normal)  # mouse leave

    def check_cursor():
        assert QApplication.overrideCursor() is None  # Restore override cursor

    qtbot.waitUntil(check_cursor)

    button_test.setEnabled(True)
    qtbot.mouseMove(button_test)  # mouse enter

    def check_cursor():
        assert QApplication.overrideCursor() is not None
        assert QApplication.overrideCursor().shape() == Qt.PointingHandCursor

    qtbot.waitUntil(check_cursor)

    qtbot.mouseMove(button_normal)  # mouse leave

    def check_cursor():
        assert QApplication.overrideCursor() is None  # Restore override cursor

    qtbot.waitUntil(check_cursor)
Exemple #4
0
        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)

    def slot_run(self):
        self.timer.start()
        self.auto_color_progress.setValue(0)

    def slot_timeout(self):
        if self.auto_color_progress.value() > 99:
            self.timer.stop()
        else:
            self.auto_color_progress.setValue(
                self.auto_color_progress.value() + 1)


if __name__ == '__main__':
    import sys
    from dayu_widgets3.qt import QApplication

    app = QApplication(sys.argv)
    test = ProgressBarExample()
    from dayu_widgets3 import dayu_theme

    dayu_theme.apply(test)
    test.show()
    sys.exit(app.exec_())
 def slot_left_clicked(self, start_index):
     button = QApplication.mouseButtons()
     if button == Qt.LeftButton:
         real_index = self.sort_filter_model.mapToSource(start_index)
         self.sig_left_clicked.emit(real_index)
Exemple #6
0
 def __init__(self, parent=None):
     super(_TestClass, self).__init__(parent)
     geo = QApplication.desktop().screenGeometry()
     self.setGeometry(geo.width() / 4, geo.height() / 4, geo.width() / 2, geo.height() / 2)
Exemple #7
0
 def check_cursor():
     assert QApplication.overrideCursor() is None  # Restore override cursor
Exemple #8
0
 def check_cursor():
     assert QApplication.overrideCursor() is not None
     assert QApplication.overrideCursor().shape() == Qt.PointingHandCursor
Exemple #9
0
 def check_cursor():
     assert QApplication.overrideCursor() is not None
     assert QApplication.overrideCursor().shape() == Qt.ForbiddenCursor