napari.qt.threading.WorkerBase#

class napari.qt.threading.WorkerBase(func: ~typing.Callable[[~_P], ~superqt.utils._qthreading._R] | None = None, SignalsClass: type[~superqt.utils._qthreading.WorkerBaseSignals] = <class 'superqt.utils._qthreading.WorkerBaseSignals'>)[source]#

Bases: QRunnable, Generic[_R]

Base class for creating a Worker that can run in another thread.

Methods

autoDelete(self)

await_workers([msecs])

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

create(functionToRun)

quit()

Send a request to abort the worker.

run()

Start the worker.

setAutoDelete(self, _autoDelete)

start()

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

work()

Main method to execute the worker.

Attributes

abort_requested

Whether the worker has been requested to stop.

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[source]#

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

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

Whether the worker has been started.

quit() None[source]#

Send a request to abort the worker.

run() None[source]#

Start the worker.

setAutoDelete(self, _autoDelete: bool)#
start() None[source]#

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

work() Exception | _R[source]#

Main method to execute the worker.