napari.qt.threading.GeneratorWorker#

class napari.qt.threading.GeneratorWorker(func: ~typing.Callable[[~_P], ~typing.Generator[~superqt.utils._qthreading._Y, ~superqt.utils._qthreading._S | None, ~superqt.utils._qthreading._R]], *args, SignalsClass: type[~superqt.utils._qthreading.WorkerBaseSignals] = <class 'superqt.utils._qthreading.GeneratorWorkerSignals'>, **kwargs)[source]#

Bases: GeneratorWorker[_Y, _S, _R], _NotifyingMixin

Methods

autoDelete(self)

await_workers([msecs])

Ask all workers to quit, and wait up to msec for quit.

create(functionToRun)

pause()

Request to pause the worker.

quit()

Send a request to abort the worker.

resume()

Send a request to resume the worker.

run()

Start the worker.

send(value)

Send a value into the function (if a generator was used).

setAutoDelete(self, _autoDelete)

start()

Start this worker in a thread and add it to the global threadpool.

toggle_pause()

Request to pause the worker if playing or resume if paused.

work()

Core event loop that calls the original function.

Attributes

abort_requested

Whether the worker has been requested to stop.

is_paused

Whether the worker is currently paused.

is_running

Whether the worker has been started.

Details

property abort_requested: bool#

Whether the worker has been requested to stop.

autoDelete(self) bool#
classmethod await_workers(msecs: int | None = None) None#

Ask all workers to quit, and wait up to msec for quit.

create(functionToRun: Callable[[], None]) QRunnable | None#
property is_paused: bool#

Whether the worker is currently paused.

property is_running: bool#

Whether the worker has been started.

pause() None[source]#

Request to pause the worker.

quit() None#

Send a request to abort the worker.

resume() None[source]#

Send a request to resume the worker.

run() None#

Start the worker.

send(value: _S)[source]#

Send a value into the function (if a generator was used).

setAutoDelete(self, _autoDelete: bool)#
start() None#

Start this worker in a thread and add it to the global threadpool.

toggle_pause() None[source]#

Request to pause the worker if playing or resume if paused.

work() _R | None | Exception[source]#

Core event loop that calls the original function.