|
2 | 2 | import accessible_output2
|
3 | 3 | from .base import Output, OutputError
|
4 | 4 |
|
| 5 | + |
5 | 6 | class Auto(Output):
|
6 | 7 |
|
7 |
| - def __init__(self): |
8 |
| - output_classes = accessible_output2.get_output_classes() |
9 |
| - self.outputs = [] |
10 |
| - for output in output_classes: |
11 |
| - try: |
12 |
| - self.outputs.append(output()) |
13 |
| - except OutputError: |
14 |
| - pass |
15 |
| - |
16 |
| - def get_first_available_output(self): |
17 |
| - for output in self.outputs: |
18 |
| - if output.is_active(): |
19 |
| - return output |
20 |
| - return None |
21 |
| - |
22 |
| - def speak(self, *args, **kwargs): |
23 |
| - output = self.get_first_available_output() |
24 |
| - if output: |
25 |
| - output.speak(*args, **kwargs) |
26 |
| - |
27 |
| - def silence(self): |
28 |
| - output = self.get_first_available_output() |
29 |
| - if output: |
30 |
| - if output.silence: output.silence() |
31 |
| - |
32 |
| - def braille(self, *args, **kwargs): |
33 |
| - output = self.get_first_available_output() |
34 |
| - if output: |
35 |
| - output.braille(*args, **kwargs) |
36 |
| - |
37 |
| - def output(self, *args, **kwargs): |
38 |
| - output = self.get_first_available_output() |
39 |
| - if output: |
40 |
| - output.speak(*args, **kwargs) |
41 |
| - |
42 |
| - def is_system_output(self): |
43 |
| - output = self.get_first_available_output() |
44 |
| - if output: |
45 |
| - return output.is_system_output() |
| 8 | + def __init__(self): |
| 9 | + output_classes = accessible_output2.get_output_classes() |
| 10 | + self.outputs = [] |
| 11 | + for output in output_classes: |
| 12 | + try: |
| 13 | + self.outputs.append(output()) |
| 14 | + except OutputError: |
| 15 | + pass |
| 16 | + |
| 17 | + def get_first_available_output(self): |
| 18 | + for output in self.outputs: |
| 19 | + if output.is_active(): |
| 20 | + return output |
| 21 | + return None |
| 22 | + |
| 23 | + def speak(self, *args, **kwargs): |
| 24 | + output = self.get_first_available_output() |
| 25 | + if output: |
| 26 | + output.speak(*args, **kwargs) |
| 27 | + |
| 28 | + def silence(self): |
| 29 | + output = self.get_first_available_output() |
| 30 | + if output: |
| 31 | + if output.silence: |
| 32 | + output.silence() |
| 33 | + |
| 34 | + def braille(self, *args, **kwargs): |
| 35 | + output = self.get_first_available_output() |
| 36 | + if output: |
| 37 | + output.braille(*args, **kwargs) |
| 38 | + |
| 39 | + def output(self, *args, **kwargs): |
| 40 | + output = self.get_first_available_output() |
| 41 | + if output: |
| 42 | + output.speak(*args, **kwargs) |
| 43 | + |
| 44 | + def is_system_output(self): |
| 45 | + output = self.get_first_available_output() |
| 46 | + if output: |
| 47 | + return output.is_system_output() |
0 commit comments