Class that encapsulates a task to be executed.
- Copyright
- ESO - European Southern Observatory
Inherits from QRunnable to handle worker thread setup and wrap-up. Since QRunnable is not a QObject, it cannot have signals and slot: Thus, this is delegated to a WorkerSignals class that is owned by the WorkerIO.
In this example, it is shown how to use this class::
worker = WorkerIO(function_to_execute)
worker.result.connect(function_to_publish_result)
worker.finished.connect(function_when_finished)
worker.start()
- Note
- progress callback is not used, as this requires the method to be called to accept as function argument the callback, and MAL generated methods do not include this. This is useful for other long running tasks.
:param fn: The function callback to run on this worker thread. Supplied args and kwargs will be passed through to the runner. :type fn: function :param args: Arguments to pass to the callback function :param kwargs: Keywords to pass to the callback function