2014-10-27 16:29:04 -06:00
|
|
|
# *- coding: utf-8 -*-
|
|
|
|
import logging as original_logging
|
|
|
|
logging = original_logging.getLogger('core.output')
|
|
|
|
|
|
|
|
from accessible_output2 import outputs
|
|
|
|
import sys
|
|
|
|
|
|
|
|
speaker = None
|
|
|
|
|
2018-05-18 13:38:58 -05:00
|
|
|
def speak(text, interrupt=0, speech=True, braille=True):
|
2014-10-27 16:29:04 -06:00
|
|
|
global speaker
|
|
|
|
if not speaker:
|
|
|
|
setup()
|
2018-05-18 13:38:58 -05:00
|
|
|
if speech:
|
|
|
|
speaker.speak(text, interrupt)
|
|
|
|
if braille:
|
|
|
|
speaker.braille(text)
|
2014-10-27 16:29:04 -06:00
|
|
|
|
|
|
|
def setup ():
|
|
|
|
global speaker
|
|
|
|
logging.debug("Initializing output subsystem.")
|
|
|
|
try:
|
|
|
|
# speaker = speech.Speaker(speech.outputs.Sapi5())
|
|
|
|
# else:
|
|
|
|
speaker = outputs.auto.Auto()
|
|
|
|
except:
|
|
|
|
return logging.exception("Output: Error during initialization.")
|
|
|
|
|
2015-07-29 08:40:07 -05:00
|
|
|
def copy(text):
|
2014-10-27 16:29:04 -06:00
|
|
|
import win32clipboard
|
|
|
|
#Copies text to the clipboard.
|
|
|
|
win32clipboard.OpenClipboard()
|
|
|
|
win32clipboard.EmptyClipboard()
|
2017-07-18 19:52:42 -05:00
|
|
|
win32clipboard.SetClipboardText(text, win32clipboard.CF_UNICODETEXT)
|
2014-10-27 16:29:04 -06:00
|
|
|
win32clipboard.CloseClipboard()
|