organoid_tracker.gui.threading module
- class organoid_tracker.gui.threading.Scheduler(progress_bar: ProgressBar)
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.
- 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.
- get_percentage_completed() Optional[int]
Gets the percentage currently completed. Can be called from any thread.
You don’t have to implement this method - returning None is fine. However, if you return a value, make sure it’s 100 at the end of the task (so when self.compute() is done).
- on_error(e: BaseException)