Package speakeasy :: Module speakeasy_persistence :: Class ButtonSavior
[hide private]
[frames] | no frames]

Class ButtonSavior

source code

object --+
         |
        ButtonSavior

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see help(type(x)) for signature
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
 
saveToFile(buttonSettings, fileName, title=None)
Given an array of ButtonProgram objects, turn them to XML and save them in a new file of the given name.
source code
(string, [ButtonProgram])
retrieveFromFile(fileName, buttonProgramClass)
Given an absolute path to a button program XML file, return an iterator over the DOM tree program elements.
source code
 
findDefaultButtonSetTitle() source code
 
createXMLElement(tagName, content='', attrDict={}) source code
 
reportError(msg) source code
Class Variables [hide private]
  BUTTON_PROGRAM_SET_TAG = 'buttonProgramSet'
  BUTTON_PROGRAM_SET_TITLE_TAG = 'buttonProgramSetTitle'
  BUTTON_PROGRAM_TAG = 'buttonSetting'
  BUTTON_LABEL_TAG = 'label'
  BUTTON_TEXT_TO_SAY_TAG = 'text'
  BUTTON_VOICE_TAG = 'voice'
  BUTTON_TTS_ENGINE = 'engine'
  BUTTON_PLAY_ONCE = 'playOnce'
  SPEECH_SET_DIR = '/wg/stor2a/paepcke/fuerte/stacks/speakeasy/s...
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

saveToFile(buttonSettings, fileName, title=None)
Static Method

source code 

Given an array of ButtonProgram objects, turn them to XML and save them in a new file of the given name. If the file exists, it will be overwritten.

Parameters:
  • buttonSettings ([ButtonProgram]) - Array of ButtonProgram instances
  • fileName (string) - Name of file to which the XML is to be written.
  • title (string) - An arbitrary name for this set

retrieveFromFile(fileName, buttonProgramClass)
Static Method

source code 

Given an absolute path to a button program XML file, return an iterator over the DOM tree program elements. The caller passes in a class object. This class will be instantiated with the data extracted from the XML of each button program.

Example structure:

       <buttonProgramSet>
         <buttonProgramSetTitle>Household Set</buttonProgramSetTitle>
         <buttonSetting>
           <label>Button 4</label>
           <text>Utterance number 1</text>
           <voice>David</voice>
           <engine>cepstral</engine>
           <playOnce>True</playOnce>
         </buttonSetting>
         <buttonSetting>
           <label>Button 5</label>
           <text>Utterance number 2</text>
           <voice>David</voice>
           <engine>cepstral</engine>
           <playOnce>True</playOnce>
         </buttonSetting>
       </buttonProgramSet>
Parameters:
  • fileName (string) - name of XML file.
  • buttonProgramClass (ButtonProgram) - class whose instances are to be created to hold button settings.
Returns: (string, [ButtonProgram])
A tuple containing the title of the button set, and an array of instances of the passed-in class.
Raises:
  • ValueError - if XML is bad.

Class Variable Details [hide private]

SPEECH_SET_DIR

Value:
'/wg/stor2a/paepcke/fuerte/stacks/speakeasy/src/speakeasy/../../button\
Programs'