Worker¶
To prevent blocking methods for freezing the GUI-thread, each blocking call should be made using a Worker. The worker will run in a separate thread and return the result/error of the call in Qt signals.
-
class mundo.api.worker.Worker(
fn,
*args,
**kwargs
)¶ Implements a worker thread. Worker should be used for all methods that block the GUI-thread. Every module that that uses a worker thread should contain a QThreadPool attribute that starts the worker.
-
__init__(
fn,
*args,
**kwargs
) None ¶ Stores the method to be threaded and its arguments.
- Parameters
fn – Function to be threaded
*args – Arguments to pass to the function
**kwargs – Keyword arguments to pass to the function
- run() None ¶
Initialise the runner function with passed args, kwargs.
-
__init__(
- class mundo.api.worker.WorkerSignals¶
Defines the signals available from a running worker thread. Supported signals are:
- finished
No data
- error
tuple (exctype, value, traceback.format_exc() )
- result
object data returned from processing, anything
- progress
int indicating % progress
- finished¶
- error¶
- result¶
- progress¶
- staticMetaObject = <PySide2.QtCore.QMetaObject object>¶