Decorators¶
- class gaphas.decorators.g_async(single: bool = False, timeout: int = 0, priority: int = gi.repository.GLib.PRIORITY_DEFAULT_IDLE)[source]¶
Instead of calling the function, schedule an idle handler at a given priority. This requires the async’ed method to be called from within the GTK main loop. Otherwise the method is executed directly.
If a function’s first argument is “self”, it’s considered a method.
Calling the async function from outside the gtk main loop will yield immediate execution.
A function can also be a generator. The generator will be fully executed. If run in the main loop, an empty iterator will be returned. A generator is “single” by default. Because of the nature of generators the first invocation will run till completion.