Grammalecte  Diff

Differences From Artifact [3b33016da8]:

To Artifact [786f8f5273]:


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

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.ibdawg import IBDAWG
from grammalecte.echo import echo
import helpers


xDesktop = None
oDict = None
oLexicographe = None








|
|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

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.echo import echo
import helpers


xDesktop = None
oDict = None
oLexicographe = None

123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
        global oLexicographe
        try:
            if not xDesktop:
                xDesktop = self.ctx.getServiceManager().createInstanceWithContext('com.sun.star.frame.Desktop', self.ctx)
            if not oDict:
                xCurCtx = uno.getComponentContext()
                oGC = self.ctx.ServiceManager.createInstanceWithContext("org.openoffice.comp.pyuno.Lightproof.grammalecte", self.ctx)
                if hasattr(oGC, "getDictionary"):
                    # https://bugs.documentfoundation.org/show_bug.cgi?id=97790
                    oDict = oGC.getDictionary()
                else:
                    oDict = IBDAWG("French.bdic")
            if not oLexicographe:
                oLexicographe = lxg.Lexicographe(oDict)
        except:
            traceback.print_exc()
        
    def execute (self, args):
        if not args:







|

|

|







123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
        global oLexicographe
        try:
            if not xDesktop:
                xDesktop = self.ctx.getServiceManager().createInstanceWithContext('com.sun.star.frame.Desktop', self.ctx)
            if not oDict:
                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()
                else:
                    oDict = IBDAWG("${dic_filename}.bdic")
            if not oLexicographe:
                oLexicographe = lxg.Lexicographe(oDict)
        except:
            traceback.print_exc()
        
    def execute (self, args):
        if not args: