Grammalecte  Check-in [616a21e49f]

Overview
Comment:[lo] launch lexical editor from context menu
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | lo
Files: files | file ages | folders
SHA3-256: 616a21e49f1463e7d42c8ce77614a4653ac723766184e19c4570068267bb9293
User & Date: olr on 2020-11-02 15:07:53
Other Links: manifest | tags
Context
2020-11-03
12:35
[fr] ajustements check-in: 3cffdae3b0 user: olr tags: fr, trunk
2020-11-02
15:07
[lo] launch lexical editor from context menu check-in: 616a21e49f user: olr tags: lo, trunk
14:49
[fr] ajustements check-in: e83a01147e user: olr tags: fr, trunk
Changes

Modified gc_lang/fr/oxt/AppLauncher.py from [b4674c5ea1] to [7f07846793].

11
12
13
14
15
16
17

18
19
20
21
22
23
24
25
26
27
28
29
30

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

53



54


55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import uno
from com.sun.star.task import XJobExecutor

import helpers


xDesktop = None



class AppLauncher (unohelper.Base, XJobExecutor):
    def __init__ (self, ctx):
        self.ctx = ctx
        # In this extension, French is default language.
        # It is assumed that those who need to use the French dictionaries understand French and may not understand English.
        xSettings = helpers.getConfigSetting("/org.openoffice.Setup/L10N", False)
        sLocale = xSettings.getByName("ooLocale")  # Note: look at ooSetupSystemLocale value?
        self.sLang = sLocale[0:2]

    # XJobExecutor
    def trigger (self, sCmd):

        try:
            if sCmd == "About":
                import About
                xDialog = About.AboutGrammalecte(self.ctx)
                xDialog.run(self.sLang)
            elif sCmd.startswith("CJ"):
                import Conjugueur
                xDialog = Conjugueur.Conjugueur(self.ctx)
                if sCmd[2:3] == "/":
                    xDialog.run(sCmd[3:])
                else:
                    xDialog.run()
            elif sCmd == "TF":
                import TextFormatter
                xDialog = TextFormatter.TextFormatter(self.ctx)
                xDialog.run(self.sLang)
            elif sCmd == "DI":
                import DictOptions
                xDialog = DictOptions.DictOptions(self.ctx)
                xDialog.run(self.sLang)
            elif sCmd == "LE":
                import LexiconEditor

                xDialog = LexiconEditor.LexiconEditor(self.ctx)



                xDialog.run(self.sLang)


            elif sCmd == "MA":
                import Author
                xDialog = Author.Author(self.ctx)
                xDialog.run(self.sLang)
            elif sCmd == "OP":
                import Options
                xDialog = Options.GC_Options(self.ctx)
                xDialog.run(self.sLang)
            elif sCmd == "EN":
                import Enumerator
                xDialog = Enumerator.Enumerator(self.ctx)
                xDialog.run(self.sLang)
            elif sCmd == "GO":
                import GraphicOptions
                xDialog = GraphicOptions.GraphicOptions(self.ctx)
                xDialog.run(self.sLang)
            elif sCmd.startswith("FA/"):
                findAll(sCmd[6:], (sCmd[3:4] == "y"), (sCmd[4:5] == "y"))
            # elif sCmd.startswith("URL/"):
            #     # Call from context menu to launch URL?
            #     # http://opengrok.libreoffice.org/xref/core/sw/source/ui/lingu/olmenu.cxx#785
            #     xSystemShellExecute = self.ctx.getServiceManager().createInstanceWithContext('com.sun.star.system.SystemShellExecute', self.ctx)
            #     xSystemShellExecute.execute(url, "", uno.getConstantByName("com.sun.star.system.SystemShellExecuteFlags.URIS_ONLY"))







>













>



|
|


|

|

|


|
|


|
|
|

>
|
>
>
>
|
>
>


|
|


|
|


|
|


|
|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import uno
from com.sun.star.task import XJobExecutor

import helpers


xDesktop = None
xLEDialog = None       # dialog for Lexicon Editor


class AppLauncher (unohelper.Base, XJobExecutor):
    def __init__ (self, ctx):
        self.ctx = ctx
        # In this extension, French is default language.
        # It is assumed that those who need to use the French dictionaries understand French and may not understand English.
        xSettings = helpers.getConfigSetting("/org.openoffice.Setup/L10N", False)
        sLocale = xSettings.getByName("ooLocale")  # Note: look at ooSetupSystemLocale value?
        self.sLang = sLocale[0:2]

    # XJobExecutor
    def trigger (self, sCmd):
        global xLEDialog
        try:
            if sCmd == "About":
                import About
                xAboutDialog = About.AboutGrammalecte(self.ctx)
                xAboutDialog.run(self.sLang)
            elif sCmd.startswith("CJ"):
                import Conjugueur
                xConjDialog = Conjugueur.Conjugueur(self.ctx)
                if sCmd[2:3] == "/":
                    xConjDialog.run(sCmd[3:])
                else:
                    xConjDialog.run()
            elif sCmd == "TF":
                import TextFormatter
                xTFDialog = TextFormatter.TextFormatter(self.ctx)
                xTFDialog.run(self.sLang)
            elif sCmd == "DI":
                import DictOptions
                xDODialog = DictOptions.DictOptions(self.ctx)
                xDODialog.run(self.sLang)
            elif sCmd.startswith("LE"):
                import LexiconEditor
                if not xLEDialog or xLEDialog.bClosed:
                    xLEDialog = LexiconEditor.LexiconEditor(self.ctx)
                    if sCmd[2:3] == "/":
                        xLEDialog.run(self.sLang, sCmd[3:])
                    else:
                        xLEDialog.run(self.sLang)
                elif sCmd[2:3] == "/":
                    xLEDialog.newEntry(sCmd[3:])
            elif sCmd == "MA":
                import Author
                xAuthorDialog = Author.Author(self.ctx)
                xAuthorDialog.run(self.sLang)
            elif sCmd == "OP":
                import Options
                xGCDialog = Options.GC_Options(self.ctx)
                xGCDialog.run(self.sLang)
            elif sCmd == "EN":
                import Enumerator
                xEnumDialog = Enumerator.Enumerator(self.ctx)
                xEnumDialog.run(self.sLang)
            elif sCmd == "GO":
                import GraphicOptions
                xGODialog = GraphicOptions.GraphicOptions(self.ctx)
                xGODialog.run(self.sLang)
            elif sCmd.startswith("FA/"):
                findAll(sCmd[6:], (sCmd[3:4] == "y"), (sCmd[4:5] == "y"))
            # elif sCmd.startswith("URL/"):
            #     # Call from context menu to launch URL?
            #     # http://opengrok.libreoffice.org/xref/core/sw/source/ui/lingu/olmenu.cxx#785
            #     xSystemShellExecute = self.ctx.getServiceManager().createInstanceWithContext('com.sun.star.system.SystemShellExecute', self.ctx)
            #     xSystemShellExecute.execute(url, "", uno.getConstantByName("com.sun.star.system.SystemShellExecuteFlags.URIS_ONLY"))

Modified gc_lang/fr/oxt/ContextMenu/ContextMenu.py from [172f2404b4] to [c17c3b29b1].

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82






83
84
85
86
87
88
89
...
109
110
111
112
113
114
115

116
117
118
119
120
121
122
    def __init__ (self, ctx):
        self.ctx = ctx

    def notifyContextMenuExecute (self, xEvent):
        sWord = self._getWord()
        try:
            lWordAndMorph = oSpellChecker.analyze(sWord)
            if not lWordAndMorph:
                return uno.Enum("com.sun.star.ui.ContextMenuInterceptorAction", "IGNORED") # don’t work on AOO, have to import the value
                #return IGNORED
            xContextMenu = xEvent.ActionTriggerContainer
            if xContextMenu:
                # entries index
                i = xContextMenu.Count
                nUnoConstantLine = uno.getConstantByName("com.sun.star.ui.ActionTriggerSeparatorType.LINE")


                # word analysis
                i = self._addItemToContextMenu(xContextMenu, i, "ActionTriggerSeparator", SeparatorType=nUnoConstantLine)
                for sWord, lMorph in lWordAndMorph:
                    if len(lMorph) == 1:
                        sMorph, sReadableMorph = lMorph[0]
                        i = self._addItemToContextMenu(xContextMenu, i, "ActionTrigger", Text=sWord + " : " + sReadableMorph, CommandURL="service:net.grammalecte.AppLauncher?None")
                    elif len(lMorph) >= 1:
                        # submenu
                        xSubMenuContainer = xContextMenu.createInstance("com.sun.star.ui.ActionTriggerContainer")
                        for j, (sMorph, sReadableMorph) in enumerate(lMorph):
                            self._addItemToContextMenu(xSubMenuContainer, j, "ActionTrigger", Text=sReadableMorph, CommandURL="service:net.grammalecte.AppLauncher?None")
                        # create root menu entry
                        i = self._addItemToContextMenu(xContextMenu, i, "ActionTrigger", Text=sWord, SubContainer=xSubMenuContainer)
                    else:
                        i = self._addItemToContextMenu(xContextMenu, i, "ActionTrigger", Text=sWord + " : [erreur] aucun résultat trouvé.")

                # Links to Conjugueur
                aVerb = { sMorph[1:sMorph.find("/")]  for sMorph in oSpellChecker.getMorph(sWord) if ":V" in sMorph }
                if aVerb:
                    i = self._addItemToContextMenu(xContextMenu, i, "ActionTriggerSeparator", SeparatorType=nUnoConstantLine)
                    for sVerb in aVerb:
                        i = self._addItemToContextMenu(xContextMenu, i, "ActionTrigger", Text="Conjuguer “{}”…".format(sVerb), \
                                                        CommandURL="service:net.grammalecte.AppLauncher?CJ/"+sVerb)

                # Search
                xDoc = xDesktop.getCurrentComponent()
                xViewCursor = xDoc.CurrentController.ViewCursor
                if not xViewCursor.isCollapsed():
                    sSelec = xViewCursor.getString()
                    if sSelec.count(" ") <= 2:
                        i = self._addItemToContextMenu(xContextMenu, i, "ActionTriggerSeparator", SeparatorType=nUnoConstantLine)
                        # submenu
                        xSubMenuContainer = xContextMenu.createInstance("com.sun.star.ui.ActionTriggerContainer")
                        self._addItemToContextMenu(xSubMenuContainer, 0, "ActionTrigger", Text="insensible à la casse",
                                                   CommandURL="service:net.grammalecte.AppLauncher?FA/nn/"+sSelec)
                        self._addItemToContextMenu(xSubMenuContainer, 1, "ActionTrigger", Text="casse préservée",
                                                   CommandURL="service:net.grammalecte.AppLauncher?FA/yn/"+sSelec)
                        self._addItemToContextMenu(xSubMenuContainer, 2, "ActionTrigger", Text="mot(s) entier(s)",
                                                   CommandURL="service:net.grammalecte.AppLauncher?FA/ny/"+sSelec)
                        self._addItemToContextMenu(xSubMenuContainer, 3, "ActionTrigger", Text="casse préservée + mot(s) entier(s)",
                                                   CommandURL="service:net.grammalecte.AppLauncher?FA/yy/"+sSelec)
                        # create root menu entry
                        i = self._addItemToContextMenu(xContextMenu, i, "ActionTrigger", Text="Rechercher “{}”".format(sSelec),
                                                       SubContainer=xSubMenuContainer)






                # The controller should execute the modified context menu and stop notifying other interceptors.
                return uno.Enum("com.sun.star.ui.ContextMenuInterceptorAction", "EXECUTE_MODIFIED") # don’t work on AOO, have to import the value
                #return EXECUTE_MODIFIED # Doesn’t work since LO 5.3
        except:
            traceback.print_exc()
        return uno.Enum("com.sun.star.ui.ContextMenuInterceptorAction", "IGNORED") # don’t work on AOO, have to import the value
        #return IGNORED # Doesn’t work since LO 5.3
................................................................................
            xCursor.gotoEndOfWord(True)
        except:
            traceback.print_exc()
        return xCursor.String.strip('.')


class JobExecutor (XJob, unohelper.Base):

    def __init__ (self, ctx):
        self.ctx = ctx
        global xDesktop
        global oSpellChecker
        try:
            if not xDesktop:
                xDesktop = self.ctx.getServiceManager().createInstanceWithContext('com.sun.star.frame.Desktop', self.ctx)







|
|
|






>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
>
>
>
>







 







>







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
...
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
    def __init__ (self, ctx):
        self.ctx = ctx

    def notifyContextMenuExecute (self, xEvent):
        sWord = self._getWord()
        try:
            lWordAndMorph = oSpellChecker.analyze(sWord)
            # if not lWordAndMorph:
            #     return uno.Enum("com.sun.star.ui.ContextMenuInterceptorAction", "IGNORED") # don’t work on AOO, have to import the value
            #     #return IGNORED
            xContextMenu = xEvent.ActionTriggerContainer
            if xContextMenu:
                # entries index
                i = xContextMenu.Count
                nUnoConstantLine = uno.getConstantByName("com.sun.star.ui.ActionTriggerSeparatorType.LINE")

                if lWordAndMorph:
                    # word analysis
                    i = self._addItemToContextMenu(xContextMenu, i, "ActionTriggerSeparator", SeparatorType=nUnoConstantLine)
                    for sWord, lMorph in lWordAndMorph:
                        if len(lMorph) == 1:
                            sMorph, sReadableMorph = lMorph[0]
                            i = self._addItemToContextMenu(xContextMenu, i, "ActionTrigger", Text=sWord + " : " + sReadableMorph, CommandURL="service:net.grammalecte.AppLauncher?None")
                        elif len(lMorph) >= 1:
                            # submenu
                            xSubMenuContainer = xContextMenu.createInstance("com.sun.star.ui.ActionTriggerContainer")
                            for j, (sMorph, sReadableMorph) in enumerate(lMorph):
                                self._addItemToContextMenu(xSubMenuContainer, j, "ActionTrigger", Text=sReadableMorph, CommandURL="service:net.grammalecte.AppLauncher?None")
                            # create root menu entry
                            i = self._addItemToContextMenu(xContextMenu, i, "ActionTrigger", Text=sWord, SubContainer=xSubMenuContainer)
                        else:
                            i = self._addItemToContextMenu(xContextMenu, i, "ActionTrigger", Text=sWord + " : [erreur] aucun résultat trouvé.")

                    # Links to Conjugueur
                    aVerb = { sMorph[1:sMorph.find("/")]  for sMorph in oSpellChecker.getMorph(sWord) if ":V" in sMorph }
                    if aVerb:
                        i = self._addItemToContextMenu(xContextMenu, i, "ActionTriggerSeparator", SeparatorType=nUnoConstantLine)
                        for sVerb in aVerb:
                            i = self._addItemToContextMenu(xContextMenu, i, "ActionTrigger", Text="Conjuguer “{}”…".format(sVerb), \
                                                            CommandURL="service:net.grammalecte.AppLauncher?CJ/"+sVerb)

                    # Search
                    xDoc = xDesktop.getCurrentComponent()
                    xViewCursor = xDoc.CurrentController.ViewCursor
                    if not xViewCursor.isCollapsed():
                        sSelec = xViewCursor.getString()
                        if sSelec.count(" ") <= 2:
                            i = self._addItemToContextMenu(xContextMenu, i, "ActionTriggerSeparator", SeparatorType=nUnoConstantLine)
                            # submenu
                            xSubMenuContainer = xContextMenu.createInstance("com.sun.star.ui.ActionTriggerContainer")
                            self._addItemToContextMenu(xSubMenuContainer, 0, "ActionTrigger", Text="insensible à la casse",
                                                       CommandURL="service:net.grammalecte.AppLauncher?FA/nn/"+sSelec)
                            self._addItemToContextMenu(xSubMenuContainer, 1, "ActionTrigger", Text="casse préservée",
                                                       CommandURL="service:net.grammalecte.AppLauncher?FA/yn/"+sSelec)
                            self._addItemToContextMenu(xSubMenuContainer, 2, "ActionTrigger", Text="mot(s) entier(s)",
                                                       CommandURL="service:net.grammalecte.AppLauncher?FA/ny/"+sSelec)
                            self._addItemToContextMenu(xSubMenuContainer, 3, "ActionTrigger", Text="casse préservée + mot(s) entier(s)",
                                                       CommandURL="service:net.grammalecte.AppLauncher?FA/yy/"+sSelec)
                            # create root menu entry
                            i = self._addItemToContextMenu(xContextMenu, i, "ActionTrigger", Text="Rechercher “{}”".format(sSelec),
                                                           SubContainer=xSubMenuContainer)
                else:
                    # Link to Lexicon Editor
                    i = self._addItemToContextMenu(xContextMenu, i, "ActionTriggerSeparator", SeparatorType=nUnoConstantLine)
                    i = self._addItemToContextMenu(xContextMenu, i, "ActionTrigger", Text="Éditeur lexical…", \
                                                            CommandURL="service:net.grammalecte.AppLauncher?LE/"+sWord)

                # The controller should execute the modified context menu and stop notifying other interceptors.
                return uno.Enum("com.sun.star.ui.ContextMenuInterceptorAction", "EXECUTE_MODIFIED") # don’t work on AOO, have to import the value
                #return EXECUTE_MODIFIED # Doesn’t work since LO 5.3
        except:
            traceback.print_exc()
        return uno.Enum("com.sun.star.ui.ContextMenuInterceptorAction", "IGNORED") # don’t work on AOO, have to import the value
        #return IGNORED # Doesn’t work since LO 5.3
................................................................................
            xCursor.gotoEndOfWord(True)
        except:
            traceback.print_exc()
        return xCursor.String.strip('.')


class JobExecutor (XJob, unohelper.Base):

    def __init__ (self, ctx):
        self.ctx = ctx
        global xDesktop
        global oSpellChecker
        try:
            if not xDesktop:
                xDesktop = self.ctx.getServiceManager().createInstanceWithContext('com.sun.star.frame.Desktop', self.ctx)

Modified gc_lang/fr/oxt/DictOptions/LexiconEditor.py from [afc37335be] to [828f4f365e].

68
69
70
71
72
73
74

75
76
77
78
79
80
81
...
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
...
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
...
297
298
299
300
301
302
303



304
305
306
307
308
309
310
...
319
320
321
322
323
324
325

326
327
328
329
330
331
332
    def __init__ (self, ctx):
        self.ctx = ctx
        self.xSvMgr = self.ctx.ServiceManager
        self.xDesktop = self.xSvMgr.createInstanceWithContext("com.sun.star.frame.Desktop", self.ctx)
        self.xDocument = self.xDesktop.getCurrentComponent()
        self.xContainer = None
        self.xDialog = None

        self.oPersonalDicJSON = None
        # data
        self.sLemma = ""
        self.lGeneratedFlex = []
        # options node
        self.xSettingNode = helpers.getConfigSetting("/org.openoffice.Lightproof_grammalecte/Other/", True)
        self.xOptionNode = self.xSettingNode.getByName("o_fr")
................................................................................
                setattr(xCol, k, w)
            xColumnModel.addColumn(xCol)
        for k, w in kwargs.items():
            setattr(xGridModel, k, w)
        self.xDialog.insertByName(name, xGridModel)
        return xGridModel

    def run (self, sLang):
        # ui lang
        self.sLang = sLang
        self.dUI = lxe_strings.getUI(sLang)

        # dialog
        self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx)
        self.xDialog.Width = 550
................................................................................
        self.xDateDic = self._addWidget("save_date", 'FixedText', nXB+85, nY0+2, 75, nHeight, Label = self.dUI.get("void", "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x000088)
        self.xNumDic = self._addWidget("num_of_entries2", 'FixedText', nXC+70, nY0+2, 45, nHeight, Label = "0", FontDescriptor = xFDSubTitle, TextColor = 0x000088)
        self.xImport = self._addWidget('import_button', 'Button', self.xDialog.Width-90, nY0, 40, 12, Label = self.dUI.get('import_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x000055)
        self.xExport = self._addWidget('export_button', 'Button', self.xDialog.Width-45, nY0, 40, 12, Label = self.dUI.get('export_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x000055)

        #### Add word
        self._addWidget("add_section", 'FixedLine', nX1, nY1, 170, nHeight, Label = self.dUI.get("add_section", "#err"), FontDescriptor = xFDTitle)
        self.xLemma = self._addWidget('lemma', 'Edit', nX1, nY1+10, 100, 14, FontDescriptor = xFDTitle)
        self._addWidget('search_button', 'Button', nX1+105, nY1+11, 45, 12, Label = self.dUI.get('search_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x555500)
        self._addWidget('information_button', 'Button', nX1+155, nY1+11, 15, 12, Label = self.dUI.get('information_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x555500)

        # Radio buttons: main POS tag
        # Note: the only way to group RadioButtons is to create them successively
        self.xNA = self._addWidget('nom_adj', 'RadioButton', nX1, nY2+12, 60, nHeight, Label = self.dUI.get("nom_adj", "#err"), HelpText = ":N:A")
        self.xN = self._addWidget('nom', 'RadioButton', nX1, nY2+22, 60, nHeight, Label = self.dUI.get("nom", "#err"), HelpText = ":N")
................................................................................
            self.xContainer.getControl(sName).addKeyListener(self)

    def _createActionListeners (self, lNames, sAction):
        for sName in lNames:
            self.xContainer.getControl(sName).addActionListener(self)
            self.xContainer.getControl(sName).setActionCommand(sAction)




    # XActionListener
    def actionPerformed (self, xActionEvent):
        try:
            if xActionEvent.ActionCommand == "Update":
                self.updateGenWords()
            elif xActionEvent.ActionCommand == "SearchWords":
                self.launchSearchWords()
................................................................................
            elif xActionEvent.ActionCommand == "Import":
                self.importDictionary()
            elif xActionEvent.ActionCommand == "Export":
                self.exportDictionary()
            elif xActionEvent.ActionCommand == 'Info':
                pass
            elif xActionEvent.ActionCommand == "Close":

                self.xContainer.dispose()           # Non modal dialog
                #self.xContainer.endExecute()       # Modal dialog
        except:
            traceback.print_exc()

    # XTopWindowListener (useful for non modal dialog only)
    def windowOpened (self, xEvent):







>







 







|







 







|







 







>
>
>







 







>







68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
...
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
...
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
...
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
...
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
    def __init__ (self, ctx):
        self.ctx = ctx
        self.xSvMgr = self.ctx.ServiceManager
        self.xDesktop = self.xSvMgr.createInstanceWithContext("com.sun.star.frame.Desktop", self.ctx)
        self.xDocument = self.xDesktop.getCurrentComponent()
        self.xContainer = None
        self.xDialog = None
        self.bClosed = False
        self.oPersonalDicJSON = None
        # data
        self.sLemma = ""
        self.lGeneratedFlex = []
        # options node
        self.xSettingNode = helpers.getConfigSetting("/org.openoffice.Lightproof_grammalecte/Other/", True)
        self.xOptionNode = self.xSettingNode.getByName("o_fr")
................................................................................
                setattr(xCol, k, w)
            xColumnModel.addColumn(xCol)
        for k, w in kwargs.items():
            setattr(xGridModel, k, w)
        self.xDialog.insertByName(name, xGridModel)
        return xGridModel

    def run (self, sLang, sWord=""):
        # ui lang
        self.sLang = sLang
        self.dUI = lxe_strings.getUI(sLang)

        # dialog
        self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx)
        self.xDialog.Width = 550
................................................................................
        self.xDateDic = self._addWidget("save_date", 'FixedText', nXB+85, nY0+2, 75, nHeight, Label = self.dUI.get("void", "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x000088)
        self.xNumDic = self._addWidget("num_of_entries2", 'FixedText', nXC+70, nY0+2, 45, nHeight, Label = "0", FontDescriptor = xFDSubTitle, TextColor = 0x000088)
        self.xImport = self._addWidget('import_button', 'Button', self.xDialog.Width-90, nY0, 40, 12, Label = self.dUI.get('import_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x000055)
        self.xExport = self._addWidget('export_button', 'Button', self.xDialog.Width-45, nY0, 40, 12, Label = self.dUI.get('export_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x000055)

        #### Add word
        self._addWidget("add_section", 'FixedLine', nX1, nY1, 170, nHeight, Label = self.dUI.get("add_section", "#err"), FontDescriptor = xFDTitle)
        self.xLemma = self._addWidget('lemma', 'Edit', nX1, nY1+10, 100, 14, Text = sWord, FontDescriptor = xFDTitle)
        self._addWidget('search_button', 'Button', nX1+105, nY1+11, 45, 12, Label = self.dUI.get('search_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x555500)
        self._addWidget('information_button', 'Button', nX1+155, nY1+11, 15, 12, Label = self.dUI.get('information_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x555500)

        # Radio buttons: main POS tag
        # Note: the only way to group RadioButtons is to create them successively
        self.xNA = self._addWidget('nom_adj', 'RadioButton', nX1, nY2+12, 60, nHeight, Label = self.dUI.get("nom_adj", "#err"), HelpText = ":N:A")
        self.xN = self._addWidget('nom', 'RadioButton', nX1, nY2+22, 60, nHeight, Label = self.dUI.get("nom", "#err"), HelpText = ":N")
................................................................................
            self.xContainer.getControl(sName).addKeyListener(self)

    def _createActionListeners (self, lNames, sAction):
        for sName in lNames:
            self.xContainer.getControl(sName).addActionListener(self)
            self.xContainer.getControl(sName).setActionCommand(sAction)

    def newEntry (self, sWord):
        self.xLemma.Text = sWord

    # XActionListener
    def actionPerformed (self, xActionEvent):
        try:
            if xActionEvent.ActionCommand == "Update":
                self.updateGenWords()
            elif xActionEvent.ActionCommand == "SearchWords":
                self.launchSearchWords()
................................................................................
            elif xActionEvent.ActionCommand == "Import":
                self.importDictionary()
            elif xActionEvent.ActionCommand == "Export":
                self.exportDictionary()
            elif xActionEvent.ActionCommand == 'Info':
                pass
            elif xActionEvent.ActionCommand == "Close":
                self.bClosed = True
                self.xContainer.dispose()           # Non modal dialog
                #self.xContainer.endExecute()       # Modal dialog
        except:
            traceback.print_exc()

    # XTopWindowListener (useful for non modal dialog only)
    def windowOpened (self, xEvent):