Exemplo n.º 1
0
    def __init__(self, dictionaryLanguage):
        self.dictionaryLanguage = dictionaryLanguage
        self.dictionaryEncoding = None
        self.isTempAspellDir = False
        self.spellingDir = getApplicationModel().getUserProfile().getDirectory(
            u"spellcheck")  #$NON-NLS-1$
        self.aspellDir = os.path.join(self.spellingDir,
                                      u"aspell")  #$NON-NLS-1$

        # Initialize the aspell directory (only if it is not already initialized).
        ZAspellSpellCheckDictionaryHandler().initializeAspellDirectory()

        if isUnicodePath(self.aspellDir):
            self.aspellDir = self._copyAspellDirToTemp(self.aspellDir)
            self.isTempAspellDir = True

        dataDir = os.path.abspath(os.path.join(self.aspellDir,
                                               u"data"))  #$NON-NLS-1$
        dictDir = os.path.abspath(os.path.join(self.aspellDir,
                                               u"dict"))  #$NON-NLS-1$
        language = dictionaryLanguage.getLanguageCode()

        self.speller = Speller(
            (u"lang", language),  #$NON-NLS-1$
            (u"data-dir", dataDir),  #$NON-NLS-1$
            (u"dict-dir", dictDir)  #$NON-NLS-1$
        )
Exemplo n.º 2
0
    def __init__(self, dictionaryLanguage):
        self.dictionaryLanguage = dictionaryLanguage
        self.dictionaryEncoding = None
        self.isTempAspellDir = False
        self.spellingDir = getApplicationModel().getUserProfile().getDirectory(u"spellcheck") #$NON-NLS-1$
        self.aspellDir = os.path.join(self.spellingDir, u"aspell") #$NON-NLS-1$

        # Initialize the aspell directory (only if it is not already initialized).
        ZAspellSpellCheckDictionaryHandler().initializeAspellDirectory()

        if isUnicodePath(self.aspellDir):
            self.aspellDir = self._copyAspellDirToTemp(self.aspellDir)
            self.isTempAspellDir = True

        dataDir = os.path.abspath(os.path.join(self.aspellDir, u"data")) #$NON-NLS-1$
        dictDir = os.path.abspath(os.path.join(self.aspellDir, u"dict")) #$NON-NLS-1$
        language = dictionaryLanguage.getLanguageCode()

        self.speller = Speller(
            (u"lang", language), #$NON-NLS-1$
            (u"data-dir", dataDir), #$NON-NLS-1$
            (u"dict-dir", dictDir) #$NON-NLS-1$
        )
Exemplo n.º 3
0
 def openUrlInBrowser(self, url):
     # If the URL contains unicode characters, assume it is an international
     # URL and thus encode it using the 'idna' encoding
     if isUnicodePath(url):
         url = encodeIDNA(url)
     webbrowser.open_new(url)
Exemplo n.º 4
0
 def openUrlInBrowser(self, url):
     # If the URL contains unicode characters, assume it is an international
     # URL and thus encode it using the 'idna' encoding
     if isUnicodePath(url):
         url = encodeIDNA(url)
     webbrowser.open_new(url)