Grammalecte  Check-in [6cde77e557]

Overview
Comment:[lo] use spellchecker instead of ibdawg
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | lo | multid
Files: files | file ages | folders
SHA3-256: 6cde77e55783f142bab9644eda0524ba28ec31d7a064ed635bd87ed4d2d1a8d9
User & Date: olr on 2018-02-16 17:41:15
Other Links: branch diff | manifest | tags
Context
2018-02-16
17:43
[lo] fix Grammalecte init check-in: f7bed407d3 user: olr tags: lo, multid
17:41
[lo] use spellchecker instead of ibdawg check-in: 6cde77e557 user: olr tags: lo, multid
16:58
[build] new path for LibreOffice 6 check-in: 2a51dbc9a0 user: olr tags: build, multid
Changes

Modified gc_lang/fr/oxt/ContextMenu/ContextMenu.py from [786f8f5273] to [512c45de75].

8
9
10
11
12
13
14
15

16
17
18
19
20
21

22
23
24
25
26
27
28
8
9
10
11
12
13
14

15
16
17
18
19
20

21
22
23
24
25
26
27
28







-
+





-
+








from com.sun.star.task import XJob
from com.sun.star.ui import XContextMenuInterceptor
#from com.sun.star.ui.ContextMenuInterceptorAction import IGNORED
#from com.sun.star.ui.ContextMenuInterceptorAction import EXECUTE_MODIFIED

import grammalecte.fr.lexicographe as lxg
from grammalecte.graphspell.ibdawg import IBDAWG
from grammalecte.graphspell.spellchecker import SpellChecker
from grammalecte.graphspell.echo import echo
import helpers


xDesktop = None
oDict = None
oSpellChecker = None
oLexicographe = None


class MyContextMenuInterceptor (XContextMenuInterceptor, unohelper.Base):
    def __init__ (self, ctx):
        self.ctx = ctx

115
116
117
118
119
120
121
122

123
124
125
126
127

128
129
130
131
132

133
134

135
136

137
138
139
140
141
142
143
115
116
117
118
119
120
121

122
123
124
125
126

127
128
129
130
131

132
133

134
135

136
137
138
139
140
141
142
143







-
+




-
+




-
+

-
+

-
+







        return xCursor.String.strip('.')


class JobExecutor (XJob, unohelper.Base):
    def __init__ (self, ctx):
        self.ctx = ctx
        global xDesktop
        global oDict
        global oSpellChecker
        global oLexicographe
        try:
            if not xDesktop:
                xDesktop = self.ctx.getServiceManager().createInstanceWithContext('com.sun.star.frame.Desktop', self.ctx)
            if not oDict:
            if not oSpellChecker:
                xCurCtx = uno.getComponentContext()
                oGC = self.ctx.ServiceManager.createInstanceWithContext("org.openoffice.comp.pyuno.Lightproof.grammalecte", self.ctx)
                if hasattr(oGC, "getSpellChecker"):
                    # https://bugs.documentfoundation.org/show_bug.cgi?id=97790
                    oDict = oGC.getSpellChecker()
                    oSpellChecker = oGC.getSpellChecker()
                else:
                    oDict = IBDAWG("${dic_filename}.bdic")
                    oSpellChecker = SpellChecker("${lang}", "${dic_filename}.bdic")
            if not oLexicographe:
                oLexicographe = lxg.Lexicographe(oDict)
                oLexicographe = lxg.Lexicographe(oSpellChecker)
        except:
            traceback.print_exc()
        
    def execute (self, args):
        if not args:
            return
        try: