organoid_tracker.gui.threading module

class organoid_tracker.gui.threading.Scheduler

Bases: Thread

To avoid blocking the UI, computationally intensive tasks are run on a worker thread. Simply call add_task(..) and the task will be executed on a worker thread.

add_task(task: Task)
has_active_tasks() bool

Gets whether there are currently tasks being run or scheduled to run.

run()

Long-running method that processes pending tasks. Do not call, let Python call it.

class organoid_tracker.gui.threading.Task

Bases: ABC

A long-running task. run() will be called on a worker thread, on_finished() and on_error() on the GUI thread.

Note: this class is kind of low-level. If you have a task that needs to process Experiment objects in some way, consider using the higher-level WorkerJob class instead. This class greatly simplifies running any task on all active experiments.

compute() Any
on_error(e: BaseException)
on_finished(result: Any)