Grammalecte  Diff

Differences From Artifact [84e566480c]:

To Artifact [f06cffc0e3]:


1
2
3
4
5
6
7
8
# -*- coding: utf8 -*-
# Grammalecte - Lexicographe
# by Olivier R. License: MPL 2

import uno
import unohelper
import traceback

<








1
2
3
4
5
6
7

# Grammalecte - Lexicographe
# by Olivier R. License: MPL 2

import uno
import unohelper
import traceback

93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
    def _addItemToContextMenu (self, xContextMenu, i, sType, **args):
        xMenuItem = xContextMenu.createInstance("com.sun.star.ui."+sType)
        #echo("com.sun.star.ui."+sType)
        for k, v in args.items():
            xMenuItem.setPropertyValue(k, v)
            #print("> ", k, v, xMenuItem)
        xContextMenu.insertByIndex(i, xMenuItem)

        return i + 1

    def _getWord (self):
        try:
            xDoc = xDesktop.getCurrentComponent()
            xViewCursor = xDoc.CurrentController.ViewCursor
            if xViewCursor.CharLocale.Language != "fr":







<







92
93
94
95
96
97
98

99
100
101
102
103
104
105
    def _addItemToContextMenu (self, xContextMenu, i, sType, **args):
        xMenuItem = xContextMenu.createInstance("com.sun.star.ui."+sType)
        #echo("com.sun.star.ui."+sType)
        for k, v in args.items():
            xMenuItem.setPropertyValue(k, v)
            #print("> ", k, v, xMenuItem)
        xContextMenu.insertByIndex(i, xMenuItem)

        return i + 1

    def _getWord (self):
        try:
            xDoc = xDesktop.getCurrentComponent()
            xViewCursor = xDoc.CurrentController.ViewCursor
            if xViewCursor.CharLocale.Language != "fr":
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
        except:
            traceback.print_exc()

    def execute (self, args):
        if not args:
            return
        try:
            # what version of the software?
            xSettings = helpers.getConfigSetting("org.openoffice.Setup/Product", False)
            sProdName = xSettings.getByName("ooName")
            sVersion = xSettings.getByName("ooSetupVersion")
            if (sProdName == "LibreOffice" and sVersion < "4") or sProdName == "OpenOffice.org":
                return

            # what event?
            bCorrectEvent = False
            for arg in args:
                if arg.Name == "Environment":







<
<
<
|







135
136
137
138
139
140
141



142
143
144
145
146
147
148
149
        except:
            traceback.print_exc()

    def execute (self, args):
        if not args:
            return
        try:



            sProdName, sVersion = helpers.getProductNameAndVersion()
            if (sProdName == "LibreOffice" and sVersion < "4") or sProdName == "OpenOffice.org":
                return

            # what event?
            bCorrectEvent = False
            for arg in args:
                if arg.Name == "Environment":