(self)
| 146 | self._thread.start() |
| 147 | |
| 148 | def _loop(self): |
| 149 | while not self.event.is_set(): |
| 150 | r, _, _ = select.select([sys.stdin], [], [], 0.1) |
| 151 | if not r: |
| 152 | continue |
| 153 | ch = sys.stdin.read(1) |
| 154 | if ch in ("q", "Q", "\x03", "\x04"): |
| 155 | self.event.set() |
| 156 | return |
| 157 | if ch == " ": |
| 158 | if self.pause.is_set(): |
| 159 | self.pause.clear() |
| 160 | else: |
| 161 | self.pause.set() |
| 162 | |
| 163 | def stop(self): |
| 164 | if self._old_termios is not None: |