Changeset 2351

Show
Ignore:
Timestamp:
08/19/08 12:17:15 (3 months ago)
Author:
pvagner
Message:

* speechDicts: fixing a problem where NVDA was unable to save dictionary entries for particular voices. Thanks Moodley, Deenadayalan

Location:
trunk/source
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/source/api.py

    r2314 r2351  
    268268                text = "" 
    269269        return text + " ".join(chunk for child in obj.children for chunk in (child.name, child.value) if chunk and isinstance(chunk, basestring) and not chunk.isspace()) 
     270 
     271def validateFile(name): 
     272        """Replaces invalid characters in a given string to make a windows compatible filename. 
     273@returns: A string holding altered name. 
     274@rtype: string 
     275@param name: text to makea file name of 
     276@type text: string 
     277""" 
     278        invalidChars=':?*\|<>/"' 
     279        for c in invalidChars: 
     280                name=name.replace(c,'_') 
     281        return name 
  • trunk/source/speechDictHandler.py

    r2328 r2351  
    1111import codecs 
    1212import synthDriverHandler 
     13import api 
    1314 
    1415dictionaries = {} 
     
    9192        elif type is "voice": 
    9293                s=synthDriverHandler.getSynth() 
    93                 return "%s/%s-%s.dic"%(speechDictsPath,s.name,s.getVoiceName(s.voice)) 
     94                return "%s/%s-%s.dic"%(speechDictsPath,api.validateFile(s.name),validateFile(s.getVoiceName(s.voice))) 
    9495        return None 
    9596