@@ -28,12 +28,10 @@ class WorkerBase(QObject):
2828 A worker to execute tasks without blocking the GUI.
2929 """
3030 sig_task_completed = Signal (object , object )
31- sig_run_tasks = Signal ()
3231
3332 def __init__ (self ):
3433 super ().__init__ ()
3534 self ._tasks : OrderedDict [Any , tuple [str , tuple , dict ]] = OrderedDict ()
36- self .sig_run_tasks .connect (self .run_tasks , Qt .QueuedConnection )
3735
3836 def _get_method (self , task : str ):
3937 # Try direct, then fallback to underscore-prefixed (for backward
@@ -77,6 +75,7 @@ class TaskManagerBase(QObject):
7775 """
7876 sig_run_tasks_started = Signal ()
7977 sig_run_tasks_finished = Signal ()
78+ sig_run_tasks = Signal ()
8079
8180 def __init__ (self , verbose : bool = False ):
8281 super ().__init__ ()
@@ -138,8 +137,9 @@ def set_worker(self, worker: WorkerBase):
138137 self ._worker = worker
139138 self ._worker .moveToThread (self ._thread )
140139 self ._worker .sig_task_completed .connect (
141- self ._handle_task_completed , Qt .QueuedConnection
142- )
140+ self ._handle_task_completed , Qt .QueuedConnection )
141+ self .sig_run_tasks .connect (
142+ self ._worker .run_tasks , Qt .QueuedConnection )
143143
144144 self ._thread .start ()
145145
@@ -209,7 +209,7 @@ def _run_pending_tasks(self):
209209 task , args , kargs = self ._task_data [task_uuid4 ]
210210 self ._worker .add_task (task_uuid4 , task , * args , ** kargs )
211211
212- self ._worker . sig_run_tasks .emit ()
212+ self .sig_run_tasks .emit ()
213213
214214 def close (self ):
215215 if hasattr (self , "_thread" ):
0 commit comments