Exemplo n.º 1
0
def _loadDictionaryPlugin(directory):
    """Load dictionary plugin"""

    plugin = None

    try:
        plugin = DictionaryPlugin(directory)
        util.correctDictName(plugin)
    except InvalidPluginException, e:
        systemLog(ERROR, "Unable to load plugin from %s (%s)" % (directory, e))
Exemplo n.º 2
0
def _loadDictionaryPlugin(directory):
    """Load dictionary plugin"""

    plugin = None

    try:
        plugin = DictionaryPlugin(directory)
        util.correctDictName(plugin)
    except InvalidPluginException, e:
        systemLog(ERROR, "Unable to load plugin from %s (%s)" % (directory, e))
Exemplo n.º 3
0
        if not filePath:
            raise Exception, "Dictionary file not found: %s" % fileName

        dictionary = Parser(filePath)
        dictionary.setEncoding(config.get('encoding'))
        dictionary.setName(config.get('name'))
        dictionary.setVersion(config.get('version'))
        dictionary.setAuthors(config.get('authors'))
        dictionary.setChecksum(config.get('md5'))
        dictionary.setLicenceFile(config.get('licence'))
        dictionary.setDescription(config.get('description'))

    except Exception, e:
        traceback.print_exc()

    util.correctDictName(dictionary)
    return dictionary


def loadPlainDictionaries(dictionaries):
    """Load dictionaries and return a list of dictionary objects"""

    dirs = []
    globalDictDir = os.path.join(info.GLOBAL_HOME, info.PLAIN_DICT_DIR)
    localDictDir = os.path.join(info.LOCAL_HOME, info.PLAIN_DICT_DIR)

    if os.path.exists(globalDictDir):
        for directory in os.listdir(globalDictDir):
            if os.path.isdir(os.path.join(globalDictDir, directory)):
                dirs.append(os.path.join(globalDictDir, directory))
Exemplo n.º 4
0
        if not filePath:
            raise Exception, "Dictionary file not found: %s" % fileName

        dictionary = Parser(filePath)
        dictionary.setEncoding(config.get('encoding'))
        dictionary.setName(config.get('name'))
        dictionary.setVersion(config.get('version'))
        dictionary.setAuthors(config.get('authors'))
        dictionary.setChecksum(config.get('md5'))
        dictionary.setLicenceFile(config.get('licence'))
        dictionary.setDescription(config.get('description'))

    except Exception, e:
        traceback.print_exc()

    util.correctDictName(dictionary)
    return dictionary


def loadPlainDictionaries(dictionaries):
    """Load dictionaries and return a list of dictionary objects"""


    dirs = []
    globalDictDir = os.path.join(info.GLOBAL_HOME,
                                 info.PLAIN_DICT_DIR)
    localDictDir = os.path.join(info.LOCAL_HOME,
                                info.PLAIN_DICT_DIR)


    if os.path.exists(globalDictDir):