Пример #1
0
    def test_create_dialog_dialog(self):
        current_path = os.path.dirname(__file__)
        ui_file_path = os.path.join(current_path, 'res', '4.dialog.controller.ui')

        c = quite.DialogUiController(None, ui_file_path)
        self.assertTrue(isinstance(c.w, quite.Dialog))
        self.assertTrue(isinstance(c.button('quit'), quite.PushButton))
        quite.later(0.1, c.close)
        c.exec()
Пример #2
0
    def test_widget_closed_signal(self):
        w = quite.Widget()
        executed = [False]

        @quite.connect_with(w.closed)
        def is_closed():
            executed[0] = True

        quite.later(0.01, w.close)
        w.exec()
        self.assertTrue(executed[0])
Пример #3
0
    def test_double_spin_in_dialog(self):
        current_path = os.path.dirname(__file__)
        ui_file_path = os.path.join(current_path, 'res', '1.double.spin.dialog.ui')

        d = quite.load_ui(None, ui_file_path)

        def add_by_step():
            for i in range(200, 400 + 1):
                d.number_double.float.value = i / 10.0
            d.close()

        times = []

        @quite.connect_with(d.number_double.float.changed)
        def double_changed(value: float):
            self.assertEqual(min(len(times) / 10.0 + 20.0, 40.0), value)
            times.append(len(times))

        quite.later(0.1, add_by_step)
        d.exec()
        self.assertEqual(len(times), 200 + 1)
Пример #4
0
    def test_create_dialog_by_widget_ui(self):
        current_path = os.path.dirname(__file__)
        ui_file_path = os.path.join(current_path, 'res', '3.widget.controller.ui')

        class WidgetDialogController(quite.DialogUiController):
            def __init__(self, parent=None):
                super().__init__(parent, ui_file_path)

                @quite.connect_with(self.button('add').excited)
                def new_dialog():
                    d = WidgetDialogController(self.w)
                    quite.later(.1, d.close)
                    d.exec()

        c = WidgetDialogController()
        self.assertTrue(isinstance(c.button('add'), quite.PushButton))
        self.assertTrue(isinstance(c.combo('index'), quite.ComboBox))
        self.assertTrue(isinstance(c.edit('number'), quite.LineEdit))
        self.assertTrue(isinstance(c.list('numbers'), quite.ListWidget))
        quite.later(.4, c.close)
        quite.later(.1, c.button('add').click)
        c.exec()
Пример #5
0
    def test_double_spin_in_dialog(self):
        current_path = os.path.dirname(__file__)
        ui_file_path = os.path.join(current_path, 'res',
                                    '1.double.spin.dialog.ui')

        d = quite.load_ui(None, ui_file_path)

        def add_by_step():
            for i in range(200, 400 + 1):
                d.number_double.float.value = i / 10.0
            d.close()

        times = []

        @quite.connect_with(d.number_double.float.changed)
        def double_changed(value: float):
            self.assertEqual(min(len(times) / 10.0 + 20.0, 40.0), value)
            times.append(len(times))

        quite.later(0.1, add_by_step)
        d.exec()
        self.assertEqual(len(times), 200 + 1)
Пример #6
0
 def new_dialog():
     d = WidgetDialogController(self.w)
     quite.later(.1, d.close)
     d.exec()