|
23 | 23 | import os
|
24 | 24 | import re
|
25 | 25 | import sys
|
26 |
| -import threading |
27 | 26 | import time
|
28 | 27 | import traceback
|
29 | 28 | import types
|
@@ -535,7 +534,6 @@ def _remove_proxy(self, proxy):
|
535 | 534 | del self.callbacks[signal]
|
536 | 535 | del self._func_cid_map[signal]
|
537 | 536 |
|
538 |
| - |
539 | 537 | def disconnect(self, cid):
|
540 | 538 | """
|
541 | 539 | disconnect the callback registered with callback id *cid*
|
@@ -566,72 +564,6 @@ def process(self, s, *args, **kwargs):
|
566 | 564 | self._remove_proxy(proxy)
|
567 | 565 |
|
568 | 566 |
|
569 |
| -class Scheduler(threading.Thread): |
570 |
| - """ |
571 |
| - Base class for timeout and idle scheduling |
572 |
| - """ |
573 |
| - idlelock = threading.Lock() |
574 |
| - id = 0 |
575 |
| - |
576 |
| - def __init__(self): |
577 |
| - threading.Thread.__init__(self) |
578 |
| - self.id = Scheduler.id |
579 |
| - self._stopped = False |
580 |
| - Scheduler.id += 1 |
581 |
| - self._stopevent = threading.Event() |
582 |
| - |
583 |
| - def stop(self): |
584 |
| - if self._stopped: |
585 |
| - return |
586 |
| - self._stopevent.set() |
587 |
| - self.join() |
588 |
| - self._stopped = True |
589 |
| - |
590 |
| - |
591 |
| -class Timeout(Scheduler): |
592 |
| - """ |
593 |
| - Schedule recurring events with a wait time in seconds |
594 |
| - """ |
595 |
| - def __init__(self, wait, func): |
596 |
| - Scheduler.__init__(self) |
597 |
| - self.wait = wait |
598 |
| - self.func = func |
599 |
| - |
600 |
| - def run(self): |
601 |
| - |
602 |
| - while not self._stopevent.isSet(): |
603 |
| - self._stopevent.wait(self.wait) |
604 |
| - Scheduler.idlelock.acquire() |
605 |
| - b = self.func(self) |
606 |
| - Scheduler.idlelock.release() |
607 |
| - if not b: |
608 |
| - break |
609 |
| - |
610 |
| - |
611 |
| -class Idle(Scheduler): |
612 |
| - """ |
613 |
| - Schedule callbacks when scheduler is idle |
614 |
| - """ |
615 |
| - # the prototype impl is a bit of a poor man's idle handler. It |
616 |
| - # just implements a short wait time. But it will provide a |
617 |
| - # placeholder for a proper impl ater |
618 |
| - waittime = 0.05 |
619 |
| - |
620 |
| - def __init__(self, func): |
621 |
| - Scheduler.__init__(self) |
622 |
| - self.func = func |
623 |
| - |
624 |
| - def run(self): |
625 |
| - |
626 |
| - while not self._stopevent.isSet(): |
627 |
| - self._stopevent.wait(Idle.waittime) |
628 |
| - Scheduler.idlelock.acquire() |
629 |
| - b = self.func(self) |
630 |
| - Scheduler.idlelock.release() |
631 |
| - if not b: |
632 |
| - break |
633 |
| - |
634 |
| - |
635 | 567 | class silent_list(list):
|
636 | 568 | """
|
637 | 569 | override repr when returning a list of matplotlib artists to
|
|
0 commit comments