Promises¶
-
class
openpaperwork_core.promise.
BasePromise
(core, func=None, args=None, kwargs=None, parent=None, hide_catched_exceptions=False)[source]¶
-
class
openpaperwork_core.promise.
DelayPromise
(core, delay_s)[source]¶ Promise adding delay between 2 other promises. Requires a plugin implementing the interface ‘mainloop’
-
class
openpaperwork_core.promise.
Promise
(core, func=None, args=None, kwargs=None, parent=None, hide_catched_exceptions=False)[source]¶ Executed in the main loop thread. Requires a plugin implementing the interface ‘mainloop’.
-
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. 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.