2015-11-03 04:38:59 -06:00
|
|
|
from __future__ import absolute_import
|
2014-10-27 16:29:04 -06:00
|
|
|
import accessible_output2
|
2015-11-03 04:38:59 -06:00
|
|
|
from .base import Output, OutputError
|
2014-10-27 16:29:04 -06:00
|
|
|
|
|
|
|
class Auto(Output):
|
|
|
|
|
|
|
|
def __init__(self):
|
2015-11-03 04:38:59 -06:00
|
|
|
output_classes = accessible_output2.get_output_classes()
|
|
|
|
self.outputs = []
|
|
|
|
for output in output_classes:
|
|
|
|
try:
|
2017-02-16 11:26:53 +01:00
|
|
|
a=output()
|
|
|
|
self.outputs.append(a)
|
|
|
|
except:
|
2015-11-03 04:38:59 -06:00
|
|
|
pass
|
2014-10-27 16:29:04 -06:00
|
|
|
|
|
|
|
def get_first_available_output(self):
|
|
|
|
for output in self.outputs:
|
|
|
|
if output.is_active():
|
|
|
|
return output
|
|
|
|
return None
|
|
|
|
|
|
|
|
def speak(self, *args, **kwargs):
|
|
|
|
output = self.get_first_available_output()
|
|
|
|
if output:
|
|
|
|
output.speak(*args, **kwargs)
|
|
|
|
|
|
|
|
def braille(self, *args, **kwargs):
|
|
|
|
output = self.get_first_available_output()
|
|
|
|
if output:
|
|
|
|
output.braille(*args, **kwargs)
|
|
|
|
|
|
|
|
def output(self, *args, **kwargs):
|
|
|
|
output = self.get_first_available_output()
|
|
|
|
if output:
|
|
|
|
output.speak(*args, **kwargs)
|
2015-11-03 04:38:59 -06:00
|
|
|
|
|
|
|
def is_system_output(self):
|
|
|
|
output = self.get_first_available_output()
|
|
|
|
if output:
|
|
|
|
return output.is_system_output()
|