Skip to content

Commit

Permalink
Update all copyright headers
Browse files Browse the repository at this point in the history
  • Loading branch information
parente committed Dec 30, 2012
1 parent 926db68 commit f9ef51c
Show file tree
Hide file tree
Showing 15 changed files with 150 additions and 150 deletions.
6 changes: 3 additions & 3 deletions pyttsx/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'''
pyttsx package.
Copyright (c) 2009 Peter Parente
Copyright (c) 2009, 2013 Peter Parente
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
Expand All @@ -24,8 +24,8 @@ def init(driverName=None, debug=False):
'''
Constructs a new TTS engine instance or reuses the existing instance for
the driver name.
@param driverName: Name of the platform specific driver to use. If
@param driverName: Name of the platform specific driver to use. If
None, selects the default driver for the operating system.
@type: str
@param debug: Debugging output enabled or not
Expand Down
34 changes: 17 additions & 17 deletions pyttsx/driver.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'''
Proxy for drivers.
Copyright (c) 2009 Peter Parente
Copyright (c) 2009, 2013 Peter Parente
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
Expand All @@ -22,14 +22,14 @@
class DriverProxy(object):
'''
Proxy to a driver implementation.
@ivar _module: Module containing the driver implementation
@type _module: module
@ivar _engine: Reference to the engine that owns the driver
@type _engine: L{engine.Engine}
@ivar _queue: Queue of commands outstanding for the driver
@type _queue: list
@ivar _busy: True when the driver is busy processing a command, False when
@ivar _busy: True when the driver is busy processing a command, False when
not
@type _busy: bool
@ivar _name: Name associated with the current utterance
Expand All @@ -42,7 +42,7 @@ class DriverProxy(object):
def __init__(self, engine, driverName, debug):
'''
Constructor.
@param engine: Reference to the engine that owns the driver
@type engine: L{engine.Engine}
@param driverName: Name of the driver module to use under drivers/ or
Expand Down Expand Up @@ -71,7 +71,7 @@ def __init__(self, engine, driverName, debug):
self._name = None
self._iterator = None
self._debug = debug

def __del__(self):
try:
self._driver.destroy()
Expand All @@ -81,7 +81,7 @@ def __del__(self):
def _push(self, mtd, args, name=None):
'''
Adds a command to the queue.
@param mtd: Method to invoke to process the command
@type mtd: method
@param args: Arguments to apply when invoking the method
Expand Down Expand Up @@ -109,7 +109,7 @@ def _pump(self):
def notify(self, topic, **kwargs):
'''
Sends a notification to the engine from the driver.
@param topic: Notification topic
@type topic: str
@param kwargs: Arbitrary keyword arguments
Expand All @@ -121,7 +121,7 @@ def notify(self, topic, **kwargs):
def setBusy(self, busy):
'''
Called by the driver to indicate it is busy.
@param busy: True when busy, false when idle
@type busy: bool
'''
Expand All @@ -135,11 +135,11 @@ def isBusy(self):
@rtype: bool
'''
return self._busy

def say(self, text, name):
'''
Called by the engine to push a say command onto the queue.
@param text: Text to speak
@type text: unicode
@param name: Name to associate with the utterance
Expand All @@ -165,7 +165,7 @@ def stop(self):
def getProperty(self, name):
'''
Called by the engine to get a driver property value.
@param name: Name of the property
@type name: str
@return: Property value
Expand All @@ -176,22 +176,22 @@ def getProperty(self, name):
def setProperty(self, name, value):
'''
Called by the engine to set a driver property value.
@param name: Name of the property
@type name: str
@param value: Property value
@type value: object
'''
self._push(self._driver.setProperty, (name, value))

def runAndWait(self):
'''
Called by the engine to start an event loop, process all commands in
Called by the engine to start an event loop, process all commands in
the queue at the start of the loop, and then exit the loop.
'''
self._push(self._engine.endLoop, tuple())
self._driver.startLoop()

def startLoop(self, useDriverLoop):
'''
Called by the engine to start an event loop.
Expand All @@ -200,7 +200,7 @@ def startLoop(self, useDriverLoop):
self._driver.startLoop()
else:
self._iterator = self._driver.iterate()

def endLoop(self, useDriverLoop):
'''
Called by the engine to stop an event loop.
Expand All @@ -212,7 +212,7 @@ def endLoop(self, useDriverLoop):
else:
self._iterator = None
self.setBusy(True)

def iterate(self):
'''
Called by the engine to iterate driver commands and notifications from
Expand Down
2 changes: 1 addition & 1 deletion pyttsx/drivers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'''
Speech driver implementations.
Copyright (c) 2009 Peter Parente
Copyright (c) 2009, 2013 Peter Parente
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
Expand Down
52 changes: 26 additions & 26 deletions pyttsx/drivers/dummy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Dummy driver that produces no output but gives all expected callbacks. Useful
for testing and as a model for real drivers.
Copyright (c) 2009 Peter Parente
Copyright (c) 2009, 2013 Peter Parente
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
Expand All @@ -21,19 +21,19 @@

def buildDriver(proxy):
'''
Builds a new instance of a driver and returns it for use by the driver
Builds a new instance of a driver and returns it for use by the driver
proxy.
@param proxy: Proxy creating the driver
@type proxy: L{driver.DriverProxy}
'''
return DummyDriver(proxy)

class DummyDriver(object):
'''
Dummy speech engine implementation. Documents the interface, notifications,
Dummy speech engine implementation. Documents the interface, notifications,
properties, and sequencing responsibilities of a driver implementation.
@ivar _proxy: Driver proxy that manages this instance
@type _proxy: L{driver.DriverProxy}
@ivar _config: Dummy configuration
Expand All @@ -46,24 +46,24 @@ def __init__(self, proxy):
Constructs the driver.
@param proxy: Proxy creating the driver
@type proxy: L{driver.DriverProxy}
@type proxy: L{driver.DriverProxy}
'''
self._proxy = proxy
self._looping = False
# hold config values as if we had a real tts implementation that
# hold config values as if we had a real tts implementation that
# supported them
voices = [
Voice('dummy.voice1', 'John Doe', ['en-US', 'en-GB'], 'male', 'adult'),
Voice('dummy.voice2', 'Jane Doe', ['en-US', 'en-GB'], 'female', 'adult'),
Voice('dummy.voice3', 'Jimmy Doe', ['en-US', 'en-GB'], 'male', 10)
]
self._config = {
'rate' : 200,
'volume' : 1.0,
'rate' : 200,
'volume' : 1.0,
'voice' : voices[0],
'voices' : voices
}

def destroy(self):
'''
Optional method that will be called when the driver proxy is being
Expand All @@ -74,9 +74,9 @@ def destroy(self):

def startLoop(self):
'''
Starts a blocking run loop in which driver callbacks are properly
Starts a blocking run loop in which driver callbacks are properly
invoked.
@precondition: There was no previous successful call to L{startLoop}
without an intervening call to L{stopLoop}.
'''
Expand All @@ -90,13 +90,13 @@ def startLoop(self):

def endLoop(self):
'''
Stops a previously started run loop.
Stops a previously started run loop.
@precondition: A previous call to L{startLoop} suceeded and there was
no intervening call to L{endLoop}.
'''
self._looping = False

def iterate(self):
'''
Iterates from within an external run loop.
Expand All @@ -106,25 +106,25 @@ def iterate(self):

def say(self, text):
'''
Speaks the given text. Generates the following notifications during
Speaks the given text. Generates the following notifications during
output:
started-utterance: When speech output has started
started-word: When a word is about to be spoken. Includes the character
"location" of the start of the word in the original utterance text
and the "length" of the word in characters.
finished-utterance: When speech output has finished. Includes a flag
indicating if the entire utterance was "completed" or not.
The proxy automatically adds any "name" associated with the utterance
to the notifications on behalf of the driver.
When starting to output an utterance, the driver must inform its proxy
that it is busy by invoking L{driver.DriverProxy.setBusy} with a flag
of True. When the utterance completes or is interrupted, the driver
inform the proxy that it is no longer busy by invoking
inform the proxy that it is no longer busy by invoking
L{driver.DriverProxy.setBusy} with a flag of False.
@param text: Unicode text to speak
@type text: unicode
'''
Expand All @@ -148,17 +148,17 @@ def stop(self):
proxy.
'''
pass

def getProperty(self, name):
'''
Gets a property value of the speech engine. The suppoted properties
and their values are:
voices: List of L{voice.Voice} objects supported by the driver
voice: String ID of the current voice
rate: Integer speech rate in words per minute
volume: Floating point volume of speech in the range [0.0, 1.0]
@param name: Property name
@type name: str
@raise KeyError: When the property name is unknown
Expand All @@ -167,13 +167,13 @@ def getProperty(self, name):
return self._config[name]
except KeyError:
raise KeyError('unknown property %s' % name)

def setProperty(self, name, value):
'''
Sets one of the supported property values of the speech engine listed
above. If a value is invalid, attempts to clip it / coerce so it is
valid before giving up and firing an exception.
@param name: Property name
@type name: str
@param value: Property value
Expand Down
Loading

0 comments on commit f9ef51c

Please sign in to comment.