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      8   
     9      9   from com.sun.star.task import XJob
    10     10   from com.sun.star.ui import XContextMenuInterceptor
    11     11   #from com.sun.star.ui.ContextMenuInterceptorAction import IGNORED
    12     12   #from com.sun.star.ui.ContextMenuInterceptorAction import EXECUTE_MODIFIED
    13     13   
    14     14   import grammalecte.fr.lexicographe as lxg
    15         -from grammalecte.graphspell.ibdawg import IBDAWG
           15  +from grammalecte.graphspell.spellchecker import SpellChecker
    16     16   from grammalecte.graphspell.echo import echo
    17     17   import helpers
    18     18   
    19     19   
    20     20   xDesktop = None
    21         -oDict = None
           21  +oSpellChecker = None
    22     22   oLexicographe = None
    23     23   
    24     24   
    25     25   class MyContextMenuInterceptor (XContextMenuInterceptor, unohelper.Base):
    26     26       def __init__ (self, ctx):
    27     27           self.ctx = ctx
    28     28   
................................................................................
   115    115           return xCursor.String.strip('.')
   116    116   
   117    117   
   118    118   class JobExecutor (XJob, unohelper.Base):
   119    119       def __init__ (self, ctx):
   120    120           self.ctx = ctx
   121    121           global xDesktop
   122         -        global oDict
          122  +        global oSpellChecker
   123    123           global oLexicographe
   124    124           try:
   125    125               if not xDesktop:
   126    126                   xDesktop = self.ctx.getServiceManager().createInstanceWithContext('com.sun.star.frame.Desktop', self.ctx)
   127         -            if not oDict:
          127  +            if not oSpellChecker:
   128    128                   xCurCtx = uno.getComponentContext()
   129    129                   oGC = self.ctx.ServiceManager.createInstanceWithContext("org.openoffice.comp.pyuno.Lightproof.grammalecte", self.ctx)
   130    130                   if hasattr(oGC, "getSpellChecker"):
   131    131                       # https://bugs.documentfoundation.org/show_bug.cgi?id=97790
   132         -                    oDict = oGC.getSpellChecker()
          132  +                    oSpellChecker = oGC.getSpellChecker()
   133    133                   else:
   134         -                    oDict = IBDAWG("${dic_filename}.bdic")
          134  +                    oSpellChecker = SpellChecker("${lang}", "${dic_filename}.bdic")
   135    135               if not oLexicographe:
   136         -                oLexicographe = lxg.Lexicographe(oDict)
          136  +                oLexicographe = lxg.Lexicographe(oSpellChecker)
   137    137           except:
   138    138               traceback.print_exc()
   139    139           
   140    140       def execute (self, args):
   141    141           if not args:
   142    142               return
   143    143           try: