Promises

class openpaperwork_core.promise.BasePromise(core, func=None, args=None, kwargs=None, parent=None, hide_caught_exceptions=False)[source]
catch(callback, *args, **kwargs)[source]
on_error(exc, hide_caught_exceptions=False)[source]
schedule(*args)[source]
then(callback, *args, **kwargs)[source]
wait()[source]
class openpaperwork_core.promise.DelayPromise(core, delay_s)[source]

Promise adding delay between 2 other promises. Requires a plugin implementing the interface ‘mainloop’

do(parent_r=None)[source]
class openpaperwork_core.promise.Promise(core, func=None, args=None, kwargs=None, parent=None, hide_caught_exceptions=False)[source]

Executed in the main loop thread. Requires a plugin implementing the interface ‘mainloop’.

do(parent_r=None)[source]
class openpaperwork_core.promise.ThreadedPromise(core, func=None, args=None, kwargs=None, parent=None, hide_caught_exceptions=False)[source]

Promise for which the provided callback will be run in another thread, leaving the main loop thread free to do other things. Requires a plugin implementing the interface ‘mainloop’ and a plugin implementing the interface ‘thread’.

IMPORTANT: This should ONLY be used for long-lasting tasks that cannot be split in small tasks (image processing, OCR, etc). The callback provided must be really careful regarding thread-safety.

do(parent_r=None)[source]