Grammalecte  Changes On Branch af32e20bdb0bcb20

Changes In Branch multid Through [af32e20bdb] Excluding Merge-Ins

This is equivalent to a diff from 1cb2c395f6 to af32e20bdb

2018-02-25
08:47
[lo] lexicon editor check-in: 5a1baacbbb user: olr tags: new_feature, lo, multid
2018-02-24
07:55
[lo] Enumerator: new labels check-in: fd2d476ebf user: olr tags: trunk, lo
2018-02-23
21:00
merge trunk check-in: af32e20bdb user: olr tags: multid
20:46
[lo][bug] enumerator: valuemax of progressbar check-in: 1cb2c395f6 user: olr tags: trunk, lo
19:33
[lo][bug] Enumerator: reset characters style to default check-in: 7ec8d520ec user: olr tags: trunk, lo
2018-02-19
18:06
[lo] dictionaries options: remove print check-in: ba7c03de83 user: olr tags: lo, multid

Modified gc_core/py/oxt/OptionsDialog.xcs from [bfbbfee5a6] to [412b78821f].

12
13
14
15
16
17
18










19
20
21
22
23
24




25
26
27
    <templates>
        <group oor:name="${lang}">
            <info>
                <desc>The data for one leaf.</desc>
            </info>
            ${xcs_options}
        </group>










    </templates>

    <component>
        <group oor:name="Leaves">
            <node-ref oor:name="${lang}" oor:node-type="${lang}" />
        </group>




    </component>

</oor:component-schema>







>
>
>
>
>
>
>
>
>
>






>
>
>
>



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
    <templates>
        <group oor:name="${lang}">
            <info>
                <desc>The data for one leaf.</desc>
            </info>
            ${xcs_options}
        </group>

        <group oor:name="o_${lang}">
            <info>
                <desc>The data for one leaf.</desc>
            </info>
            <prop oor:name="graphspell" oor:type="xs:int"><value>1</value></prop>
            <prop oor:name="graphspellsugg" oor:type="xs:int"><value>1</value></prop>
            <prop oor:name="extended_dic" oor:type="xs:int"><value>0</value></prop>
            <prop oor:name="personal_dic" oor:type="xs:int"><value>1</value></prop>
        </group>
    </templates>

    <component>
        <group oor:name="Leaves">
            <node-ref oor:name="${lang}" oor:node-type="${lang}" />
        </group>

        <group oor:name="Other">
            <node-ref oor:name="o_${lang}" oor:node-type="o_${lang}" />
        </group>
    </component>

</oor:component-schema>

Added gc_core/py/oxt/helpers.py version [f3ef6493bc].





















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
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
# Helpers for LibreOffice extension

import os
import traceback

import uno

from com.sun.star.beans import PropertyValue
from com.sun.star.uno import RuntimeException as _rtex


def xray (myObject):
    "XRay - API explorer"
    try:
        sm = uno.getComponentContext().ServiceManager
        mspf = sm.createInstanceWithContext("com.sun.star.script.provider.MasterScriptProviderFactory", uno.getComponentContext())
        scriptPro = mspf.createScriptProvider("")
        xScript = scriptPro.getScript("vnd.sun.star.script:XrayTool._Main.Xray?language=Basic&location=application")
        xScript.invoke((myObject,), (), ())
        return
    except:
        raise _rtex("\nBasic library Xray is not installed", uno.getComponentContext())


def mri (ctx, xTarget):
    "MRI - API Explorer"
    try:
        xMri = ctx.ServiceManager.createInstanceWithContext("mytools.Mri", ctx)
        xMri.inspect(xTarget)
    except:
        raise _rtex("\nPython extension MRI is not installed", uno.getComponentContext())


def getConfigSetting (sNodeConfig, bUpdate=False):
    "get a configuration node"
    # example: xNode = getConfigSetting("/org.openoffice.Office.Common/Path/Current", False)
    xSvMgr = uno.getComponentContext().ServiceManager
    xConfigProvider = xSvMgr.createInstanceWithContext("com.sun.star.configuration.ConfigurationProvider", uno.getComponentContext())
    xPropertyValue = uno.createUnoStruct("com.sun.star.beans.PropertyValue")
    xPropertyValue.Name = "nodepath"
    xPropertyValue.Value = sNodeConfig
    if bUpdate:
        sService = "com.sun.star.configuration.ConfigurationUpdateAccess"
    else:
        sService = "com.sun.star.configuration.ConfigurationAccess"
    return xConfigProvider.createInstanceWithArguments(sService, (xPropertyValue,)) # return xNode


def printServices (o):
    for s in o.getAvailableServiceNames():
        print(' > '+s)


def getWindowSize ():
    "return main window size"
    xCurCtx = uno.getComponentContext()
    xDesktop = xCurCtx.getServiceManager().createInstanceWithContext('com.sun.star.frame.Desktop', xCurCtx)
    xContainerWindow = xDesktop.getCurrentComponent().CurrentController.Frame.ContainerWindow
    xWindowSize = xContainerWindow.convertSizeToLogic(xContainerWindow.Size, uno.getConstantByName("com.sun.star.util.MeasureUnit.POINT"))
    #print(xContainerWindow.Size.Width, ">", xWindowSize.Width)
    #print(xContainerWindow.Size.Height, ">", xWindowSize.Height)
    xWindowSize.Width = xWindowSize.Width * 0.666
    xWindowSize.Height = xWindowSize.Height * 0.666
    return xWindowSize


def getAbsolutePathOf (sPath=""):
    xDefaultContext = uno.getComponentContext().ServiceManager.DefaultContext
    xPackageInfoProvider = xDefaultContext.getValueByName("/singletons/com.sun.star.deployment.PackageInformationProvider")
    sFullPath = xPackageInfoProvider.getPackageLocation("French.linguistic.resources.from.Dicollecte.by.OlivierR")
    if sPath and not sPath.startswith("/"):
        sPath = "/" + sPath
    sFullPath = sFullPath[8:] + sPath
    return os.path.abspath(sFullPath)

Modified gc_lang/fr/config.ini from [93df40f5c3] to [87fa24eb7e].

71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86



87
88
89
90
91
92
93
oxt/_img/logo120_text.png = img/logo120_text.png
oxt/_img/LaMouette_small.png = img/LaMouette_small.png
oxt/_img/Algoo_logo.png = img/Algoo_logo.png
oxt/_img/grammalecte_16.bmp = img/grammalecte_16.bmp
oxt/_img/french_flag_16.bmp = img/french_flag_16.bmp
# AppLauncher
oxt/AppLauncher.py = AppLauncher.py
oxt/helpers.py = pythonpath/helpers.py
# About
oxt/About/About.py = pythonpath/About.py
oxt/About/ab_strings.py = pythonpath/ab_strings.py
# Dictionaries
oxt/Dictionnaires/dictionaries = dictionaries
oxt/Dictionnaires/dictionaries.xcu = dictionaries.xcu
oxt/Dictionnaires/DictionarySwitcher.py = pythonpath/DictionarySwitcher.py
oxt/Dictionnaires/ds_strings.py = pythonpath/ds_strings.py



# ContextMenu
oxt/ContextMenu/ContextMenu.py = ContextMenu.py
oxt/ContextMenu/jobs.xcu = config/jobs.xcu
# TextFormatter
oxt/TextFormatter/TextFormatter.py = pythonpath/TextFormatter.py
oxt/TextFormatter/tf_strings.py = pythonpath/tf_strings.py
oxt/TextFormatter/tf_options.py = pythonpath/tf_options.py







<








>
>
>







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
oxt/_img/logo120_text.png = img/logo120_text.png
oxt/_img/LaMouette_small.png = img/LaMouette_small.png
oxt/_img/Algoo_logo.png = img/Algoo_logo.png
oxt/_img/grammalecte_16.bmp = img/grammalecte_16.bmp
oxt/_img/french_flag_16.bmp = img/french_flag_16.bmp
# AppLauncher
oxt/AppLauncher.py = AppLauncher.py

# About
oxt/About/About.py = pythonpath/About.py
oxt/About/ab_strings.py = pythonpath/ab_strings.py
# Dictionaries
oxt/Dictionnaires/dictionaries = dictionaries
oxt/Dictionnaires/dictionaries.xcu = dictionaries.xcu
oxt/Dictionnaires/DictionarySwitcher.py = pythonpath/DictionarySwitcher.py
oxt/Dictionnaires/ds_strings.py = pythonpath/ds_strings.py
# Dictionary Options
oxt/DictOptions/DictOptions.py = pythonpath/DictOptions.py
oxt/DictOptions/do_strings.py = pythonpath/do_strings.py
# ContextMenu
oxt/ContextMenu/ContextMenu.py = ContextMenu.py
oxt/ContextMenu/jobs.xcu = config/jobs.xcu
# TextFormatter
oxt/TextFormatter/TextFormatter.py = pythonpath/TextFormatter.py
oxt/TextFormatter/tf_strings.py = pythonpath/tf_strings.py
oxt/TextFormatter/tf_options.py = pythonpath/tf_options.py

Modified gc_lang/fr/oxt/AppLauncher.py from [f6fd0dec5a] to [91f766cacd].

38
39
40
41
42
43
44




45
46
47
48
49
50
51
                    xDialog.run(sCmd[3:])
                else:
                    xDialog.run()
            elif sCmd == "TF":
                import TextFormatter
                xDialog = TextFormatter.TextFormatter(self.ctx)
                xDialog.run(self.sLang)




            elif sCmd == "DS":
                import DictionarySwitcher
                xDialog = DictionarySwitcher.FrenchDictionarySwitcher(self.ctx)
                xDialog.run(self.sLang)
            elif sCmd == "MA":
                import Author
                xDialog = Author.Author(self.ctx)







>
>
>
>







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
                    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 == "DS":
                import DictionarySwitcher
                xDialog = DictionarySwitcher.FrenchDictionarySwitcher(self.ctx)
                xDialog.run(self.sLang)
            elif sCmd == "MA":
                import Author
                xDialog = Author.Author(self.ctx)

Added gc_lang/fr/oxt/DictOptions/DictOptions.py version [0df543aa25].



























































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# Dictionary Options
# by Olivier R.
# License: MPL 2

import unohelper
import uno
import traceback
import time

import helpers
import do_strings

from com.sun.star.task import XJobExecutor
from com.sun.star.awt import XActionListener
from com.sun.star.beans import PropertyValue


class DictOptions (unohelper.Base, XActionListener, XJobExecutor):

    def __init__ (self, ctx):
        self.ctx = ctx
        self.xSvMgr = self.ctx.ServiceManager
        self.xContainer = None
        self.xDialog = None
        
    def _addWidget (self, name, wtype, x, y, w, h, **kwargs):
        xWidget = self.xDialog.createInstance('com.sun.star.awt.UnoControl%sModel' % wtype)
        xWidget.Name = name
        xWidget.PositionX = x
        xWidget.PositionY = y
        xWidget.Width = w
        xWidget.Height = h
        for k, w in kwargs.items():
            setattr(xWidget, k, w)
        self.xDialog.insertByName(name, xWidget)
        return xWidget

    def run (self, sLang):
        dUI = do_strings.getUI(sLang)

        self.xSettingNode = helpers.getConfigSetting("/org.openoffice.Lightproof_grammalecte/Other/", True)

        # dialog
        self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx)
        self.xDialog.Width = 200
        self.xDialog.Height = 255
        self.xDialog.Title = dUI.get('title', "#title#")
        xWindowSize = helpers.getWindowSize()
        self.xDialog.PositionX = int((xWindowSize.Width / 2) - (self.xDialog.Width / 2))
        self.xDialog.PositionY = int((xWindowSize.Height / 2) - (self.xDialog.Height / 2))

        # fonts
        xFDTitle = uno.createUnoStruct("com.sun.star.awt.FontDescriptor")
        xFDTitle.Height = 9
        xFDTitle.Weight = uno.getConstantByName("com.sun.star.awt.FontWeight.BOLD")
        xFDTitle.Name = "Verdana"
        
        xFDSubTitle = uno.createUnoStruct("com.sun.star.awt.FontDescriptor")
        xFDSubTitle.Height = 8
        xFDSubTitle.Weight = uno.getConstantByName("com.sun.star.awt.FontWeight.BOLD")
        xFDSubTitle.Name = "Verdana"

        # widget
        nX = 10
        nY1 = 10
        nY2 = nY1 + 50
        nY3 = nY2 + 70

        nWidth = self.xDialog.Width - 20
        nHeight = 10

        # Spell checker section
        self._addWidget("spelling_section", 'FixedLine', nX, nY1, nWidth, nHeight, Label = dUI.get("spelling_section", "#err"), FontDescriptor = xFDTitle)
        self.xGraphspell = self._addWidget('activate_main', 'CheckBox', nX, nY1+15, nWidth, nHeight, Label = dUI.get('activate_main', "#err"))
        self._addWidget('activate_main_descr', 'FixedText', nX, nY1+25, nWidth, nHeight*2, Label = dUI.get('activate_main_descr', "#err"), MultiLine = True)

        # Spell suggestion engine section
        self._addWidget("suggestion_section", 'FixedLine', nX, nY2, nWidth, nHeight, Label = dUI.get("suggestion_section", "#err"), FontDescriptor = xFDTitle)
        self.xGraphspellSugg = self._addWidget('activate_spell_sugg', 'CheckBox', nX, nY2+15, nWidth, nHeight, Label = dUI.get('activate_spell_sugg', "#err"))
        self._addWidget('activate_spell_sugg_descr', 'FixedText', nX, nY2+25, nWidth, nHeight*4, Label = dUI.get('activate_spell_sugg_descr', "#err"), MultiLine = True)

        # Personal dictionary section
        self._addWidget("personal_section", 'FixedLine', nX, nY3, nWidth, nHeight, Label = dUI.get("personal_section", "#err"), FontDescriptor = xFDTitle)
        self.xPersonalDic = self._addWidget('activate_personal', 'CheckBox', nX, nY3+15, nWidth, nHeight, Label = dUI.get('activate_personal', "#err"))
        self._addWidget('activate_personnal_descr', 'FixedText', nX, nY3+25, nWidth, nHeight*3, Label = dUI.get('activate_personal_descr', "#err"), MultiLine = True)
        self._addWidget('import_personal', 'FixedText', nX, nY3+55, nWidth-60, nHeight, Label = dUI.get('import_personal', "#err"), FontDescriptor = xFDSubTitle)
        self.xMsg = self._addWidget('msg', 'FixedText', nX, nY3+65, nWidth-50, nHeight, Label = "[néant]")
        self._addWidget('import_button', 'Button', self.xDialog.Width-50, nY3+65, 40, 10, Label = dUI.get('import_button', "#err"), TextColor = 0x005500)
        self._addWidget('create_dictionary', 'FixedText', nX, nY3+75, nWidth, nHeight*2, Label = dUI.get('create_dictionary', "#err"), MultiLine = True)

        # Button
        self._addWidget('apply_button', 'Button', self.xDialog.Width-120, self.xDialog.Height-25, 50, 14, Label = dUI.get('apply_button', "#err"), FontDescriptor = xFDTitle, TextColor = 0x005500)
        self._addWidget('cancel_button', 'Button', self.xDialog.Width-60, self.xDialog.Height-25, 50, 14, Label = dUI.get('cancel_button', "#err"), FontDescriptor = xFDTitle, TextColor = 0x550000)

        self._loadOptions()

        # container
        self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx)
        self.xContainer.setModel(self.xDialog)
        self.xContainer.getControl('apply_button').addActionListener(self)
        self.xContainer.getControl('apply_button').setActionCommand('Apply')
        self.xContainer.getControl('import_button').addActionListener(self)
        self.xContainer.getControl('import_button').setActionCommand('Import')
        self.xContainer.getControl('cancel_button').addActionListener(self)
        self.xContainer.getControl('cancel_button').setActionCommand('Cancel')
        self.xContainer.setVisible(False)
        toolkit = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.ExtToolkit', self.ctx)
        self.xContainer.createPeer(toolkit, None)
        self.xContainer.execute()

    # XActionListener
    def actionPerformed (self, xActionEvent):
        try:
            xChild = self.xSettingNode.getByName("o_fr")
            if xActionEvent.ActionCommand == 'Apply':
                xChild.setPropertyValue("graphspell", self.xGraphspell.State)
                xChild.setPropertyValue("graphspellsugg", self.xGraphspellSugg.State)
                #xChild.setPropertyValue("extended_dic", self.xExtendedDic.State)
                xChild.setPropertyValue("personal_dic", self.xPersonalDic.State)
                self.xSettingNode.commitChanges()
            elif xActionEvent.ActionCommand == "Import":
                xFilePicker = self.xSvMgr.createInstanceWithContext('com.sun.star.ui.dialogs.SystemFilePicker', self.ctx)
                xFilePicker.appendFilter("Supported files", "*.json; *.bdic")
                #xFilePicker.setDisplayDirectory("")
                #xFilePicker.setMultiSelectionMode(True)
                nResult = xFilePicker.execute()
                if nResult == 1:
                    pass
                    #lFile = xFilePicker.getSelectedFiles()
                    #lFile = xFilePicker.getFiles()
            else:
                pass
            self.xContainer.endExecute()
        except:
            traceback.print_exc()
    
    # XJobExecutor
    def trigger (self, args):
        try:
            dialog = DictOptions(self.ctx)
            dialog.run()
        except:
            traceback.print_exc()

    def _loadOptions (self):
        try:
            xChild = self.xSettingNode.getByName("o_fr")
            self.xGraphspell.State = xChild.getPropertyValue("graphspell")
            self.xGraphspellSugg.State = xChild.getPropertyValue("graphspellsugg")
            #self.xExtendedDic.State = xChild.getPropertyValue("extended_dic")
            self.xPersonalDic.State = xChild.getPropertyValue("personal_dic")
        except:
            traceback.print_exc()


#g_ImplementationHelper = unohelper.ImplementationHelper()
#g_ImplementationHelper.addImplementation(DictOptions, 'net.grammalecte.graphspell.DictOptions', ('com.sun.star.task.Job',))

Added gc_lang/fr/oxt/DictOptions/do_strings.py version [a801f3d0f2].



































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
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
def getUI (sLang):
    if sLang in dStrings:
        return dStrings[sLang]
    return dStrings["fr"]

dStrings = {
    "fr": {
        "title": "Grammalecte · Options des dictionnaires",
        
        "spelling_section": "Correcteur orthographique",
        "activate_main": "Activer le correcteur orthographique de Grammalecte",
        "activate_main_descr": "Supplante le correcteur orthographique inclus dans LibreOffice (Hunspell).",

        "personal_section": "Dictionnaire personnel",
        "activate_personal": "Utiliser",
        "activate_personal_descr": "Le dictionnaire personnel est une commodité pour ajouter le vocabulaire qui vous est utile. Il ne supplante pas le dictionnaire commun ; il ne fait qu’ajouter de nouveaux mots.",
        "import_personal": "Importer un dictionnaire personnel",
        "import_button": "Importer",
        "create_dictionary": "Vous pouvez créer un dictionnaire personnel avec l’extension Grammalecte pour Firefox ou Chrome.",

        "suggestion_section": "Moteur de suggestion orthographique",
        "activate_spell_sugg": "Activer le moteur de suggestion de Grammalecte",
        "activate_spell_sugg_descr": "Désactivée, cette option remplace la suggestion orthographique de Grammalecte par celle fournie par LibreOffice (Hunspell). Les mots inclus dans le dictionnaire personnalisé ne seront plus inclus aux suggestions.",

        "apply_button": "Appliquer",
        "cancel_button": "Annuler",
    },
    "en": {
        "title": "Grammalecte · Options for dictionaries",
        
        "spelling_section": "Spell checker",
        "activate_main": "Activate the spell checker from Grammalecte",
        "activate_main_descr": "Overrides the spell checker included in LibreOffice (Hunspell)",

        "personal_section": "Personal dictionary",
        "activate_personal": "Use",
        "activate_personal_descr": "The personal dictionary is a commodity to add the vocabulary you want. It doesn’t override the common dictionary ; it only adds new words.",
        "import_personal": "Import a personal dictionary",
        "import_button": "Import",
        "create_dictionary": "You can create a personal dictionary with the Grammalecte addon for Firefox or Chrome.",

        "suggestion_section": "Spell suggestion engine",
        "activate_spell_sugg": "Activate the suggestion engine of Grammalecte",
        "activate_spell_sugg_descr": "Disactivated, this option replace the spell suggestion engine of Grammalecte by the one of LibreOffice (Hunspell). Words included in the personal dictionary won’t be included among suggestions.",

        "apply_button": "Apply",
        "cancel_button": "Cancel",
    },
}

Modified gc_lang/fr/oxt/Lexicographer/enum_strings.py from [a803606c75] to [fd05286777].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
def getUI (sLang):
    if sLang in dStrings:
        return dStrings[sLang]
    return dStrings["fr"]

dStrings = {
    "fr": {
        "title": "Grammalecte · Recenseur",
        
        "list_section": "Calcul des occurrences des mots",
        "count_button": "Compter tout",
        "count2_button": "Compter par lemme",
        "unknown_button": "Mots inconnus",
        "num_of_entries": "Nombre d’entrées :",
        "tot_of_entries": "Total des entrées :",







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
def getUI (sLang):
    if sLang in dStrings:
        return dStrings[sLang]
    return dStrings["fr"]

dStrings = {
    "fr": {
        "title": "Grammalecte · Recenseur de mots",
        
        "list_section": "Calcul des occurrences des mots",
        "count_button": "Compter tout",
        "count2_button": "Compter par lemme",
        "unknown_button": "Mots inconnus",
        "num_of_entries": "Nombre d’entrées :",
        "tot_of_entries": "Total des entrées :",
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
        "accentuation": "Accentuation",
        "noaccentuation": "Aucun",
        "tag_button": "Taguer",

        "close_button": "Fermer",
    },
    "en": {
        "title": "Grammalecte · Enumerator",

        "list_section": "Words",
        "count_button": "Count all",
        "count2_button": "Count by lemma",
        "unknown_button": "Unknown words",
        "num_of_entries": "Number of entries:",
        "tot_of_entries": "Total of words:",







|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
        "accentuation": "Accentuation",
        "noaccentuation": "Aucun",
        "tag_button": "Taguer",

        "close_button": "Fermer",
    },
    "en": {
        "title": "Grammalecte · Enumerator of Words",

        "list_section": "Words",
        "count_button": "Count all",
        "count2_button": "Count by lemma",
        "unknown_button": "Unknown words",
        "num_of_entries": "Number of entries:",
        "tot_of_entries": "Total of words:",

Modified gc_lang/fr/oxt/TextFormatter/TextFormatter.py from [6fb58f6672] to [744fe2827e].

381
382
383
384
385
386
387
388
389
390
391
392
393
394

395
396
397
398
399
400
401
            # create options dictionary
            dOpt = {}
            for key, lWidget in self.dCheckboxWidgets.items():
                w = getattr(self, key)
                dOpt[w.Name] = w.State
                for w in lWidget:
                    dOpt[w.Name] = w.State
            # get extension path
            xDefaultContext = self.ctx.ServiceManager.DefaultContext
            xPackageInfoProvider = xDefaultContext.getValueByName("/singletons/com.sun.star.deployment.PackageInformationProvider")
            sExtPath = xPackageInfoProvider.getPackageLocation("French.linguistic.resources.from.Dicollecte.by.OlivierR")
            sExtPath = sExtPath[8:] + "/pythonpath/tf_options.py"  # remove "file:///"
            sExtPath = os.path.abspath(sExtPath)
            # write file

            if os.path.isfile(sExtPath):
                hOpt = open(sExtPath, "w")
                hOpt.write("dDefaultOpt = " + str(tf_options.dDefaultOpt) + "\n")
                hOpt.write("dOpt = " + str(dOpt))
                hOpt.close()
        except:
            traceback.print_exc()







<
<
<
<
<
<

>







381
382
383
384
385
386
387






388
389
390
391
392
393
394
395
396
            # create options dictionary
            dOpt = {}
            for key, lWidget in self.dCheckboxWidgets.items():
                w = getattr(self, key)
                dOpt[w.Name] = w.State
                for w in lWidget:
                    dOpt[w.Name] = w.State






            # write file
            sExtPath = helpers.getAbsolutePathOf("/pythonpath/tf_options.py")
            if os.path.isfile(sExtPath):
                hOpt = open(sExtPath, "w")
                hOpt.write("dDefaultOpt = " + str(tf_options.dDefaultOpt) + "\n")
                hOpt.write("dOpt = " + str(dOpt))
                hOpt.close()
        except:
            traceback.print_exc()

Modified gc_lang/fr/oxt/addons.xcu from [4bcce6ed7d] to [9b5b4f4c15].

72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
                </node>
                <node oor:name="m3" oor:op="replace">
                    <prop oor:name="URL" oor:type="xs:string">
                        <value>service:net.grammalecte.AppLauncher?EN</value>
                    </prop>
                    <prop oor:name="Title" oor:type="xs:string">
                        <value/>
                        <value xml:lang="fr">~Recenseur…</value>
                        <value xml:lang="en-US">~Enumerator…</value>
                    </prop>
                    <prop oor:name="Target" oor:type="xs:string">
                        <value>_self</value>
                    </prop>
                    <prop oor:name="Context" oor:type="xs:string">
                        <value>com.sun.star.text.TextDocument,com.sun.star.text.GlobalDocument,com.sun.star.text.WebDocument,com.sun.star.presentation.PresentationDocument</value>
                    </prop>







|
|







72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
                </node>
                <node oor:name="m3" oor:op="replace">
                    <prop oor:name="URL" oor:type="xs:string">
                        <value>service:net.grammalecte.AppLauncher?EN</value>
                    </prop>
                    <prop oor:name="Title" oor:type="xs:string">
                        <value/>
                        <value xml:lang="fr">~Recenseur de mots…</value>
                        <value xml:lang="en-US">~Enumerator of words…</value>
                    </prop>
                    <prop oor:name="Target" oor:type="xs:string">
                        <value>_self</value>
                    </prop>
                    <prop oor:name="Context" oor:type="xs:string">
                        <value>com.sun.star.text.TextDocument,com.sun.star.text.GlobalDocument,com.sun.star.text.WebDocument,com.sun.star.presentation.PresentationDocument</value>
                    </prop>
132
133
134
135
136
137
138



















139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
                        <value>com.sun.star.text.TextDocument,com.sun.star.text.GlobalDocument,com.sun.star.text.WebDocument</value>
                    </prop>
                    <prop oor:name="ImageIdentifier" oor:type="xs:string">
                        <value>org.dicollecte.images:Grammalecte</value>
                    </prop>
                </node>
                <node oor:name="m7" oor:op="replace">



















                    <prop oor:name="URL" oor:type="xs:string">
                        <value>service:net.grammalecte.AppLauncher?DS</value>
                    </prop>
                    <prop oor:name="Title" oor:type="xs:string">
                        <value/>
                        <value xml:lang="fr">~Options orthographiques…</value>
                        <value xml:lang="en-US">Spelling ~options…</value>
                    </prop>
                    <prop oor:name="Target" oor:type="xs:string">
                        <value>_self</value>
                    </prop>
                    <prop oor:name="Context" oor:type="xs:string">
                        <value>com.sun.star.text.TextDocument,com.sun.star.text.GlobalDocument,com.sun.star.text.WebDocument,com.sun.star.presentation.PresentationDocument</value>
                    </prop>
                    <prop oor:name="ImageIdentifier" oor:type="xs:string">
                        <value>org.dicollecte.images:Frenchflag</value>
                    </prop>
                </node>
                <node oor:name="m8" oor:op="replace">
                    <prop oor:name="URL" oor:type="xs:string">
                        <value>private:separator</value>
                    </prop>
                    <prop oor:name="Context" oor:type="xs:string">
                        <value>com.sun.star.text.TextDocument,com.sun.star.text.GlobalDocument,com.sun.star.text.WebDocument,com.sun.star.presentation.PresentationDocument</value>
                    </prop>
                </node>
                <node oor:name="m9" oor:op="replace">
                    <prop oor:name="URL" oor:type="xs:string">
                        <value>service:net.grammalecte.AppLauncher?About</value>
                    </prop>
                    <prop oor:name="Title" oor:type="xs:string">
                        <value/>
                        <value xml:lang="fr">À ~propos de Grammalecte…</value>
                        <value xml:lang="en-US">~About Grammalecte…</value>







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


















|







|







132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
                        <value>com.sun.star.text.TextDocument,com.sun.star.text.GlobalDocument,com.sun.star.text.WebDocument</value>
                    </prop>
                    <prop oor:name="ImageIdentifier" oor:type="xs:string">
                        <value>org.dicollecte.images:Grammalecte</value>
                    </prop>
                </node>
                <node oor:name="m7" oor:op="replace">
                    <prop oor:name="URL" oor:type="xs:string">
                        <value>service:net.grammalecte.AppLauncher?DI</value>
                    </prop>
                    <prop oor:name="Title" oor:type="xs:string">
                        <value/>
                        <value xml:lang="fr">~Options des dictionnaires…</value>
                        <value xml:lang="en-US">Dictionaries ~options…</value>
                    </prop>
                    <prop oor:name="Target" oor:type="xs:string">
                        <value>_self</value>
                    </prop>
                    <prop oor:name="Context" oor:type="xs:string">
                        <value>com.sun.star.text.TextDocument,com.sun.star.text.GlobalDocument,com.sun.star.text.WebDocument,com.sun.star.presentation.PresentationDocument</value>
                    </prop>
                    <prop oor:name="ImageIdentifier" oor:type="xs:string">
                        <value>org.dicollecte.images:Frenchflag</value>
                    </prop>
                </node>
                <node oor:name="m8" oor:op="replace">
                    <prop oor:name="URL" oor:type="xs:string">
                        <value>service:net.grammalecte.AppLauncher?DS</value>
                    </prop>
                    <prop oor:name="Title" oor:type="xs:string">
                        <value/>
                        <value xml:lang="fr">~Options orthographiques…</value>
                        <value xml:lang="en-US">Spelling ~options…</value>
                    </prop>
                    <prop oor:name="Target" oor:type="xs:string">
                        <value>_self</value>
                    </prop>
                    <prop oor:name="Context" oor:type="xs:string">
                        <value>com.sun.star.text.TextDocument,com.sun.star.text.GlobalDocument,com.sun.star.text.WebDocument,com.sun.star.presentation.PresentationDocument</value>
                    </prop>
                    <prop oor:name="ImageIdentifier" oor:type="xs:string">
                        <value>org.dicollecte.images:Frenchflag</value>
                    </prop>
                </node>
                <node oor:name="m9" oor:op="replace">
                    <prop oor:name="URL" oor:type="xs:string">
                        <value>private:separator</value>
                    </prop>
                    <prop oor:name="Context" oor:type="xs:string">
                        <value>com.sun.star.text.TextDocument,com.sun.star.text.GlobalDocument,com.sun.star.text.WebDocument,com.sun.star.presentation.PresentationDocument</value>
                    </prop>
                </node>
                <node oor:name="m10" oor:op="replace">
                    <prop oor:name="URL" oor:type="xs:string">
                        <value>service:net.grammalecte.AppLauncher?About</value>
                    </prop>
                    <prop oor:name="Title" oor:type="xs:string">
                        <value/>
                        <value xml:lang="fr">À ~propos de Grammalecte…</value>
                        <value xml:lang="en-US">~About Grammalecte…</value>

Deleted gc_lang/fr/oxt/helpers.py version [3ebcc78813].

1
2
3
4
5
6
7
8
9
10
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
# -*- coding: utf8 -*-

import uno
import traceback

from com.sun.star.beans import PropertyValue


# XRay - API explorer
from com.sun.star.uno import RuntimeException as _rtex
def xray (myObject):
    try:
        sm = uno.getComponentContext().ServiceManager
        mspf = sm.createInstanceWithContext("com.sun.star.script.provider.MasterScriptProviderFactory", uno.getComponentContext())
        scriptPro = mspf.createScriptProvider("")
        xScript = scriptPro.getScript("vnd.sun.star.script:XrayTool._Main.Xray?language=Basic&location=application")
        xScript.invoke((myObject,), (), ())
        return
    except:
        raise _rtex("\nBasic library Xray is not installed", uno.getComponentContext())


# MRI - API Explorer
def mri (ctx, xTarget):
    try:
        xMri = ctx.ServiceManager.createInstanceWithContext("mytools.Mri", ctx)
        xMri.inspect(xTarget)
    except:
        raise _rtex("\Python extension MRI is not installed", uno.getComponentContext())


def getConfigSetting (sNodeConfig, bUpdate):
    "get a configuration node"
    # example: xNode = getConfigSetting("/org.openoffice.Office.Common/Path/Current", False)
    xSvMgr = uno.getComponentContext().ServiceManager
    xConfigProvider = xSvMgr.createInstanceWithContext("com.sun.star.configuration.ConfigurationProvider", uno.getComponentContext())
    xPropertyValue = uno.createUnoStruct("com.sun.star.beans.PropertyValue")
    xPropertyValue.Name = "nodepath"
    xPropertyValue.Value = sNodeConfig
    if bUpdate:
        sService = "com.sun.star.configuration.ConfigurationUpdateAccess"
    else:
        sService = "com.sun.star.configuration.ConfigurationAccess"
    return xConfigProvider.createInstanceWithArguments(sService, (xPropertyValue,)) # return xNode


def printServices (o):
    for s in o.getAvailableServiceNames():
        print(' > '+s)


def getWindowSize ():
    "return main window size"
    xCurCtx = uno.getComponentContext()
    xDesktop = xCurCtx.getServiceManager().createInstanceWithContext('com.sun.star.frame.Desktop', xCurCtx)
    xContainerWindow = xDesktop.getCurrentComponent().CurrentController.Frame.ContainerWindow
    xWindowSize = xContainerWindow.convertSizeToLogic(xContainerWindow.Size, uno.getConstantByName("com.sun.star.util.MeasureUnit.POINT"))
    #print(xContainerWindow.Size.Width, ">", xWindowSize.Width)
    #print(xContainerWindow.Size.Height, ">", xWindowSize.Height)
    xWindowSize.Width = xWindowSize.Width * 0.666
    xWindowSize.Height = xWindowSize.Height * 0.666
    return xWindowSize
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































Modified make.py from [6a76dc767a] to [7d5ef1d4bd].

82
83
84
85
86
87
88

89
90
91
92
93
94
95
    hZip.write("grammalecte-cli.py", "pythonpath/grammalecte-cli.py")

    # Extension files
    hZip.writestr("META-INF/manifest.xml", helpers.fileFile("gc_core/py/oxt/manifest.xml", dVars))
    hZip.writestr("description.xml", helpers.fileFile("gc_core/py/oxt/description.xml", dVars))
    hZip.writestr("Linguistic.xcu", helpers.fileFile("gc_core/py/oxt/Linguistic.xcu", dVars))
    hZip.writestr("Grammalecte.py", helpers.fileFile("gc_core/py/oxt/Grammalecte.py", dVars))


    for sf in dVars["extras"].split(","):
        hZip.writestr(sf.strip(), helpers.fileFile(spLang + '/' + sf.strip(), dVars))

    if "logo" in dVars.keys() and dVars["logo"].strip():
        hZip.write(spLang + '/' + dVars["logo"].strip(), dVars["logo"].strip())








>







82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
    hZip.write("grammalecte-cli.py", "pythonpath/grammalecte-cli.py")

    # Extension files
    hZip.writestr("META-INF/manifest.xml", helpers.fileFile("gc_core/py/oxt/manifest.xml", dVars))
    hZip.writestr("description.xml", helpers.fileFile("gc_core/py/oxt/description.xml", dVars))
    hZip.writestr("Linguistic.xcu", helpers.fileFile("gc_core/py/oxt/Linguistic.xcu", dVars))
    hZip.writestr("Grammalecte.py", helpers.fileFile("gc_core/py/oxt/Grammalecte.py", dVars))
    hZip.writestr("pythonpath/helpers.py", helpers.fileFile("gc_core/py/oxt/helpers.py", dVars))

    for sf in dVars["extras"].split(","):
        hZip.writestr(sf.strip(), helpers.fileFile(spLang + '/' + sf.strip(), dVars))

    if "logo" in dVars.keys() and dVars["logo"].strip():
        hZip.write(spLang + '/' + dVars["logo"].strip(), dVars["logo"].strip())