Exemple #1
0
        def coro():
            try:
                yield from gbulb.wait_signal(self._magic_button, "clicked")
                self.progressbar.set_text("blah blah!")
                self.progressbar.set_fraction(0.50)

                yield from asyncio.sleep(1)

                self.progressbar.set_fraction(0.75)
                self.progressbar.set_text("pouet pouet!")

                yield from gbulb.wait_signal(self._magic_button, "clicked")

                self.progressbar.set_fraction(1.0)
                self.progressbar.set_text("done!")

                yield from asyncio.sleep(1)

            finally:
                self.progressbar.set_fraction(0.0)
                self.progressbar.set_show_text(False)
                self._running = False
Exemple #2
0
        def coro():
            try:
                yield from gbulb.wait_signal(self._magic_button, "clicked")
                self.progressbar.set_text("blah blah!")
                self.progressbar.set_fraction(0.50)

                yield from asyncio.sleep(1)

                self.progressbar.set_fraction(0.75)
                self.progressbar.set_text("pouet pouet!")

                yield from gbulb.wait_signal(self._magic_button, "clicked")

                self.progressbar.set_fraction(1.0)
                self.progressbar.set_text("done!")

                yield from asyncio.sleep(1)

            finally:
                self.progressbar.set_fraction(0.0)
                self.progressbar.set_show_text(False)
                self._running = False
Exemple #3
0
    def waiter():
        nonlocal cancelled
        yield

        r = wait_signal(t, 'foo', loop=glib_loop)
        @r.add_done_callback
        def caller(r):
            nonlocal called
            called = True

        r.cancel()
        assert r.cancelled()
        cancelled = True
Exemple #4
0
    def waiter():
        nonlocal cancelled
        yield

        r = wait_signal(t, "foo", loop=glib_loop)

        @r.add_done_callback
        def caller(r):
            nonlocal called
            called = True

        r.cancel()
        assert r.cancelled()
        cancelled = True
Exemple #5
0
    def waiter():
        nonlocal cancelled
        yield

        r = wait_signal(t, "foo")

        @r.add_done_callback
        def caller(r):
            nonlocal called
            called = True

        r.cancel()
        assert r.cancelled()
        cancelled = True
Exemple #6
0
 def waiter():
     nonlocal called
     r = yield from wait_signal(t, "foo", loop=glib_loop)
     assert r == (t, "frozen brains tell no tales")
     called = True
Exemple #7
0
def test_wait_signal_cancel_state():
    from gbulb import wait_signal

    m = wait_signal(mock.Mock(), "anything")
    assert m.cancel()
    assert not m.cancel()
Exemple #8
0
def text_watcher(label):
    while True:
        yield from gbulb.wait_signal(label, 'changed')
        print('label changed', label.get_text())
Exemple #9
0
def text_watcher(label):
    while True:
        yield from gbulb.wait_signal(label, 'changed')
        print('label changed', label.get_text())
Exemple #10
0
def test_wait_signal_cancel_state():
    from gbulb import wait_signal

    m = wait_signal(mock.Mock(), "anything")
    assert m.cancel()
    assert not m.cancel()
Exemple #11
0
 def waiter():
     nonlocal called
     r = yield from wait_signal(t, 'foo', loop=glib_loop)
     assert r == (t, 'frozen brains tell no tales')
     called = True