Promises

class openpaperwork_core.promise.BasePromise(core, func=None, args=None, kwargs=None, parent=None, hide_catched_exceptions=False)[source]
catch(callback)[source]
on_error(exc)[source]
schedule(*args)[source]
then(callback, *args, **kwargs)[source]
wait()[source]
class openpaperwork_core.promise.Promise(core, func=None, args=None, kwargs=None, parent=None, hide_catched_exceptions=False)[source]
do(parent_r=None)[source]
class openpaperwork_core.promise.ThreadedPromise(core, func=None, args=None, kwargs=None, parent=None, hide_catched_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.

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]