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
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
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
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
def waiter(): nonlocal called r = yield from wait_signal(t, "foo", loop=glib_loop) assert r == (t, "frozen brains tell no tales") called = True
def test_wait_signal_cancel_state(): from gbulb import wait_signal m = wait_signal(mock.Mock(), "anything") assert m.cancel() assert not m.cancel()
def text_watcher(label): while True: yield from gbulb.wait_signal(label, 'changed') print('label changed', label.get_text())
def waiter(): nonlocal called r = yield from wait_signal(t, 'foo', loop=glib_loop) assert r == (t, 'frozen brains tell no tales') called = True