def __init__(self,parent = None,name = None,modal = 0,fl = 0):
        SpellForm.__init__(self,parent,name,modal,fl)

        self.notcapable = False
        try:
            import aspell
        except:
            QMessageBox.warning(None,
                self.trUtf8("Error"),
                self.trUtf8("""Seems like you don't have ASpell bindings installed!\nYou can get it from http://prdownloads.sourceforge.net/uncpythontools/aspell-1.0.zip?download"""))
            self.notcapable = True
            return

        try:
            self.speller = aspell.spell_checker(prefix='/usr')
        except:
            QMessageBox.warning(None,
                self.trUtf8("Error"),
                self.trUtf8("""ASpell module couldn't be initialized!"""))
            self.notcapable = True
Exemple #2
0
    def __init__(self, parent=None, name=None, modal=0, fl=0):
        SpellForm.__init__(self, parent, name, modal, fl)

        try:
            import aspell
        except:
            QMessageBox.warning(
                None, self.trUtf8("Error"),
                self.trUtf8(
                    """Seems like you don't have ASpell bindings installed!\nYou can get it from http://prdownloads.sourceforge.net/uncpythontools/aspell-1.0.zip?download"""
                ))
            self.notcapable = True
            return

        try:
            self.speller = aspell.spell_checker(prefix='/usr')
        except:
            QMessageBox.warning(
                None, self.trUtf8("Error"),
                self.trUtf8("""ASpell module couldn't be initialized!"""))
            self.notcapable = True
Exemple #3
0
@copyright: Copyright (c) 2008 Peter Parente
@license: BSD License

All rights reserved. This program and the accompanying materials are made
available under the terms of The BSD License which accompanies this
distribution, and is available at
U{http://www.opensource.org/licenses/bsd-license.php}
'''

import aspell, re, weakref, time
import Input, Interface
import Constants

# global objects used for spell checking
ltgt_regex = re.compile('(<)|(>)')
spell_checker = aspell.spell_checker(prefix='c:/program files/aspell') 

class SpellXlator(dict):
  '''
  Prepares normal text to be spelled by the speech engine. Replaces punctuation with
  their names. Spaces out other characters. Implements the Singleton pattern by 
  overriding the class definition with an instance of the same name.
  
  This class is based on the Xlator class by Xavier Defrang.
  http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81330/
  
  @ivar punc_map: Mapping from character to that character's name
  @type punc_map: dictionary
  @ivar regex: Regular expression used to replace punctuation
  @type regex: re object
  '''