eric6/DebugClients/Python/ThreadExtension.py

changeset 8218
7c09585bd960
parent 8207
d359172d11be
child 8240
93b8a353c4bf
equal deleted inserted replaced
8217:385f60c94548 8218:7c09585bd960
296 """ 296 """
297 # Overwrite the provided run method with our own, to 297 # Overwrite the provided run method with our own, to
298 # intercept the thread creation by threading.Thread 298 # intercept the thread creation by threading.Thread
299 self.run = lambda s=self, run=self.run: _bootstrap(s, run) 299 self.run = lambda s=self, run=self.run: _bootstrap(s, run)
300 300
301 super(ThreadWrapper, self).__init__(*args, **kwargs) 301 super().__init__(*args, **kwargs)
302 302
303 module.Thread = ThreadWrapper 303 module.Thread = ThreadWrapper
304 304
305 # Special handling of threading.(_)Timer 305 # Special handling of threading.(_)Timer
306 timer = module.Timer 306 timer = module.Timer
311 """ 311 """
312 def __init__(self, interval, function, *args, **kwargs): 312 def __init__(self, interval, function, *args, **kwargs):
313 """ 313 """
314 Constructor 314 Constructor
315 """ 315 """
316 super(TimerWrapper, self).__init__( 316 super().__init__(
317 interval, function, *args, **kwargs) 317 interval, function, *args, **kwargs)
318 318
319 module.Timer = TimerWrapper 319 module.Timer = TimerWrapper
320 320
321 # Special handling of threading._DummyThread 321 # Special handling of threading._DummyThread
325 """ 325 """
326 def __init__(self, *args, **kwargs): 326 def __init__(self, *args, **kwargs):
327 """ 327 """
328 Constructor 328 Constructor
329 """ 329 """
330 super(DummyThreadWrapper, self).__init__(*args, **kwargs) 330 super().__init__(*args, **kwargs)
331 331
332 module._DummyThread = DummyThreadWrapper 332 module._DummyThread = DummyThreadWrapper
333 333
334 def patchQThread(self, module): 334 def patchQThread(self, module):
335 """ 335 """
388 # Overwrite the provided run method with our own, to 388 # Overwrite the provided run method with our own, to
389 # intercept the thread creation by Qt 389 # intercept the thread creation by Qt
390 self.run = lambda s=self, run=self.run: ( 390 self.run = lambda s=self, run=self.run: (
391 _bootstrapQThread(s, run)) 391 _bootstrapQThread(s, run))
392 392
393 super(QThreadWrapper, self).__init__(*args, **kwargs) 393 super().__init__(*args, **kwargs)
394 394
395 class QRunnableWrapper(module.QRunnable): 395 class QRunnableWrapper(module.QRunnable):
396 """ 396 """
397 Wrapper class for *.QRunnable. 397 Wrapper class for *.QRunnable.
398 """ 398 """
403 # Overwrite the provided run method with our own, to 403 # Overwrite the provided run method with our own, to
404 # intercept the thread creation by Qt 404 # intercept the thread creation by Qt
405 self.run = lambda s=self, run=self.run: ( 405 self.run = lambda s=self, run=self.run: (
406 _bootstrapQThread(s, run)) 406 _bootstrapQThread(s, run))
407 407
408 super(QRunnableWrapper, self).__init__(*args, **kwargs) 408 super().__init__(*args, **kwargs)
409 409
410 module.QThread = QThreadWrapper 410 module.QThread = QThreadWrapper
411 module.QRunnable = QRunnableWrapper 411 module.QRunnable = QRunnableWrapper

eric ide

mercurial