Grammalecte  Check-in [130814503c]

Overview
Comment:[lo] code cleaning & clarification
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | lo
Files: files | file ages | folders
SHA3-256: 130814503c5e42686ad170ff94594d8dc237c424548aaaad83921e79dfc19782
User & Date: olr on 2020-12-17 20:31:35
Other Links: manifest | tags
Context
2020-12-18
09:59
[lo] text formatter editor update check-in: 7d2246bb86 user: olr tags: trunk, lo
2020-12-17
20:31
[lo] code cleaning & clarification check-in: 130814503c user: olr tags: trunk, lo
17:46
[lo] text formatter: editor update check-in: b2ccc36215 user: olr tags: trunk, lo
Changes

Modified gc_lang/fr/oxt/About/About.py from [eb41943f0c] to [ad3a7ac1f9].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# About dialog
# by Olivier R.
# License: MPL 2

import unohelper
import uno
import traceback
import sys

import ab_strings
import helpers

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


class AboutGrammalecte (unohelper.Base, XActionListener):









|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# About dialog
# by Olivier R.
# License: MPL 2

import unohelper
import uno
import traceback
import sys

import ab_strings as ui
import helpers

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


class AboutGrammalecte (unohelper.Base, XActionListener):
31
32
33
34
35
36
37

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
        for k, w in kwargs.items():
            setattr(xWidget, k, w)
        self.xDialog.insertByName(name, xWidget)
        return xWidget

    def run (self, sLang):
        try:

            dUI = ab_strings.getUI(sLang)
            self.xGLOptionNode = helpers.getConfigSetting("/org.openoffice.Lightproof_grammalecte/Other/", True)

            # dialog
            self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx)
            self.xDialog.Width = 160
            self.xDialog.Height = 320
            self.xDialog.Title = dUI.get('windowtitle', "#err")
            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))

            # xWidgets
            nLblWidth = 140
            nURLcolor = 0x4444FF







>
|






|







31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
        for k, w in kwargs.items():
            setattr(xWidget, k, w)
        self.xDialog.insertByName(name, xWidget)
        return xWidget

    def run (self, sLang):
        try:
            ui.selectLang(sLang)

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

            # dialog
            self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx)
            self.xDialog.Width = 160
            self.xDialog.Height = 320
            self.xDialog.Title = ui.get('windowtitle')
            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))

            # xWidgets
            nLblWidth = 140
            nURLcolor = 0x4444FF
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
            # logo
            xDefaultContext = self.ctx.ServiceManager.DefaultContext
            xPackageInfoProvider = xDefaultContext.getValueByName("/singletons/com.sun.star.deployment.PackageInformationProvider")
            sExtPath = xPackageInfoProvider.getPackageLocation("French.linguistic.resources.from.Dicollecte.by.OlivierR")
            self._addWidget('imgMainLogo', 'ImageControl', 5, 5, 150, 80, ImageURL = sExtPath+"/img/logo120_text.png", Border = 0, ScaleMode = 1)

            # Infos
            self._addWidget('lblVersion', 'FixedText', 10, 90, nLblWidth, 10, Label = dUI.get('version', "#err"), Align = 1, FontDescriptor = xFD2)
            self._addWidget('lblLicence', 'FixedText', 10, 100, nLblWidth, 10, Label = dUI.get('license', "#err"), Align = 1, FontDescriptor = xFD2)
            self._addWidget('lblWebsite', 'FixedHyperlink', 10, 110, nLblWidth, 10, Label = dUI.get('website', "#err"), Align = 1, \
                            URL="https://grammalecte.net/?from=grammalecte-lo", FontDescriptor = xFD1, TextColor = nURLcolor)

            # Python
            self._addWidget('lblpython', 'FixedText', 10, 125, nLblWidth//2, 10, Align = 1, TextColor = 0x666666, FontDescriptor = xFD2, \
                            Label = dUI.get('pythonver', "#err") + "{0[0]}.{0[1]}.{0[2]}".format(sys.version_info))
            self._addWidget('console_button', 'Button', nLblWidth-40, 124, 40, 10, \
                            Label = dUI.get('console', "#err"), FontDescriptor = xFD2, TextColor = 0x666666)

            # other
            self._addWidget('line', 'FixedLine', 10, 140, nLblWidth, 10)

            # sponsors
            self._addWidget('lblMsg', 'FixedText', 10, 155, nLblWidth, 10, Label = dUI.get('message', "#err"), FontDescriptor = xFD2, Align = 1)
            self._addWidget('lblURL1', 'FixedHyperlink', 10, 170, nLblWidth, 10, Label = dUI.get('sponsor', "#err"), \
                            Align = 1, URL="http://lamouette.org/?from=grammalecte-lo", FontDescriptor = xFD3, TextColor = nURLcolor)
            self._addWidget('imgSponsor', 'ImageControl', 5, 180, 150, 50, ImageURL = sExtPath+"/img/LaMouette_small.png", Border = 0, ScaleMode = 1)
            self._addWidget('lblURL2', 'FixedHyperlink', 10, 235, nLblWidth, 10, Label = dUI.get('sponsor2', "#err"), \
                            Align = 1, URL="https://www.algoo.fr/?from=grammalecte-lo", FontDescriptor = xFD3, TextColor = nURLcolor)
            self._addWidget('imgSponsor2', 'ImageControl', 5, 245, 150, 50, ImageURL = sExtPath+"/img/Algoo_logo.png", Border = 0, ScaleMode = 1)
            self._addWidget('lblURL3', 'FixedHyperlink', 10, 300, nLblWidth, 10, Label = dUI.get('link', "#err"), \
                            Align = 1, URL="https://grammalecte.net/#thanks", FontDescriptor = xFD1, TextColor = nURLcolor)

            # container
            self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx)
            self.xContainer.setModel(self.xDialog)
            self.xContainer.getControl('console_button').addActionListener(self)
            self.xContainer.getControl('console_button').setActionCommand('Console')







|
|
|




|

|





|
|


|


|







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
            # logo
            xDefaultContext = self.ctx.ServiceManager.DefaultContext
            xPackageInfoProvider = xDefaultContext.getValueByName("/singletons/com.sun.star.deployment.PackageInformationProvider")
            sExtPath = xPackageInfoProvider.getPackageLocation("French.linguistic.resources.from.Dicollecte.by.OlivierR")
            self._addWidget('imgMainLogo', 'ImageControl', 5, 5, 150, 80, ImageURL = sExtPath+"/img/logo120_text.png", Border = 0, ScaleMode = 1)

            # Infos
            self._addWidget('lblVersion', 'FixedText', 10, 90, nLblWidth, 10, Label = ui.get('version'), Align = 1, FontDescriptor = xFD2)
            self._addWidget('lblLicence', 'FixedText', 10, 100, nLblWidth, 10, Label = ui.get('license'), Align = 1, FontDescriptor = xFD2)
            self._addWidget('lblWebsite', 'FixedHyperlink', 10, 110, nLblWidth, 10, Label = ui.get('website'), Align = 1, \
                            URL="https://grammalecte.net/?from=grammalecte-lo", FontDescriptor = xFD1, TextColor = nURLcolor)

            # Python
            self._addWidget('lblpython', 'FixedText', 10, 125, nLblWidth//2, 10, Align = 1, TextColor = 0x666666, FontDescriptor = xFD2, \
                            Label = ui.get('pythonver') + "{0[0]}.{0[1]}.{0[2]}".format(sys.version_info))
            self._addWidget('console_button', 'Button', nLblWidth-40, 124, 40, 10, \
                            Label = ui.get('console'), FontDescriptor = xFD2, TextColor = 0x666666)

            # other
            self._addWidget('line', 'FixedLine', 10, 140, nLblWidth, 10)

            # sponsors
            self._addWidget('lblMsg', 'FixedText', 10, 155, nLblWidth, 10, Label = ui.get('message'), FontDescriptor = xFD2, Align = 1)
            self._addWidget('lblURL1', 'FixedHyperlink', 10, 170, nLblWidth, 10, Label = ui.get('sponsor'), \
                            Align = 1, URL="http://lamouette.org/?from=grammalecte-lo", FontDescriptor = xFD3, TextColor = nURLcolor)
            self._addWidget('imgSponsor', 'ImageControl', 5, 180, 150, 50, ImageURL = sExtPath+"/img/LaMouette_small.png", Border = 0, ScaleMode = 1)
            self._addWidget('lblURL2', 'FixedHyperlink', 10, 235, nLblWidth, 10, Label = ui.get('sponsor2'), \
                            Align = 1, URL="https://www.algoo.fr/?from=grammalecte-lo", FontDescriptor = xFD3, TextColor = nURLcolor)
            self._addWidget('imgSponsor2', 'ImageControl', 5, 245, 150, 50, ImageURL = sExtPath+"/img/Algoo_logo.png", Border = 0, ScaleMode = 1)
            self._addWidget('lblURL3', 'FixedHyperlink', 10, 300, nLblWidth, 10, Label = ui.get('link'), \
                            Align = 1, URL="https://grammalecte.net/#thanks", FontDescriptor = xFD1, TextColor = nURLcolor)

            # container
            self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx)
            self.xContainer.setModel(self.xDialog)
            self.xContainer.getControl('console_button').addActionListener(self)
            self.xContainer.getControl('console_button').setActionCommand('Console')

Modified gc_lang/fr/oxt/About/ab_strings.py from [c192c50bdb] to [599146a562].

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
# About strings





def getUI (sLang):

    if sLang in dStrings:





        return dStrings[sLang]

    return dStrings["fr"]


dStrings = {
    "fr": {
            "windowtitle": "À propos…",
            "title": "Grammalecte",
            "version": "Version : ${version}",
            "license": "Licence : GPL 3",
            "website": "Site web",

            "pythonver": "Python v",
            "console": "Console",

            "message": "Avec le soutien de",
            "sponsor": "La Mouette…",
            "sponsor2": "Algoo…",
            "link": "… et de nombreux contributeurs.",

            "close": "~OK"
          },
    "en": {
            "windowtitle": "About…",
            "title": "Grammalecte",
            "version": "Version: ${version}",
            "license": "License: GPL 3",
            "website": "Web site",

            "pythonver": "Python v",
            "console": "Console",

            "message": "With the support of",
            "sponsor": "La Mouette…",
            "sponsor2": "Algoo…",
            "link": "… and many contributors.",

            "close": "~OK"
          }
}
|

>
>
>
>
|
>

>
>
>
>
>
|
>
|

>


|
|
|
|
|

|
|

|
|
|
|

|
|

|
|
|
|
|

|
|

|
|
|
|

|
|

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
# strings for About


sUI = "fr"


def selectLang (sLang):
    global sUI
    if sLang in dStrings:
        sUI = sLang


def get (sMsgCode):
    try:
        return dStrings[sUI].get(sMsgCode, sMsgCode)
    except:
        return "#error"


dStrings = {
    "fr": {
        "windowtitle": "À propos…",
        "title": "Grammalecte",
        "version": "Version : ${version}",
        "license": "Licence : GPL 3",
        "website": "Site web",

        "pythonver": "Python v",
        "console": "Console",

        "message": "Avec le soutien de",
        "sponsor": "La Mouette…",
        "sponsor2": "Algoo…",
        "link": "… et de nombreux contributeurs.",

        "close": "~OK"
    },
    "en": {
        "windowtitle": "About…",
        "title": "Grammalecte",
        "version": "Version: ${version}",
        "license": "License: GPL 3",
        "website": "Web site",

        "pythonver": "Python v",
        "console": "Console",

        "message": "With the support of",
        "sponsor": "La Mouette…",
        "sponsor2": "Algoo…",
        "link": "… and many contributors.",

        "close": "~OK"
    }
}

Modified gc_lang/fr/oxt/ChangeAuthor/Author.py from [65d326e8e4] to [3df7981a3b].

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
# -*- coding: utf8 -*-
# Modify author field
# by Olivier R.
# License: MPL 2

import unohelper
import uno
import re
import traceback

import ca_strings
import helpers

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


class Author (unohelper.Base, XActionListener):
    def __init__ (self, ctx):
        self.ctx = ctx
        self.xSvMgr = self.ctx.ServiceManager
        self.xContainer = 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):
        try:
            dUI = ca_strings.getUI(sLang)

            # dialog
            self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx)
            self.xDialog.Width = 160
            self.xDialog.Height = 85
            self.xDialog.Title = dUI.get('title', "#err")
            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
            xFDBut = uno.createUnoStruct("com.sun.star.awt.FontDescriptor")
            xFDBut.Height = 10
            xFDBut.Weight = uno.getConstantByName("com.sun.star.awt.FontWeight.BOLD")
            xFDBut.Name = "Verdana"

            # document
            xDesktop = self.ctx.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", self.ctx)
            self.xDoc = xDesktop.getCurrentComponent()
            sAuthor = self.xDoc.DocumentProperties.Author  if self.xDoc.DocumentProperties.Author  else  dUI.get('empty', "#err")

            # widgets
            nTextWidth = self.xDialog.Width - 20
            state = self._addWidget('state', 'FixedText', 10, 10, nTextWidth, 10, Label = dUI.get('state', "#err"))
            value = self._addWidget('value', 'FixedText', 10, 20, nTextWidth, 10, Label = sAuthor, FontSlant = 2, TextColor = 0x000044)
            
            inputlbl = self._addWidget('inputlbl', 'FixedText', 10, 34, nTextWidth, 10, Label = dUI.get('newvalue', "#err"))
            self.inputtxt = self._addWidget('input', 'Edit', 10, 45, nTextWidth-20, 12, Text=self.xDoc.DocumentProperties.Author, MaxTextLen=150)
            but0 = self._addWidget('reset', 'Button', self.xDialog.Width-25, 45, 15, 12, Label = u"×", FontDescriptor = xFDBut, TextColor = 0x440000)

            but1 = self._addWidget('modify', 'Button', self.xDialog.Width-115, self.xDialog.Height-20, 50, 14, \
                                   Label = dUI.get('modify', "#err"), FontDescriptor = xFDBut, TextColor = 0x004400)
            but2 = self._addWidget('cancel', 'Button', self.xDialog.Width-60, self.xDialog.Height-20, 50, 14, \
                                   Label = dUI.get('cancel', "#err"), FontDescriptor = xFDBut, TextColor = 0x440000)

            # container
            self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx)
            self.xContainer.setModel(self.xDialog)
            self.xContainer.getControl('reset').addActionListener(self)
            self.xContainer.getControl('reset').setActionCommand('Reset')
            self.xContainer.getControl('modify').addActionListener(self)
            self.xContainer.getControl('modify').setActionCommand('Modify')
            self.xContainer.getControl('cancel').addActionListener(self)
            self.xContainer.getControl('cancel').setActionCommand('Cancel')
            self.xContainer.setVisible(False)
            xToolkit = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.ExtToolkit', self.ctx)
            self.xContainer.createPeer(xToolkit, None)
            self.xContainer.execute()
        except:
            traceback.print_exc()
    
    # XActionListener
    def actionPerformed (self, xActionEvent):
        try:
            if xActionEvent.ActionCommand == 'Reset':
                self.inputtxt.Text = ""
            elif xActionEvent.ActionCommand == 'Modify':
                self.xDoc.DocumentProperties.Author = self.inputtxt.Text.strip()
<









|











|














|





|













|



|

|
|

|


|

|
















|








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

# Modify author field
# by Olivier R.
# License: MPL 2

import unohelper
import uno
import re
import traceback

import ca_strings as ui
import helpers

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


class Author (unohelper.Base, XActionListener):
    def __init__ (self, ctx):
        self.ctx = ctx
        self.xSvMgr = self.ctx.ServiceManager
        self.xContainer = 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):
        try:
            ui.selectLang(sLang)

            # dialog
            self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx)
            self.xDialog.Width = 160
            self.xDialog.Height = 85
            self.xDialog.Title = ui.get('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
            xFDBut = uno.createUnoStruct("com.sun.star.awt.FontDescriptor")
            xFDBut.Height = 10
            xFDBut.Weight = uno.getConstantByName("com.sun.star.awt.FontWeight.BOLD")
            xFDBut.Name = "Verdana"

            # document
            xDesktop = self.ctx.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", self.ctx)
            self.xDoc = xDesktop.getCurrentComponent()
            sAuthor = self.xDoc.DocumentProperties.Author  if self.xDoc.DocumentProperties.Author  else  ui.get('empty')

            # widgets
            nTextWidth = self.xDialog.Width - 20
            state = self._addWidget('state', 'FixedText', 10, 10, nTextWidth, 10, Label = ui.get('state'))
            value = self._addWidget('value', 'FixedText', 10, 20, nTextWidth, 10, Label = sAuthor, FontSlant = 2, TextColor = 0x000044)

            inputlbl = self._addWidget('inputlbl', 'FixedText', 10, 34, nTextWidth, 10, Label = ui.get('newvalue'))
            self.inputtxt = self._addWidget('input', 'Edit', 10, 45, nTextWidth-20, 12, Text=self.xDoc.DocumentProperties.Author, MaxTextLen=150)
            but0 = self._addWidget('reset', 'Button', self.xDialog.Width-25, 45, 15, 12, Label = "×", FontDescriptor = xFDBut, TextColor = 0x440000)

            but1 = self._addWidget('modify', 'Button', self.xDialog.Width-115, self.xDialog.Height-20, 50, 14, \
                                   Label = ui.get('modify'), FontDescriptor = xFDBut, TextColor = 0x004400)
            but2 = self._addWidget('cancel', 'Button', self.xDialog.Width-60, self.xDialog.Height-20, 50, 14, \
                                   Label = ui.get('cancel'), FontDescriptor = xFDBut, TextColor = 0x440000)

            # container
            self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx)
            self.xContainer.setModel(self.xDialog)
            self.xContainer.getControl('reset').addActionListener(self)
            self.xContainer.getControl('reset').setActionCommand('Reset')
            self.xContainer.getControl('modify').addActionListener(self)
            self.xContainer.getControl('modify').setActionCommand('Modify')
            self.xContainer.getControl('cancel').addActionListener(self)
            self.xContainer.getControl('cancel').setActionCommand('Cancel')
            self.xContainer.setVisible(False)
            xToolkit = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.ExtToolkit', self.ctx)
            self.xContainer.createPeer(xToolkit, None)
            self.xContainer.execute()
        except:
            traceback.print_exc()

    # XActionListener
    def actionPerformed (self, xActionEvent):
        try:
            if xActionEvent.ActionCommand == 'Reset':
                self.inputtxt.Text = ""
            elif xActionEvent.ActionCommand == 'Modify':
                self.xDoc.DocumentProperties.Author = self.inputtxt.Text.strip()

Modified gc_lang/fr/oxt/ChangeAuthor/ca_strings.py from [b67a9eb4f9] to [249ebc6d98].


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

# -*- encoding: UTF-8 -*-




def getUI (sLang):

    if sLang in dStrings:





        return dStrings[sLang]

    return dStrings["fr"]


dStrings = {
    "fr": {
            "title": "Grammalecte · Édition du champ “Auteur”",

            "state": "Valeur actuelle du champ “Auteur” :",
            "empty": "[vide]",

            "newvalue": "Entrez la nouvelle valeur :",

            "modify": "Modifier",
            "cancel": "Annuler"
          },
    "en": {
            "title": "Grammalecte · Edition of field “Author”",

            "state": "Current value of field “Author”:",
            "empty": "[empty]",

            "newvalue": "Enter the new value:",

            "modify": "Modify",
            "cancel": "Cancel"
          }
}


>
|

>
>
>
|
>

>
>
>
>
>
|
>
|

>


|

|
|

|

|
|
|

|

|
|

|

|
|
|



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
# strings for change author


sUI = "fr"


def selectLang (sLang):
    global sUI
    if sLang in dStrings:
        sUI = sLang


def get (sMsgCode):
    try:
        return dStrings[sUI].get(sMsgCode, sMsgCode)
    except:
        return "#error"


dStrings = {
    "fr": {
        "title": "Grammalecte · Édition du champ “Auteur”",

        "state": "Valeur actuelle du champ “Auteur” :",
        "empty": "[vide]",

        "newvalue": "Entrez la nouvelle valeur :",

        "modify": "Modifier",
        "cancel": "Annuler"
    },
    "en": {
        "title": "Grammalecte · Edition of field “Author”",

        "state": "Current value of field “Author”:",
        "empty": "[empty]",

        "newvalue": "Enter the new value:",

        "modify": "Modify",
        "cancel": "Cancel"
    }
}


Modified gc_lang/fr/oxt/DictOptions/DictOptions.py from [427b5db60b] to [134ec117ea].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Dictionary Options
# by Olivier R.
# License: MPL 2

import unohelper
import uno
import re
import traceback

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

from com.sun.star.awt.MessageBoxButtons import BUTTONS_OK
# BUTTONS_OK, BUTTONS_OK_CANCEL, BUTTONS_YES_NO, BUTTONS_YES_NO_CANCEL, BUTTONS_RETRY_CANCEL, BUTTONS_ABORT_IGNORE_RETRY










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Dictionary Options
# by Olivier R.
# License: MPL 2

import unohelper
import uno
import re
import traceback

import helpers
import do_strings as ui

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

from com.sun.star.awt.MessageBoxButtons import BUTTONS_OK
# BUTTONS_OK, BUTTONS_OK_CANCEL, BUTTONS_YES_NO, BUTTONS_YES_NO_CANCEL, BUTTONS_RETRY_CANCEL, BUTTONS_ABORT_IGNORE_RETRY
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
        xWidget.Height = h
        for k, w in kwargs.items():
            setattr(xWidget, k, w)
        self.xDialog.insertByName(name, xWidget)
        return xWidget

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

        self.xDesktop = self.xSvMgr.createInstanceWithContext("com.sun.star.frame.Desktop", self.ctx)
        self.xDocument = self.xDesktop.getCurrentComponent()
        self.xGLOptionNode = helpers.getConfigSetting("/org.openoffice.Lightproof_grammalecte/Other/", True)

        # what is the current Hunspell dictionary
        self.xHunspellNode = helpers.getConfigSetting("/org.openoffice.Office.Linguistic/ServiceManager/Dictionaries/HunSpellDic_fr", True)
        xLocations = self.xHunspellNode.getByName("Locations")
        m = re.search(r"fr-(\w*)\.(?:dic|aff)", xLocations[0])
        self.sHunspellCurrentDic = m.group(1)  if m  else ""

        # dialog
        self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx)
        self.xDialog.Width = 200
        self.xDialog.Height = 285
        self.xDialog.Title = self.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







|















|







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
        xWidget.Height = h
        for k, w in kwargs.items():
            setattr(xWidget, k, w)
        self.xDialog.insertByName(name, xWidget)
        return xWidget

    def run (self, sLang):
        ui.selectLang(sLang)

        self.xDesktop = self.xSvMgr.createInstanceWithContext("com.sun.star.frame.Desktop", self.ctx)
        self.xDocument = self.xDesktop.getCurrentComponent()
        self.xGLOptionNode = helpers.getConfigSetting("/org.openoffice.Lightproof_grammalecte/Other/", True)

        # what is the current Hunspell dictionary
        self.xHunspellNode = helpers.getConfigSetting("/org.openoffice.Office.Linguistic/ServiceManager/Dictionaries/HunSpellDic_fr", True)
        xLocations = self.xHunspellNode.getByName("Locations")
        m = re.search(r"fr-(\w*)\.(?:dic|aff)", xLocations[0])
        self.sHunspellCurrentDic = m.group(1)  if m  else ""

        # dialog
        self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx)
        self.xDialog.Width = 200
        self.xDialog.Height = 285
        self.xDialog.Title = ui.get('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
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
        nY4 = nY3 + 45
        nY5 = nY4 + 95

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

        # Graphspell dictionary section
        self._addWidget("graphspell_section", 'FixedLine', nX, nY1, nWidth, nHeight, Label = self.dUI.get("graphspell_section", "#err"), FontDescriptor = xFDTitle)
        self.xMainDic = self._addWidget('activate_main', 'CheckBox', nX, nY1+15, nWidth, nHeight, Label = self.dUI.get('activate_main', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x000088, State = True)
        self._addWidget('activate_main_descr', 'FixedText', nX+10, nY1+25, nWidth-10, nHeight*2, Label = self.dUI.get('activate_main_descr', "#err"), MultiLine = True)
        self._addWidget('spelling', 'FixedText', nX+10, nY1+45, nWidth-80, nHeight, Label = self.dUI.get('spelling', "#err"), FontDescriptor = xFDSubTitle)
        self.xInfoDicButton = self._addWidget('info_dic_button', 'Button', nX+160, nY1+45, 12, 9, Label = "‹i›")
        self.xSelClassic = self._addWidget('classic', 'RadioButton', nX+10, nY1+55, 50, nHeight, Label = self.dUI.get('classic', "#err"))
        self.xSelReform = self._addWidget('reform', 'RadioButton', nX+65, nY1+55, 55, nHeight, Label = self.dUI.get('reform', "#err"))
        self.xSelAllvars = self._addWidget('allvars', 'RadioButton', nX+120, nY1+55, 60, nHeight, Label = self.dUI.get('allvars', "#err"))
        self.xCommunityDic = self._addWidget('activate_community', 'CheckBox', nX, nY2+15, nWidth, nHeight, Label = self.dUI.get('activate_community', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x000088, Enabled = False)
        self._addWidget('activate_community_descr', 'FixedText', nX+10, nY2+25, nWidth-10, nHeight*1, Label = self.dUI.get('activate_community_descr', "#err"), MultiLine = True)
        self.xPersonalDic = self._addWidget('activate_personal', 'CheckBox', nX, nY3+15, nWidth, nHeight, Label = self.dUI.get('activate_personal', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x000088)
        self._addWidget('activate_personal_descr', 'FixedText', nX+10, nY3+25, nWidth-10, nHeight*1, Label = self.dUI.get('activate_personal_descr', "#err"), MultiLine = True)

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

        # Restart message
        self._addWidget('restart', 'FixedText', nX, nY5, nWidth, nHeight*2, Label = self.dUI.get('restart', "#err"), FontDescriptor = xFDTitle, MultiLine = True, TextColor = 0x880000)

        # Button
        self._addWidget('apply_button', 'Button', self.xDialog.Width-115, self.xDialog.Height-20, 50, 14, Label = self.dUI.get('apply_button', "#err"), FontDescriptor = xFDTitle, TextColor = 0x005500)
        self._addWidget('cancel_button', 'Button', self.xDialog.Width-60, self.xDialog.Height-20, 50, 14, Label = self.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('info_dic_button').addActionListener(self)







|
|
|
|

|
|
|
|
|
|
|


|
|
|


|


|
|







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
        nY4 = nY3 + 45
        nY5 = nY4 + 95

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

        # Graphspell dictionary section
        self._addWidget("graphspell_section", 'FixedLine', nX, nY1, nWidth, nHeight, Label = ui.get("graphspell_section"), FontDescriptor = xFDTitle)
        self.xMainDic = self._addWidget('activate_main', 'CheckBox', nX, nY1+15, nWidth, nHeight, Label = ui.get('activate_main'), FontDescriptor = xFDSubTitle, TextColor = 0x000088, State = True)
        self._addWidget('activate_main_descr', 'FixedText', nX+10, nY1+25, nWidth-10, nHeight*2, Label = ui.get('activate_main_descr'), MultiLine = True)
        self._addWidget('spelling', 'FixedText', nX+10, nY1+45, nWidth-80, nHeight, Label = ui.get('spelling'), FontDescriptor = xFDSubTitle)
        self.xInfoDicButton = self._addWidget('info_dic_button', 'Button', nX+160, nY1+45, 12, 9, Label = "‹i›")
        self.xSelClassic = self._addWidget('classic', 'RadioButton', nX+10, nY1+55, 50, nHeight, Label = ui.get('classic'))
        self.xSelReform = self._addWidget('reform', 'RadioButton', nX+65, nY1+55, 55, nHeight, Label = ui.get('reform'))
        self.xSelAllvars = self._addWidget('allvars', 'RadioButton', nX+120, nY1+55, 60, nHeight, Label = ui.get('allvars'))
        self.xCommunityDic = self._addWidget('activate_community', 'CheckBox', nX, nY2+15, nWidth, nHeight, Label = ui.get('activate_community'), FontDescriptor = xFDSubTitle, TextColor = 0x000088, Enabled = False)
        self._addWidget('activate_community_descr', 'FixedText', nX+10, nY2+25, nWidth-10, nHeight*1, Label = ui.get('activate_community_descr'), MultiLine = True)
        self.xPersonalDic = self._addWidget('activate_personal', 'CheckBox', nX, nY3+15, nWidth, nHeight, Label = ui.get('activate_personal'), FontDescriptor = xFDSubTitle, TextColor = 0x000088)
        self._addWidget('activate_personal_descr', 'FixedText', nX+10, nY3+25, nWidth-10, nHeight*1, Label = ui.get('activate_personal_descr'), MultiLine = True)

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

        # Restart message
        self._addWidget('restart', 'FixedText', nX, nY5, nWidth, nHeight*2, Label = ui.get('restart'), FontDescriptor = xFDTitle, MultiLine = True, TextColor = 0x880000)

        # Button
        self._addWidget('apply_button', 'Button', self.xDialog.Width-115, self.xDialog.Height-20, 50, 14, Label = ui.get('apply_button'), FontDescriptor = xFDTitle, TextColor = 0x005500)
        self._addWidget('cancel_button', 'Button', self.xDialog.Width-60, self.xDialog.Height-20, 50, 14, Label = ui.get('cancel_button'), 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('info_dic_button').addActionListener(self)
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
                #self.xHunspellNode.replaceByName("Locations", xLocations)  # doesn't work, see line below
                uno.invoke(self.xHunspellNode, "replaceByName", ("Locations", uno.Any("[]string", (v1, v2))))
                self.xHunspellNode.commitChanges()

                # Close window
                self.xContainer.endExecute()
            elif xActionEvent.ActionCommand == 'InfoDic':
                MessageBox(self.xDocument, self.dUI.get('spelling_descr', "#err"), "Orthographe du français", nBoxType=INFOBOX, nBoxButtons=BUTTONS_OK)
            else:
                self.xContainer.endExecute()
        except:
            traceback.print_exc()

    # XJobExecutor
    def trigger (self, args):







|







164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
                #self.xHunspellNode.replaceByName("Locations", xLocations)  # doesn't work, see line below
                uno.invoke(self.xHunspellNode, "replaceByName", ("Locations", uno.Any("[]string", (v1, v2))))
                self.xHunspellNode.commitChanges()

                # Close window
                self.xContainer.endExecute()
            elif xActionEvent.ActionCommand == 'InfoDic':
                MessageBox(self.xDocument, ui.get('spelling_descr'), "Orthographe du français", nBoxType=INFOBOX, nBoxButtons=BUTTONS_OK)
            else:
                self.xContainer.endExecute()
        except:
            traceback.print_exc()

    # XJobExecutor
    def trigger (self, args):

Modified gc_lang/fr/oxt/DictOptions/LexiconEditor.py from [5ef5214006] to [28c9952b1e].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Lexicon Editor
# by Olivier R.
# License: MPL 2

import unohelper
import uno
import json
import re
import os
import traceback
import platform

import helpers
import lxe_strings
import grammalecte.graphspell as sc
import grammalecte.graphspell.dawg as dawg
import grammalecte.graphspell.ibdawg as ibdawg
import grammalecte.fr.conj as conj
import grammalecte.fr.conj_generator as conjgen

import SearchWords













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Lexicon Editor
# by Olivier R.
# License: MPL 2

import unohelper
import uno
import json
import re
import os
import traceback
import platform

import helpers
import lxe_strings as ui
import grammalecte.graphspell as sc
import grammalecte.graphspell.dawg as dawg
import grammalecte.graphspell.ibdawg as ibdawg
import grammalecte.fr.conj as conj
import grammalecte.fr.conj_generator as conjgen

import SearchWords
109
110
111
112
113
114
115

116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
        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.xDialog.Height = 290
        self.xDialog.Title = self.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







>

<





|







109
110
111
112
113
114
115
116
117

118
119
120
121
122
123
124
125
126
127
128
129
130
        for k, w in kwargs.items():
            setattr(xGridModel, k, w)
        self.xDialog.insertByName(name, xGridModel)
        return xGridModel

    def run (self, sLang, sWord=""):
        # ui lang
        ui.selectLang(sLang)
        self.sLang = sLang


        # dialog
        self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx)
        self.xDialog.Width = 550
        self.xDialog.Height = 290
        self.xDialog.Title = ui.get('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
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266

        nXB = nX1 + 175
        nXC = nXB + 165

        nHeight = 10

        #### Dictionary section
        self._addWidget("dictionary_section", 'FixedLine', nX1, nY0, 170, nHeight, Label = self.dUI.get("dictionary_section", "#err"), FontDescriptor = xFDTitle, TextColor = 0x000088)
        self._addWidget("save_date_label", 'FixedText', nXB, nY0+2, 80, nHeight, Label = self.dUI.get("save_date_label", "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x000088)
        self._addWidget("num_of_entries_label2", 'FixedText', nXC, nY0+2, 65, nHeight, Label = self.dUI.get("num_of_entries_label", "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x000088)
        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.xA = self._addWidget('adj', 'RadioButton', nX1, nY2+32, 60, nHeight, Label = self.dUI.get("adj", "#err"), HelpText = ":A")
        self.xM1 = self._addWidget('M1', 'RadioButton', nX1, nY3+12, 60, nHeight, Label = self.dUI.get("M1", "#err"), HelpText = ":M1")
        self.xM2 = self._addWidget('M2', 'RadioButton', nX1, nY3+22, 60, nHeight, Label = self.dUI.get("M2", "#err"), HelpText = ":M2")
        self.xMP = self._addWidget('MP', 'RadioButton', nX1, nY3+32, 60, nHeight, Label = self.dUI.get("MP", "#err"), HelpText = ":MP")
        self.xV = self._addWidget('verb', 'RadioButton', nX1, nY4+2, 35, nHeight, Label = self.dUI.get("verb", "#err"), FontDescriptor = xFDSubTitle, HelpText = ":V")
        self.xW = self._addWidget('adv', 'RadioButton', nX1, nY5+2, 35, nHeight, Label = self.dUI.get("adverb", "#err"), FontDescriptor = xFDSubTitle, HelpText = ":W")
        self.xX = self._addWidget('other', 'RadioButton', nX1, nY6+2, 35, nHeight, Label = self.dUI.get("other", "#err"), FontDescriptor = xFDSubTitle, HelpText = ":X")

        # Nom, adjectif
        self._addWidget("fl_nom_adj", 'FixedLine', nX1, nY2, 170, nHeight, Label = self.dUI.get("common_name", "#err"), FontDescriptor = xFDSubTitle)
        self.xSepi = self._addWidget('Sepi', 'RadioButton', nX1+65, nY2+12, 50, nHeight, Label = self.dUI.get("epi", "#err"), HelpText = ":e")
        self.xSmas = self._addWidget('Smas', 'RadioButton', nX1+65, nY2+22, 50, nHeight, Label = self.dUI.get("mas", "#err"), HelpText = ":m")
        self.xSfem = self._addWidget('Sfem', 'RadioButton', nX1+65, nY2+32, 50, nHeight, Label = self.dUI.get("fem", "#err"), HelpText = ":f")
        self._addWidget("fl_sep1", 'FixedLine', nX1, nY2, 1, nHeight)
        self.xSs = self._addWidget('Ss', 'RadioButton', nX1+115, nY2+12, 50, nHeight, Label = self.dUI.get("-s", "#err"), HelpText = "·s")
        self.xSx = self._addWidget('Sx', 'RadioButton', nX1+115, nY2+22, 50, nHeight, Label = self.dUI.get("-x", "#err"), HelpText = "·x")
        self.xSinv = self._addWidget('Sinv', 'RadioButton', nX1+115, nY2+32, 50, nHeight, Label = self.dUI.get("inv", "#err"), HelpText = ":i")

        self._addWidget("alt_lemma_label", 'FixedLine', nX1+10, nY2+42, 160, nHeight, Label = self.dUI.get("alt_lemma", "#err"))
        self.xAltLemma = self._addWidget('alt_lemma', 'Edit', nX1+10, nY2+52, 110, nHeight)
        self.xNA2 = self._addWidget('nom_adj2', 'RadioButton', nX1+10, nY2+65, 60, nHeight, Label = self.dUI.get("nom_adj", "#err"), HelpText = ":N:A")
        self.xN2 = self._addWidget('nom2', 'RadioButton', nX1+10, nY2+75, 60, nHeight, Label = self.dUI.get("nom", "#err"), HelpText = ":N")
        self.xA2 = self._addWidget('adj2', 'RadioButton', nX1+10, nY2+85, 60, nHeight, Label = self.dUI.get("adj", "#err"), HelpText = ":A")
        self._addWidget("fl_sep2", 'FixedLine', nX1, nY2, 1, nHeight)
        self.xSepi2 = self._addWidget('Sepi2', 'RadioButton', nX1+70, nY2+65, 50, nHeight, Label = self.dUI.get("epi", "#err"), HelpText = ":e")
        self.xSmas2 = self._addWidget('Smas2', 'RadioButton', nX1+70, nY2+75, 50, nHeight, Label = self.dUI.get("mas", "#err"), HelpText = ":m")
        self.xSfem2 = self._addWidget('Sfem2', 'RadioButton', nX1+70, nY2+85, 50, nHeight, Label = self.dUI.get("fem", "#err"), HelpText = ":f")
        self._addWidget("fl_sep3", 'FixedLine', nX1, nY2, 1, nHeight)
        self.xSs2 = self._addWidget('Ss2', 'RadioButton', nX1+120, nY2+65, 50, nHeight, Label = self.dUI.get("-s", "#err"), HelpText = "·s")
        self.xSx2 = self._addWidget('Sx2', 'RadioButton', nX1+120, nY2+75, 50, nHeight, Label = self.dUI.get("-x", "#err"), HelpText = "·x")
        self.xSinv2 = self._addWidget('Sinv2', 'RadioButton', nX1+120, nY2+85, 50, nHeight, Label = self.dUI.get("inv", "#err"), HelpText = ":i")

        # Nom propre
        self._addWidget("fl_M", 'FixedLine', nX1, nY3, 170, nHeight, Label = self.dUI.get("proper_name", "#err"), FontDescriptor = xFDSubTitle)
        self.xMepi = self._addWidget('Mepi', 'RadioButton', nX1+65, nY3+12, 50, nHeight, Label = self.dUI.get("epi", "#err"), HelpText = ":e")
        self.xMmas = self._addWidget('Mmas', 'RadioButton', nX1+65, nY3+22, 50, nHeight, Label = self.dUI.get("mas", "#err"), HelpText = ":m")
        self.xMfem = self._addWidget('Mfem', 'RadioButton', nX1+65, nY3+32, 50, nHeight, Label = self.dUI.get("fem", "#err"), HelpText = ":f")

        # Verbe
        self._addWidget("fl_verb", 'FixedLine', nX2+30, nY4, 130, nHeight, FontDescriptor = xFDSubTitle)
        self.xV_i = self._addWidget('v_i', 'CheckBox', nX2, nY4+12, 60, nHeight, Label = self.dUI.get("v_i", "#err"))
        self.xV_t = self._addWidget('v_t', 'CheckBox', nX2, nY4+20, 60, nHeight, Label = self.dUI.get("v_t", "#err"))
        self.xV_n = self._addWidget('v_n', 'CheckBox', nX2, nY4+28, 60, nHeight, Label = self.dUI.get("v_n", "#err"))
        self.xV_p = self._addWidget('v_p', 'CheckBox', nX2, nY4+36, 60, nHeight, Label = self.dUI.get("v_p", "#err"))
        self.xV_m = self._addWidget('v_m', 'CheckBox', nX2, nY4+44, 60, nHeight, Label = self.dUI.get("v_m", "#err"))

        self._addWidget('aux', 'FixedText', nX2+75, nY4+10, 90, nHeight, Label = self.dUI.get("aux", "#err"))
        self.xV_ae = self._addWidget('v_ae', 'CheckBox', nX2+75, nY4+20, 90, nHeight, Label = self.dUI.get("v_ae", "#err"))
        self.xV_aa = self._addWidget('v_aa', 'CheckBox', nX2+75, nY4+28, 90, nHeight, Label = self.dUI.get("v_aa", "#err"))

        self.xV_pp = self._addWidget('v_pp', 'CheckBox', nX2+75, nY4+44, 90, nHeight, Label = self.dUI.get("v_pp", "#err"))

        self._addWidget('v_pattern_label', 'FixedText', nX2, nY4+56, 75, nHeight, Label = self.dUI.get('v_pattern', "#err"), Align = 2)
        self.xVpattern = self._addWidget('v_pattern', 'Edit', nX2+80, nY4+56, 80, nHeight)

        # Adverbe
        self._addWidget("fl_adv", 'FixedLine', nX2+30, nY5, 130, nHeight, FontDescriptor = xFDSubTitle)

        # Autre
        self._addWidget("fl_other", 'FixedLine', nX2+30, nY6, 130, nHeight, FontDescriptor = xFDSubTitle)
        self._addWidget('flexion_label', 'FixedText', nX2, nY6+11, 22, nHeight, Label = self.dUI.get('flexion', "#err"), Align = 2)
        self.xFlexion = self._addWidget('flexion', 'Edit', nX2+25, nY6+10, 50, nHeight)
        self._addWidget('tags_label', 'FixedText', nX2+80, nY6+11, 27, nHeight, Label = self.dUI.get('tags', "#err"), Align = 2)
        self.xTags = self._addWidget('tags', 'Edit', nX2+110, nY6+10, 50, nHeight)

        #### Generated words
        self._addWidget("gwords_section", 'FixedLine', nXB, nY1, 160, nHeight, Label = self.dUI.get("new_section", "#err"), FontDescriptor = xFDTitle)
        self.xGridModelNew = self._addGrid("list_grid_gwords", nXB, nY1+10, 160, 240, [
            {"Title": self.dUI.get("lex_flex", "#err"), "ColumnWidth": 80},
            {"Title": self.dUI.get("lex_tags", "#err"), "ColumnWidth": 80}
        ], SelectionModel = uno.Enum("com.sun.star.view.SelectionType", "MULTI"))
        self.xAdd = self._addWidget('add_button', 'Button', nXB, nY1+255, 75, 12, Label = self.dUI.get('add_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x005500, Enabled = False)
        self.xDelete = self._addWidget('delete_button', 'Button', nXB+80, nY1+255, 80, 12, Label = self.dUI.get('delete_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x550000)

        #### Lexicon section
        self._addWidget("lexicon_section", 'FixedLine', nXC, nY1, 200, nHeight, Label = self.dUI.get("lexicon_section", "#err"), FontDescriptor = xFDTitle)
        self.xGridModelLex = self._addGrid("list_grid_lexicon", nXC, nY1+10, 200, 240, [
            {"Title": self.dUI.get("lex_flex", "#err"), "ColumnWidth": 65},
            {"Title": self.dUI.get("lex_lemma", "#err"), "ColumnWidth": 50},
            {"Title": self.dUI.get("lex_tags", "#err"), "ColumnWidth": 65}
        ], SelectionModel = uno.Enum("com.sun.star.view.SelectionType", "MULTI"))
        self._addWidget("num_of_entries_label1", 'FixedText', nXC, nY1+257, 60, nHeight, Label = self.dUI.get("num_of_entries_label", "#err"), FontDescriptor = xFDSubTitle)
        self.xNumLex = self._addWidget("num_of_entries1", 'FixedText', nXC+65, nY1+257, 40, nHeight, Label = "0", FontDescriptor = xFDSubTitle)
        self.xSave = self._addWidget('save_button', 'Button', nXC+110, nY1+255, 45, 12, Label = self.dUI.get('save_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x005500)
        self._addWidget('close_button', 'Button', nXC+160, nY1+255, 40, 12, Label = self.dUI.get('close_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x550000)

        self.loadLexicon()

        # container
        self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx)
        self.xContainer.setModel(self.xDialog)
        self.xGridControlNew = self.xContainer.getControl('list_grid_gwords')







|
|
|
|

|
|


|

|
|



|
|
|
|
|
|
|
|
|


|
|
|
|

|
|
|

|

|
|
|

|
|
|

|
|
|


|
|
|
|



|
|
|
|
|

|
|
|

|

|







|

|



|

|
|

|
|


|

|
|
|

|

|
|







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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266

        nXB = nX1 + 175
        nXC = nXB + 165

        nHeight = 10

        #### Dictionary section
        self._addWidget("dictionary_section", 'FixedLine', nX1, nY0, 170, nHeight, Label = ui.get("dictionary_section"), FontDescriptor = xFDTitle, TextColor = 0x000088)
        self._addWidget("save_date_label", 'FixedText', nXB, nY0+2, 80, nHeight, Label = ui.get("save_date_label"), FontDescriptor = xFDSubTitle, TextColor = 0x000088)
        self._addWidget("num_of_entries_label2", 'FixedText', nXC, nY0+2, 65, nHeight, Label = ui.get("num_of_entries_label"), FontDescriptor = xFDSubTitle, TextColor = 0x000088)
        self.xDateDic = self._addWidget("save_date", 'FixedText', nXB+85, nY0+2, 75, nHeight, Label = ui.get("void"), 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 = ui.get('import_button'), FontDescriptor = xFDSubTitle, TextColor = 0x000055)
        self.xExport = self._addWidget('export_button', 'Button', self.xDialog.Width-45, nY0, 40, 12, Label = ui.get('export_button'), FontDescriptor = xFDSubTitle, TextColor = 0x000055)

        #### Add word
        self._addWidget("add_section", 'FixedLine', nX1, nY1, 170, nHeight, Label = ui.get("add_section"), 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 = ui.get('search_button'), FontDescriptor = xFDSubTitle, TextColor = 0x555500)
        self._addWidget('information_button', 'Button', nX1+155, nY1+11, 15, 12, Label = ui.get('information_button'), 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 = ui.get("nom_adj"), HelpText = ":N:A")
        self.xN = self._addWidget('nom', 'RadioButton', nX1, nY2+22, 60, nHeight, Label = ui.get("nom"), HelpText = ":N")
        self.xA = self._addWidget('adj', 'RadioButton', nX1, nY2+32, 60, nHeight, Label = ui.get("adj"), HelpText = ":A")
        self.xM1 = self._addWidget('M1', 'RadioButton', nX1, nY3+12, 60, nHeight, Label = ui.get("M1"), HelpText = ":M1")
        self.xM2 = self._addWidget('M2', 'RadioButton', nX1, nY3+22, 60, nHeight, Label = ui.get("M2"), HelpText = ":M2")
        self.xMP = self._addWidget('MP', 'RadioButton', nX1, nY3+32, 60, nHeight, Label = ui.get("MP"), HelpText = ":MP")
        self.xV = self._addWidget('verb', 'RadioButton', nX1, nY4+2, 35, nHeight, Label = ui.get("verb"), FontDescriptor = xFDSubTitle, HelpText = ":V")
        self.xW = self._addWidget('adv', 'RadioButton', nX1, nY5+2, 35, nHeight, Label = ui.get("adverb"), FontDescriptor = xFDSubTitle, HelpText = ":W")
        self.xX = self._addWidget('other', 'RadioButton', nX1, nY6+2, 35, nHeight, Label = ui.get("other"), FontDescriptor = xFDSubTitle, HelpText = ":X")

        # Nom, adjectif
        self._addWidget("fl_nom_adj", 'FixedLine', nX1, nY2, 170, nHeight, Label = ui.get("common_name"), FontDescriptor = xFDSubTitle)
        self.xSepi = self._addWidget('Sepi', 'RadioButton', nX1+65, nY2+12, 50, nHeight, Label = ui.get("epi"), HelpText = ":e")
        self.xSmas = self._addWidget('Smas', 'RadioButton', nX1+65, nY2+22, 50, nHeight, Label = ui.get("mas"), HelpText = ":m")
        self.xSfem = self._addWidget('Sfem', 'RadioButton', nX1+65, nY2+32, 50, nHeight, Label = ui.get("fem"), HelpText = ":f")
        self._addWidget("fl_sep1", 'FixedLine', nX1, nY2, 1, nHeight)
        self.xSs = self._addWidget('Ss', 'RadioButton', nX1+115, nY2+12, 50, nHeight, Label = ui.get("-s"), HelpText = "·s")
        self.xSx = self._addWidget('Sx', 'RadioButton', nX1+115, nY2+22, 50, nHeight, Label = ui.get("-x"), HelpText = "·x")
        self.xSinv = self._addWidget('Sinv', 'RadioButton', nX1+115, nY2+32, 50, nHeight, Label = ui.get("inv"), HelpText = ":i")

        self._addWidget("alt_lemma_label", 'FixedLine', nX1+10, nY2+42, 160, nHeight, Label = ui.get("alt_lemma"))
        self.xAltLemma = self._addWidget('alt_lemma', 'Edit', nX1+10, nY2+52, 110, nHeight)
        self.xNA2 = self._addWidget('nom_adj2', 'RadioButton', nX1+10, nY2+65, 60, nHeight, Label = ui.get("nom_adj"), HelpText = ":N:A")
        self.xN2 = self._addWidget('nom2', 'RadioButton', nX1+10, nY2+75, 60, nHeight, Label = ui.get("nom"), HelpText = ":N")
        self.xA2 = self._addWidget('adj2', 'RadioButton', nX1+10, nY2+85, 60, nHeight, Label = ui.get("adj"), HelpText = ":A")
        self._addWidget("fl_sep2", 'FixedLine', nX1, nY2, 1, nHeight)
        self.xSepi2 = self._addWidget('Sepi2', 'RadioButton', nX1+70, nY2+65, 50, nHeight, Label = ui.get("epi"), HelpText = ":e")
        self.xSmas2 = self._addWidget('Smas2', 'RadioButton', nX1+70, nY2+75, 50, nHeight, Label = ui.get("mas"), HelpText = ":m")
        self.xSfem2 = self._addWidget('Sfem2', 'RadioButton', nX1+70, nY2+85, 50, nHeight, Label = ui.get("fem"), HelpText = ":f")
        self._addWidget("fl_sep3", 'FixedLine', nX1, nY2, 1, nHeight)
        self.xSs2 = self._addWidget('Ss2', 'RadioButton', nX1+120, nY2+65, 50, nHeight, Label = ui.get("-s"), HelpText = "·s")
        self.xSx2 = self._addWidget('Sx2', 'RadioButton', nX1+120, nY2+75, 50, nHeight, Label = ui.get("-x"), HelpText = "·x")
        self.xSinv2 = self._addWidget('Sinv2', 'RadioButton', nX1+120, nY2+85, 50, nHeight, Label = ui.get("inv"), HelpText = ":i")

        # Nom propre
        self._addWidget("fl_M", 'FixedLine', nX1, nY3, 170, nHeight, Label = ui.get("proper_name"), FontDescriptor = xFDSubTitle)
        self.xMepi = self._addWidget('Mepi', 'RadioButton', nX1+65, nY3+12, 50, nHeight, Label = ui.get("epi"), HelpText = ":e")
        self.xMmas = self._addWidget('Mmas', 'RadioButton', nX1+65, nY3+22, 50, nHeight, Label = ui.get("mas"), HelpText = ":m")
        self.xMfem = self._addWidget('Mfem', 'RadioButton', nX1+65, nY3+32, 50, nHeight, Label = ui.get("fem"), HelpText = ":f")

        # Verbe
        self._addWidget("fl_verb", 'FixedLine', nX2+30, nY4, 130, nHeight, FontDescriptor = xFDSubTitle)
        self.xV_i = self._addWidget('v_i', 'CheckBox', nX2, nY4+12, 60, nHeight, Label = ui.get("v_i"))
        self.xV_t = self._addWidget('v_t', 'CheckBox', nX2, nY4+20, 60, nHeight, Label = ui.get("v_t"))
        self.xV_n = self._addWidget('v_n', 'CheckBox', nX2, nY4+28, 60, nHeight, Label = ui.get("v_n"))
        self.xV_p = self._addWidget('v_p', 'CheckBox', nX2, nY4+36, 60, nHeight, Label = ui.get("v_p"))
        self.xV_m = self._addWidget('v_m', 'CheckBox', nX2, nY4+44, 60, nHeight, Label = ui.get("v_m"))

        self._addWidget('aux', 'FixedText', nX2+75, nY4+10, 90, nHeight, Label = ui.get("aux"))
        self.xV_ae = self._addWidget('v_ae', 'CheckBox', nX2+75, nY4+20, 90, nHeight, Label = ui.get("v_ae"))
        self.xV_aa = self._addWidget('v_aa', 'CheckBox', nX2+75, nY4+28, 90, nHeight, Label = ui.get("v_aa"))

        self.xV_pp = self._addWidget('v_pp', 'CheckBox', nX2+75, nY4+44, 90, nHeight, Label = ui.get("v_pp"))

        self._addWidget('v_pattern_label', 'FixedText', nX2, nY4+56, 75, nHeight, Label = ui.get('v_pattern'), Align = 2)
        self.xVpattern = self._addWidget('v_pattern', 'Edit', nX2+80, nY4+56, 80, nHeight)

        # Adverbe
        self._addWidget("fl_adv", 'FixedLine', nX2+30, nY5, 130, nHeight, FontDescriptor = xFDSubTitle)

        # Autre
        self._addWidget("fl_other", 'FixedLine', nX2+30, nY6, 130, nHeight, FontDescriptor = xFDSubTitle)
        self._addWidget('flexion_label', 'FixedText', nX2, nY6+11, 22, nHeight, Label = ui.get('flexion'), Align = 2)
        self.xFlexion = self._addWidget('flexion', 'Edit', nX2+25, nY6+10, 50, nHeight)
        self._addWidget('tags_label', 'FixedText', nX2+80, nY6+11, 27, nHeight, Label = ui.get('tags'), Align = 2)
        self.xTags = self._addWidget('tags', 'Edit', nX2+110, nY6+10, 50, nHeight)

        #### Generated words
        self._addWidget("gwords_section", 'FixedLine', nXB, nY1, 160, nHeight, Label = ui.get("new_section"), FontDescriptor = xFDTitle)
        self.xGridModelNew = self._addGrid("list_grid_gwords", nXB, nY1+10, 160, 240, [
            {"Title": ui.get("lex_flex"), "ColumnWidth": 80},
            {"Title": ui.get("lex_tags"), "ColumnWidth": 80}
        ], SelectionModel = uno.Enum("com.sun.star.view.SelectionType", "MULTI"))
        self.xAdd = self._addWidget('add_button', 'Button', nXB, nY1+255, 75, 12, Label = ui.get('add_button'), FontDescriptor = xFDSubTitle, TextColor = 0x005500, Enabled = False)
        self.xDelete = self._addWidget('delete_button', 'Button', nXB+80, nY1+255, 80, 12, Label = ui.get('delete_button'), FontDescriptor = xFDSubTitle, TextColor = 0x550000)

        #### Lexicon section
        self._addWidget("lexicon_section", 'FixedLine', nXC, nY1, 200, nHeight, Label = ui.get("lexicon_section"), FontDescriptor = xFDTitle)
        self.xGridModelLex = self._addGrid("list_grid_lexicon", nXC, nY1+10, 200, 240, [
            {"Title": ui.get("lex_flex"), "ColumnWidth": 65},
            {"Title": ui.get("lex_lemma"), "ColumnWidth": 50},
            {"Title": ui.get("lex_tags"), "ColumnWidth": 65}
        ], SelectionModel = uno.Enum("com.sun.star.view.SelectionType", "MULTI"))
        self._addWidget("num_of_entries_label1", 'FixedText', nXC, nY1+257, 60, nHeight, Label = ui.get("num_of_entries_label"), FontDescriptor = xFDSubTitle)
        self.xNumLex = self._addWidget("num_of_entries1", 'FixedText', nXC+65, nY1+257, 40, nHeight, Label = "0", FontDescriptor = xFDSubTitle)
        self.xSave = self._addWidget('save_button', 'Button', nXC+110, nY1+255, 45, 12, Label = ui.get('save_button'), FontDescriptor = xFDSubTitle, TextColor = 0x005500)
        self._addWidget('close_button', 'Button', nXC+160, nY1+255, 40, 12, Label = ui.get('close_button'), FontDescriptor = xFDSubTitle, TextColor = 0x550000)

        self.loadLexicon()

        # container
        self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx)
        self.xContainer.setModel(self.xDialog)
        self.xGridControlNew = self.xContainer.getControl('list_grid_gwords')
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
                oIBDAWG = ibdawg.IBDAWG(self.oPersonalDicJSON)
                for i, aEntry in enumerate(oIBDAWG.select()):
                    xGridDataModel.addRow(i, aEntry)
                self.xNumLex.Label = str(i)
                self.xNumDic.Label = str(i)
                self.xDateDic.Label = oIBDAWG.sDate
            except:
                sMessage = self.dUI.get('not_loaded', "#err")
                sMessage += traceback.format_exc()
                MessageBox(self.xDocument, sMessage, self.dUI.get('load_title', "#err"), ERRORBOX)
        else:
            self.xNumLex.Label = 0
            self.xNumDic.Label = 0
            self.xDateDic.Label = self.dUI.get("void", "#err")

    @_waitPointer
    def importDictionary (self):
        spfImported = ""
        try:
            xFilePicker = self.xSvMgr.createInstanceWithContext('com.sun.star.ui.dialogs.FilePicker', self.ctx)  # other possibility: com.sun.star.ui.dialogs.SystemFilePicker
            xFilePicker.initialize([uno.getConstantByName("com.sun.star.ui.dialogs.TemplateDescription.FILEOPEN_SIMPLE")]) # seems useless







|

|



|







390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
                oIBDAWG = ibdawg.IBDAWG(self.oPersonalDicJSON)
                for i, aEntry in enumerate(oIBDAWG.select()):
                    xGridDataModel.addRow(i, aEntry)
                self.xNumLex.Label = str(i)
                self.xNumDic.Label = str(i)
                self.xDateDic.Label = oIBDAWG.sDate
            except:
                sMessage = ui.get('not_loaded')
                sMessage += traceback.format_exc()
                MessageBox(self.xDocument, sMessage, ui.get('load_title'), ERRORBOX)
        else:
            self.xNumLex.Label = 0
            self.xNumDic.Label = 0
            self.xDateDic.Label = ui.get("void")

    @_waitPointer
    def importDictionary (self):
        spfImported = ""
        try:
            xFilePicker = self.xSvMgr.createInstanceWithContext('com.sun.star.ui.dialogs.FilePicker', self.ctx)  # other possibility: com.sun.star.ui.dialogs.SystemFilePicker
            xFilePicker.initialize([uno.getConstantByName("com.sun.star.ui.dialogs.TemplateDescription.FILEOPEN_SIMPLE")]) # seems useless
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
            spfImported = os.path.join(os.path.expanduser("~"), "fr.__personal__.json") # workaround
        if spfImported and os.path.isfile(spfImported):
            with open(spfImported, "r", encoding="utf-8") as hDst:
                sJSON = hDst.read()
                try:
                    sTest = json.loads(sJSON)
                except:
                    sMessage = self.dUI.get('wrong_json', "#err_msg: %s") % spfImported
                    MessageBox(self.xDocument, sMessage, self.dUI.get('import_title', "#err"), ERRORBOX)
                else:
                    self.xOptionNode.setPropertyValue("personal_dic", sJSON)
                    self.xSettingNode.commitChanges()
                    self.loadLexicon()
        else:
            sMessage = self.dUI.get('file_not_found', "#err_msg: %s") % spfImported
            MessageBox(self.xDocument, sMessage, self.dUI.get('import_title', "#err"), ERRORBOX)

    @_waitPointer
    def saveLexicon (self):
        xGridDataModel = self.xGridModelLex.GridDataModel
        lEntry = []
        for i in range(xGridDataModel.RowCount):
            lEntry.append(xGridDataModel.getRowData(i))
        if lEntry:
            oDAWG = dawg.DAWG(lEntry, "S", "fr", "Français", "fr.__personal__", "Dictionnaire personnel")
            self.oPersonalDicJSON = oDAWG.getBinaryAsJSON()
            self.xOptionNode.setPropertyValue("personal_dic", json.dumps(self.oPersonalDicJSON, ensure_ascii=False))
            self.xSettingNode.commitChanges()
            self.xNumDic.Label = str(self.oPersonalDicJSON["nEntry"])
            self.xDateDic.Label = self.oPersonalDicJSON["sDate"]
        else:
            self.xOptionNode.setPropertyValue("personal_dic", "")
            self.xSettingNode.commitChanges()
            self.xNumDic.Label = "0"
            self.xDateDic.Label = self.dUI.get("void", "#err")
        MessageBox(self.xDocument, self.dUI.get('save_message', "#err"), self.dUI.get('save_title', "#err"))

    def exportDictionary (self):
        try:
            xFilePicker = self.xSvMgr.createInstanceWithContext('com.sun.star.ui.dialogs.FilePicker', self.ctx)  # other possibility: com.sun.star.ui.dialogs.SystemFilePicker
            xFilePicker.initialize([uno.getConstantByName("com.sun.star.ui.dialogs.TemplateDescription.FILESAVE_SIMPLE")]) # seems useless
            xFilePicker.appendFilter("Supported files", "*.json")
            xFilePicker.setDefaultName("fr.__personal__.json") # useless, doesn’t work







|
|





|
|


















|
|







425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
            spfImported = os.path.join(os.path.expanduser("~"), "fr.__personal__.json") # workaround
        if spfImported and os.path.isfile(spfImported):
            with open(spfImported, "r", encoding="utf-8") as hDst:
                sJSON = hDst.read()
                try:
                    sTest = json.loads(sJSON)
                except:
                    sMessage = ui.get('wrong_json', "#err_msg: %s") % spfImported
                    MessageBox(self.xDocument, sMessage, ui.get('import_title'), ERRORBOX)
                else:
                    self.xOptionNode.setPropertyValue("personal_dic", sJSON)
                    self.xSettingNode.commitChanges()
                    self.loadLexicon()
        else:
            sMessage = ui.get('file_not_found', "#err_msg: %s") % spfImported
            MessageBox(self.xDocument, sMessage, ui.get('import_title'), ERRORBOX)

    @_waitPointer
    def saveLexicon (self):
        xGridDataModel = self.xGridModelLex.GridDataModel
        lEntry = []
        for i in range(xGridDataModel.RowCount):
            lEntry.append(xGridDataModel.getRowData(i))
        if lEntry:
            oDAWG = dawg.DAWG(lEntry, "S", "fr", "Français", "fr.__personal__", "Dictionnaire personnel")
            self.oPersonalDicJSON = oDAWG.getBinaryAsJSON()
            self.xOptionNode.setPropertyValue("personal_dic", json.dumps(self.oPersonalDicJSON, ensure_ascii=False))
            self.xSettingNode.commitChanges()
            self.xNumDic.Label = str(self.oPersonalDicJSON["nEntry"])
            self.xDateDic.Label = self.oPersonalDicJSON["sDate"]
        else:
            self.xOptionNode.setPropertyValue("personal_dic", "")
            self.xSettingNode.commitChanges()
            self.xNumDic.Label = "0"
            self.xDateDic.Label = ui.get("void")
        MessageBox(self.xDocument, ui.get('save_message'), ui.get('save_title'))

    def exportDictionary (self):
        try:
            xFilePicker = self.xSvMgr.createInstanceWithContext('com.sun.star.ui.dialogs.FilePicker', self.ctx)  # other possibility: com.sun.star.ui.dialogs.SystemFilePicker
            xFilePicker.initialize([uno.getConstantByName("com.sun.star.ui.dialogs.TemplateDescription.FILESAVE_SIMPLE")]) # seems useless
            xFilePicker.appendFilter("Supported files", "*.json")
            xFilePicker.setDefaultName("fr.__personal__.json") # useless, doesn’t work
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
                if platform.system() != "Windows":
                    spfExported = "/" + spfExported
                #spfExported = os.path.join(os.path.expanduser("~"), "fr.personal.json")
                sJSON = self.xOptionNode.getPropertyValue("personal_dic")
                if sJSON:
                    with open(spfExported, "w", encoding="utf-8") as hDst:
                        hDst.write(sJSON)
                    sMessage = self.dUI.get('export_message', "#err_msg: %s") % spfExported
                else:
                    sMessage = self.dUI.get('empty_dictionary', "#err")
                MessageBox(self.xDocument, sMessage, self.dUI.get('export_title', "#err"))
        except:
            sMessage = traceback.format_exc()
            MessageBox(self.xDocument, sMessage, self.dUI.get('export_title', "#err"), ERRORBOX)

    def _getRadioValue (self, *args):
        for x in args:
            if x.State:
                return x.HelpText
        return None








|

|
|


|







475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
                if platform.system() != "Windows":
                    spfExported = "/" + spfExported
                #spfExported = os.path.join(os.path.expanduser("~"), "fr.personal.json")
                sJSON = self.xOptionNode.getPropertyValue("personal_dic")
                if sJSON:
                    with open(spfExported, "w", encoding="utf-8") as hDst:
                        hDst.write(sJSON)
                    sMessage = ui.get('export_message', "#err_msg: %s") % spfExported
                else:
                    sMessage = ui.get('empty_dictionary')
                MessageBox(self.xDocument, sMessage, ui.get('export_title'))
        except:
            sMessage = traceback.format_exc()
            MessageBox(self.xDocument, sMessage, ui.get('export_title'), ERRORBOX)

    def _getRadioValue (self, *args):
        for x in args:
            if x.State:
                return x.HelpText
        return None

Modified gc_lang/fr/oxt/DictOptions/SearchWords.py from [2c4ada79ef] to [a5205698ad].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Search
# by Olivier R.
# License: MPL 2

import unohelper
import uno
import traceback
import re

import helpers
import sw_strings
import grammalecte.graphspell as sc
import grammalecte.graphspell.ibdawg as ibdawg

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












|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Search
# by Olivier R.
# License: MPL 2

import unohelper
import uno
import traceback
import re

import helpers
import sw_strings as ui
import grammalecte.graphspell as sc
import grammalecte.graphspell.ibdawg as ibdawg

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


94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
        for k, w in kwargs.items():
            setattr(xGridModel, k, w)
        self.xDialog.insertByName(name, xGridModel)
        return xGridModel

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

        # dialog
        self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx)
        self.xDialog.Width = 350
        self.xDialog.Height = 305
        self.xDialog.Title = self.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







|






|







94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
        for k, w in kwargs.items():
            setattr(xGridModel, k, w)
        self.xDialog.insertByName(name, xGridModel)
        return xGridModel

    def run (self, sLang, oPersonalDicJSON):
        # ui lang
        ui.selectLang(sLang)
        self.oPersonalDicJSON = oPersonalDicJSON

        # dialog
        self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx)
        self.xDialog.Width = 350
        self.xDialog.Height = 305
        self.xDialog.Title = ui.get('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
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
158
159
160
161
162
163
164
        nY0 = 5
        nY1 = nY0 + 20
        nY2 = nY1 + 60

        nHeight = 10

        #### Search
        self._addWidget("search_section", 'FixedLine', nX1, nY0, 120, nHeight, Label = self.dUI.get("search_section", "#err"), FontDescriptor = xFDTitle)
        self._addWidget("similar_search_section", 'FixedLine', nX1, nY1, 120, nHeight, Label = self.dUI.get("similar_search_section", "#err"), FontDescriptor = xFDSubTitle)
        self.xWord = self._addWidget('word', 'Edit', nX1, nY1+10, 100, nHeight)
        self._addWidget('similar_search_button', 'Button', nX1, nY1+22, 55, 12, Label = self.dUI.get('similar_search_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x005500)


        self._addWidget("regex_search_section", 'FixedLine', nX1, nY2, 120, nHeight, Label = self.dUI.get("regex_search_section", "#err"), FontDescriptor = xFDSubTitle)
        self._addWidget('flexion_label', 'FixedText', nX1, nY2+10, 30, nHeight, Label = self.dUI.get('flexion', "#err"))
        self.xFlexion = self._addWidget('flexion', 'Edit', nX1+35, nY2+10, 85, nHeight)
        self._addWidget('tags_label', 'FixedText', nX1, nY2+22, 30, nHeight, Label = self.dUI.get('tags', "#err"))
        self.xTags = self._addWidget('tags', 'Edit', nX1+35, nY2+22, 85, nHeight)
        self._addWidget('regex_search_button', 'Button', nX1, nY2+34, 55, 12, Label = self.dUI.get('regex_search_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x005500)
        self._addWidget('result_warning', 'FixedText', nX1, nY2+50, 120, nHeight*7, Label = self.dUI.get('result_warning', '#err'), MultiLine = True)

        #### Results
        self._addWidget("result_section", 'FixedLine', nX2, nY0, 200, nHeight, Label = self.dUI.get("result_section", "#err"), FontDescriptor = xFDTitle)
        self.xGridModel = self._addGrid("list_grid_search", nX2, nY0+10, 200, 265, [
            {"Title": self.dUI.get("res_flexion", "#err"), "ColumnWidth": 70},
            {"Title": self.dUI.get("res_lemma", "#err"), "ColumnWidth": 60},
            {"Title": self.dUI.get("res_tags", "#err"), "ColumnWidth": 70}
        ])

        self._addWidget('close_button', 'Button', self.xDialog.Width-50, self.xDialog.Height-20, 40, 12, Label = self.dUI.get('close_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x550000)

        # container
        self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx)
        self.xContainer.setModel(self.xDialog)
        self.xGridControlSearch = self.xContainer.getControl('list_grid_search')
        self.xGridControlInfo = self.xContainer.getControl('list_grid_info')
        self.xContainer.getControl('similar_search_button').addActionListener(self)







|
|

|


|
|

|

|
|


|

|
|
|


|







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
158
159
160
161
162
163
164
        nY0 = 5
        nY1 = nY0 + 20
        nY2 = nY1 + 60

        nHeight = 10

        #### Search
        self._addWidget("search_section", 'FixedLine', nX1, nY0, 120, nHeight, Label = ui.get("search_section"), FontDescriptor = xFDTitle)
        self._addWidget("similar_search_section", 'FixedLine', nX1, nY1, 120, nHeight, Label = ui.get("similar_search_section"), FontDescriptor = xFDSubTitle)
        self.xWord = self._addWidget('word', 'Edit', nX1, nY1+10, 100, nHeight)
        self._addWidget('similar_search_button', 'Button', nX1, nY1+22, 55, 12, Label = ui.get('similar_search_button'), FontDescriptor = xFDSubTitle, TextColor = 0x005500)


        self._addWidget("regex_search_section", 'FixedLine', nX1, nY2, 120, nHeight, Label = ui.get("regex_search_section"), FontDescriptor = xFDSubTitle)
        self._addWidget('flexion_label', 'FixedText', nX1, nY2+10, 30, nHeight, Label = ui.get('flexion'))
        self.xFlexion = self._addWidget('flexion', 'Edit', nX1+35, nY2+10, 85, nHeight)
        self._addWidget('tags_label', 'FixedText', nX1, nY2+22, 30, nHeight, Label = ui.get('tags'))
        self.xTags = self._addWidget('tags', 'Edit', nX1+35, nY2+22, 85, nHeight)
        self._addWidget('regex_search_button', 'Button', nX1, nY2+34, 55, 12, Label = ui.get('regex_search_button'), FontDescriptor = xFDSubTitle, TextColor = 0x005500)
        self._addWidget('result_warning', 'FixedText', nX1, nY2+50, 120, nHeight*7, Label = ui.get('result_warning'), MultiLine = True)

        #### Results
        self._addWidget("result_section", 'FixedLine', nX2, nY0, 200, nHeight, Label = ui.get("result_section"), FontDescriptor = xFDTitle)
        self.xGridModel = self._addGrid("list_grid_search", nX2, nY0+10, 200, 265, [
            {"Title": ui.get("res_flexion"), "ColumnWidth": 70},
            {"Title": ui.get("res_lemma"), "ColumnWidth": 60},
            {"Title": ui.get("res_tags"), "ColumnWidth": 70}
        ])

        self._addWidget('close_button', 'Button', self.xDialog.Width-50, self.xDialog.Height-20, 40, 12, Label = ui.get('close_button'), FontDescriptor = xFDSubTitle, TextColor = 0x550000)

        # container
        self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx)
        self.xContainer.setModel(self.xDialog)
        self.xGridControlSearch = self.xContainer.getControl('list_grid_search')
        self.xGridControlInfo = self.xContainer.getControl('list_grid_info')
        self.xContainer.getControl('similar_search_button').addActionListener(self)
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
    @_waitPointer
    def searchSimilar (self):
        self.initSpellChecker()
        sWord = self.xWord.Text.strip()
        if sWord:
            xGridDataModel = self.xGridModel.GridDataModel
            xGridDataModel.removeAllRows()
            lResult = self.oSpellChecker.getSimilarEntries(sWord, 20);
            for i, aEntry in enumerate(lResult):
                xGridDataModel.addRow(i, aEntry)

    @_waitPointer
    def searchRegex (self):
        self.initSpellChecker()
        sFlexPattern = self.xFlexion.Text.strip()
        sTagsPattern = self.xTags.Text.strip()
        try:
            if sFlexPattern:
                re.compile(sFlexPattern)
        except:
            MessageBox(self.xDocument, self.dUI.get("regex_error_flexion", "#err"), self.dUI.get("error", "#err"), nBoxType=ERRORBOX)
            sFlexPattern = ""
        try:
            if sTagsPattern:
                re.compile(sTagsPattern)
        except:
            MessageBox(self.xDocument, self.dUI.get("regex_error_tags", "#err"), self.dUI.get("error", "#err"), nBoxType=ERRORBOX)
            sTagsPattern = ""
        xGridDataModel = self.xGridModel.GridDataModel
        xGridDataModel.removeAllRows()
        for i, aEntry in enumerate(self.oSpellChecker.select(sFlexPattern, sTagsPattern)):
            xGridDataModel.addRow(i, aEntry)
            i += 1
            if i >= 2000:
                break







|












|





|








191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
    @_waitPointer
    def searchSimilar (self):
        self.initSpellChecker()
        sWord = self.xWord.Text.strip()
        if sWord:
            xGridDataModel = self.xGridModel.GridDataModel
            xGridDataModel.removeAllRows()
            lResult = self.oSpellChecker.getSimilarEntries(sWord, 20)
            for i, aEntry in enumerate(lResult):
                xGridDataModel.addRow(i, aEntry)

    @_waitPointer
    def searchRegex (self):
        self.initSpellChecker()
        sFlexPattern = self.xFlexion.Text.strip()
        sTagsPattern = self.xTags.Text.strip()
        try:
            if sFlexPattern:
                re.compile(sFlexPattern)
        except:
            MessageBox(self.xDocument, ui.get("regex_error_flexion"), ui.get("error"), nBoxType=ERRORBOX)
            sFlexPattern = ""
        try:
            if sTagsPattern:
                re.compile(sTagsPattern)
        except:
            MessageBox(self.xDocument, ui.get("regex_error_tags"), ui.get("error"), nBoxType=ERRORBOX)
            sTagsPattern = ""
        xGridDataModel = self.xGridModel.GridDataModel
        xGridDataModel.removeAllRows()
        for i, aEntry in enumerate(self.oSpellChecker.select(sFlexPattern, sTagsPattern)):
            xGridDataModel.addRow(i, aEntry)
            i += 1
            if i >= 2000:
                break

Modified gc_lang/fr/oxt/DictOptions/TagsInfo.py from [190c0fe5da] to [e74861f733].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Lexicon editor: Information
# by Olivier R.
# License: MPL 2

import unohelper
import uno
import traceback

import helpers
import ti_strings

import grammalecte.graphspell.lexgraph_fr as lxg

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











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Lexicon editor: Information
# by Olivier R.
# License: MPL 2

import unohelper
import uno
import traceback

import helpers
import ti_strings as ui

import grammalecte.graphspell.lexgraph_fr as lxg

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


54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
        for k, w in kwargs.items():
            setattr(xGridModel, k, w)
        self.xDialog.insertByName(name, xGridModel)
        return xGridModel

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

        # dialog
        self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx)
        self.xDialog.Width = 360
        self.xDialog.Height = 305
        self.xDialog.Title = self.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







|





|







54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
        for k, w in kwargs.items():
            setattr(xGridModel, k, w)
        self.xDialog.insertByName(name, xGridModel)
        return xGridModel

    def run (self, sLang):
        # ui lang
        ui.selectLang(sLang)

        # dialog
        self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx)
        self.xDialog.Width = 360
        self.xDialog.Height = 305
        self.xDialog.Title = ui.get('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
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
        nY4 = nY3 + 80

        nXB = nX1 + 110

        nHeight = 10

        #### Add word
        self._addWidget("add_section", 'FixedLine', nX1, nY0, 100, nHeight, Label = self.dUI.get("information_section", "#err"), FontDescriptor = xFDTitle)

        self._addWidget('save_label', 'FixedText', nX1, nY1, 100, nHeight, Label = self.dUI.get('save', "#err"), FontDescriptor = xFDTitle)
        self._addWidget('save_desc_label', 'FixedText', nX1, nY1+10, 100, nHeight*5, Label = self.dUI.get('save_desc', "#err"), MultiLine=True)

        self._addWidget('duplicates_label', 'FixedText', nX1, nY2, 100, nHeight, Label = self.dUI.get('duplicates', "#err"), FontDescriptor = xFDTitle)
        self._addWidget('duplicates_desc_label', 'FixedText', nX1, nY2+10, 100, nHeight*5, Label = self.dUI.get('duplicates_desc', "#err"), MultiLine=True)

        self._addWidget('compilation_label', 'FixedText', nX1, nY3, 100, nHeight, Label = self.dUI.get('compilation', "#err"), FontDescriptor = xFDTitle)
        self._addWidget('compilation_desc_label', 'FixedText', nX1, nY3+10, 100, nHeight*7, Label = self.dUI.get('compilation_desc', "#err"), MultiLine=True)

        self._addWidget('warning_label', 'FixedText', nX1, nY4, 100, nHeight, Label = self.dUI.get('warning', "#err"), FontDescriptor = xFDTitle)
        self._addWidget('warning_desc_label', 'FixedText', nX1, nY4+10, 100, nHeight*7, Label = self.dUI.get('warning_desc', "#err"), MultiLine=True)

        #### Tags
        self._addWidget("tags_section", 'FixedLine', nXB, nY0, 230, nHeight, Label = self.dUI.get("tags_section", "#err"), FontDescriptor = xFDTitle)
        self.xGridModel = self._addGrid("list_grid_tags", nXB, nY0+10, 230, 265, [
            {"Title": self.dUI.get("tags", "#err"), "ColumnWidth": 40},
            {"Title": self.dUI.get("meaning", "#err"), "ColumnWidth": 190}
        ])

        self._addWidget('close_button', 'Button', self.xDialog.Width-50, self.xDialog.Height-20, 40, 12, Label = self.dUI.get('close_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x550000)

        self.loadData()

        # container
        self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx)
        self.xContainer.setModel(self.xDialog)
        self.xGridControlInfo = self.xContainer.getControl('list_grid_tags')







|

|
|

|
|

|
|

|
|


|

|
|


|







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
        nY4 = nY3 + 80

        nXB = nX1 + 110

        nHeight = 10

        #### Add word
        self._addWidget("add_section", 'FixedLine', nX1, nY0, 100, nHeight, Label = ui.get("information_section"), FontDescriptor = xFDTitle)

        self._addWidget('save_label', 'FixedText', nX1, nY1, 100, nHeight, Label = ui.get('save'), FontDescriptor = xFDTitle)
        self._addWidget('save_desc_label', 'FixedText', nX1, nY1+10, 100, nHeight*5, Label = ui.get('save_desc'), MultiLine=True)

        self._addWidget('duplicates_label', 'FixedText', nX1, nY2, 100, nHeight, Label = ui.get('duplicates'), FontDescriptor = xFDTitle)
        self._addWidget('duplicates_desc_label', 'FixedText', nX1, nY2+10, 100, nHeight*5, Label = ui.get('duplicates_desc'), MultiLine=True)

        self._addWidget('compilation_label', 'FixedText', nX1, nY3, 100, nHeight, Label = ui.get('compilation'), FontDescriptor = xFDTitle)
        self._addWidget('compilation_desc_label', 'FixedText', nX1, nY3+10, 100, nHeight*7, Label = ui.get('compilation_desc'), MultiLine=True)

        self._addWidget('warning_label', 'FixedText', nX1, nY4, 100, nHeight, Label = ui.get('warning'), FontDescriptor = xFDTitle)
        self._addWidget('warning_desc_label', 'FixedText', nX1, nY4+10, 100, nHeight*7, Label = ui.get('warning_desc'), MultiLine=True)

        #### Tags
        self._addWidget("tags_section", 'FixedLine', nXB, nY0, 230, nHeight, Label = ui.get("tags_section"), FontDescriptor = xFDTitle)
        self.xGridModel = self._addGrid("list_grid_tags", nXB, nY0+10, 230, 265, [
            {"Title": ui.get("tags"), "ColumnWidth": 40},
            {"Title": ui.get("meaning"), "ColumnWidth": 190}
        ])

        self._addWidget('close_button', 'Button', self.xDialog.Width-50, self.xDialog.Height-20, 40, 12, Label = ui.get('close_button'), FontDescriptor = xFDSubTitle, TextColor = 0x550000)

        self.loadData()

        # container
        self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx)
        self.xContainer.setModel(self.xDialog)
        self.xGridControlInfo = self.xContainer.getControl('list_grid_tags')

Modified gc_lang/fr/oxt/DictOptions/do_strings.py from [0a191cd7cc] to [b3a084563a].







1

2





3

4

5
6
7
8
9
10
11






def getUI (sLang):

    if sLang in dStrings:





        return dStrings[sLang]

    return dStrings["fr"]


dStrings = {
    "fr": {
        "title": "Grammalecte · Options orthographiques",

        "spelling_section": "Correcteur orthographique",
        "activate_main": "Activer le correcteur orthographique de Grammalecte",
>
>
>
>
>
>
|
>

>
>
>
>
>
|
>
|
>







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
# Strings for Dictionary Options


sUI = "fr"


def selectLang (sLang):
    global sUI
    if sLang in dStrings:
        sUI = sLang


def get (sMsgCode):
    try:
        return dStrings[sUI].get(sMsgCode, sMsgCode)
    except:
        return "#error"


dStrings = {
    "fr": {
        "title": "Grammalecte · Options orthographiques",

        "spelling_section": "Correcteur orthographique",
        "activate_main": "Activer le correcteur orthographique de Grammalecte",

Modified gc_lang/fr/oxt/DictOptions/lxe_strings.py from [18be362df4] to [bdca2671c1].







1

2





3

4

5
6
7
8
9
10
11






def getUI (sLang):

    if sLang in dStrings:





        return dStrings[sLang]

    return dStrings["fr"]


dStrings = {
    "fr": {
        "title": "Grammalecte · Éditeur lexical",

        # Ajout
        "add_section": "Nouveau mot (lemme)",
>
>
>
>
>
>
|
>

>
>
>
>
>
|
>
|
>







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
# Strings for Lexicon Editor


sUI = "fr"


def selectLang (sLang):
    global sUI
    if sLang in dStrings:
        sUI = sLang


def get (sMsgCode):
    try:
        return dStrings[sUI].get(sMsgCode, sMsgCode)
    except:
        return "#error"


dStrings = {
    "fr": {
        "title": "Grammalecte · Éditeur lexical",

        # Ajout
        "add_section": "Nouveau mot (lemme)",

Modified gc_lang/fr/oxt/DictOptions/sw_strings.py from [ae09aedf5b] to [4a00265ae2].







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






def getUI (sLang):

    if sLang in dStrings:





        return dStrings[sLang]

    return dStrings["fr"]


dStrings = {
    "fr": {
        "title": "Grammalecte · Recherche et informations",

        "search_section": "Recherche",

        "similar_search_section": "Graphies similaires",
        "similar_search_button": "Chercher",

        "regex_search_section": "Expression régulières",
        "flexion": "Flexion",
        "tags": "Étiquettes",
        "regex_search_button": "Chercher",
        "result_warning": "La recherche par expressions régulières peut générer un nombre gigantesque de résultats. Seules les 2000 premières occurrences trouvées seront affichées. La recherche peut être longue, parce tout le graphe de mots, qui contient 500 000 flexions, sera parcouru si besoin.",

        "result_section": "Résultats",
        "res_flexion": "Flexions",
        "res_lemma": "Lemmes",
        "res_tags": "Étiquettes",
        
        "close_button": "Fermer",

        "error": "Erreur",
        "regex_error_flexion": "L’expression régulière du champ ‹Flexion› est erronée.",
        "regex_error_tags": "L’expression régulière du champ ‹Étiquettes› est erronée."
    },

    "en": {
        "title": "Grammalecte · Search and informations",
        
        "search_section": "Search",

        "similar_search_section": "Similar words",
        "similar_search_button": "Search",

        "regex_search_section": "Regular expressions",
        "flexion": "Flexion",
        "tags": "Tags",
        "regex_search_button": "Search",
        "result_warning": "Search via regular expressions can generate a huge amount of results. Only the first 2000 occurrences found will be displayed. Search may be long as the full word graph, which contains 500,000 flexions, will be parsed if required.",

        "result_section": "Results",
        "res_flexion": "Flexions",
        "res_lemma": "Lemmas",
        "res_tags": "Tags",
        
        "close_button": "Close",

        "error": "Error",
        "regex_error_flexion": "The regular expression in field ‹Flexion› is wrong.",
        "regex_error_tags": "The regular expression in field ‹Tags› is wrong."
    },
}
>
>
>
>
>
>
|
>

>
>
>
>
>
|
>
|
>




















|









|















|







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
# Strings for Search Word


sUI = "fr"


def selectLang (sLang):
    global sUI
    if sLang in dStrings:
        sUI = sLang


def get (sMsgCode):
    try:
        return dStrings[sUI].get(sMsgCode, sMsgCode)
    except:
        return "#error"


dStrings = {
    "fr": {
        "title": "Grammalecte · Recherche et informations",

        "search_section": "Recherche",

        "similar_search_section": "Graphies similaires",
        "similar_search_button": "Chercher",

        "regex_search_section": "Expression régulières",
        "flexion": "Flexion",
        "tags": "Étiquettes",
        "regex_search_button": "Chercher",
        "result_warning": "La recherche par expressions régulières peut générer un nombre gigantesque de résultats. Seules les 2000 premières occurrences trouvées seront affichées. La recherche peut être longue, parce tout le graphe de mots, qui contient 500 000 flexions, sera parcouru si besoin.",

        "result_section": "Résultats",
        "res_flexion": "Flexions",
        "res_lemma": "Lemmes",
        "res_tags": "Étiquettes",

        "close_button": "Fermer",

        "error": "Erreur",
        "regex_error_flexion": "L’expression régulière du champ ‹Flexion› est erronée.",
        "regex_error_tags": "L’expression régulière du champ ‹Étiquettes› est erronée."
    },

    "en": {
        "title": "Grammalecte · Search and informations",

        "search_section": "Search",

        "similar_search_section": "Similar words",
        "similar_search_button": "Search",

        "regex_search_section": "Regular expressions",
        "flexion": "Flexion",
        "tags": "Tags",
        "regex_search_button": "Search",
        "result_warning": "Search via regular expressions can generate a huge amount of results. Only the first 2000 occurrences found will be displayed. Search may be long as the full word graph, which contains 500,000 flexions, will be parsed if required.",

        "result_section": "Results",
        "res_flexion": "Flexions",
        "res_lemma": "Lemmas",
        "res_tags": "Tags",

        "close_button": "Close",

        "error": "Error",
        "regex_error_flexion": "The regular expression in field ‹Flexion› is wrong.",
        "regex_error_tags": "The regular expression in field ‹Tags› is wrong."
    },
}

Modified gc_lang/fr/oxt/DictOptions/ti_strings.py from [be1117599a] to [a8cb6b2d8a].







1

2





3

4

5
6
7
8
9
10
11






def getUI (sLang):

    if sLang in dStrings:





        return dStrings[sLang]

    return dStrings["fr"]


dStrings = {
    "fr": {
        "title": "Grammalecte · Informations",

        "information_section": "Informations",

>
>
>
>
>
>
|
>

>
>
>
>
>
|
>
|
>







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
# Strings for Tags Info


sUI = "fr"


def selectLang (sLang):
    global sUI
    if sLang in dStrings:
        sUI = sLang


def get (sMsgCode):
    try:
        return dStrings[sUI].get(sMsgCode, sMsgCode)
    except:
        return "#error"


dStrings = {
    "fr": {
        "title": "Grammalecte · Informations",

        "information_section": "Informations",

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
        "meaning": "Signification",

        "close_button": "Fermer"
    },

    "en": {
        "title": "Grammalecte · Informations",
        
        "information_section": "Informations",

        "save": "Save",
        "save_desc": "Modifications to the lexicon are only saved in the dictionary when you click on ‹Save›.",

        "duplicates": "Duplicates",
        "duplicates_desc": "It is useless to expurgate your lexicon from duplicates. Duplicates are automatically deleted when the dictionary is created.",







|







40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
        "meaning": "Signification",

        "close_button": "Fermer"
    },

    "en": {
        "title": "Grammalecte · Informations",

        "information_section": "Informations",

        "save": "Save",
        "save_desc": "Modifications to the lexicon are only saved in the dictionary when you click on ‹Save›.",

        "duplicates": "Duplicates",
        "duplicates_desc": "It is useless to expurgate your lexicon from duplicates. Duplicates are automatically deleted when the dictionary is created.",

Modified gc_lang/fr/oxt/GraphicOptions/GraphicOptions.py from [c4f8c66470] to [185a3b1c8e].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Graphic Options
# by Olivier R.
# License: MPL 2

import unohelper
import uno
import re
import traceback

import helpers
import go_strings

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


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










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Graphic Options
# by Olivier R.
# License: MPL 2

import unohelper
import uno
import re
import traceback

import helpers
import go_strings as ui

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


class GraphicOptions (unohelper.Base, XActionListener, XJobExecutor):
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
        xWidget.Height = h
        for k, w in kwargs.items():
            setattr(xWidget, k, w)
        self.xDialog.insertByName(name, xWidget)
        return xWidget

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

        self.xDesktop = self.xSvMgr.createInstanceWithContext("com.sun.star.frame.Desktop", self.ctx)
        self.xDocument = self.xDesktop.getCurrentComponent()
        self.xGLOptionNode = 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 = 220
        self.xDialog.Title = self.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







|









|







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
        xWidget.Height = h
        for k, w in kwargs.items():
            setattr(xWidget, k, w)
        self.xDialog.insertByName(name, xWidget)
        return xWidget

    def run (self, sLang):
        ui.selectLang(sLang)

        self.xDesktop = self.xSvMgr.createInstanceWithContext("com.sun.star.frame.Desktop", self.ctx)
        self.xDocument = self.xDesktop.getCurrentComponent()
        self.xGLOptionNode = 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 = 220
        self.xDialog.Title = ui.get('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
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
        nY3 = nY2 + 55
        nY4 = nY3 + 65

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

        # Info
        self._addWidget("graphic_info", 'FixedText', nX, nY1, nWidth, nHeight*2, Label = self.dUI.get("graphic_info", "#err"), MultiLine = True, FontDescriptor = xFDSubTitle)
        self._addWidget("spell_info", 'FixedText', nX, nY1+20, nWidth, nHeight*2, Label = self.dUI.get("spell_info", "#err"), MultiLine = True)

        # Line type
        self._addWidget('linetype_section', 'FixedLine', nX, nY2, nWidth, nHeight, Label = self.dUI.get('linetype_section', "#err"), FontDescriptor = xFDTitle)
        self.xWaveLine = self._addWidget('wave_line', 'RadioButton', nX, nY2+15, nWidth, nHeight, Label = self.dUI.get('wave_line', "#err"))
        self.xBoldWaveLine = self._addWidget('boldwave_line', 'RadioButton', nX, nY2+25, nWidth, nHeight, Label = self.dUI.get('boldwave_line', "#err"))
        self.xBoldLine = self._addWidget('bold_line', 'RadioButton', nX, nY2+35, nWidth, nHeight, Label = self.dUI.get('bold_line', "#err"))

        # Color
        self._addWidget("color_section", 'FixedLine', nX, nY3, nWidth, nHeight, Label = self.dUI.get("color_section", "#err"), FontDescriptor = xFDTitle)
        self.xMulticolor = self._addWidget('multicolor_line', 'CheckBox', nX, nY3+15, nWidth, nHeight, Label = self.dUI.get('multicolor_line', "#err"))
        self._addWidget('multicolor_descr', 'FixedText', nX, nY3+25, nWidth, nHeight*4, Label = self.dUI.get('multicolor_descr', "#err"), MultiLine = True)

        # Restart message
        self._addWidget('restart', 'FixedText', nX, nY4, nWidth, nHeight*2, Label = self.dUI.get('restart', "#err"), FontDescriptor = xFDTitle, MultiLine = True, TextColor = 0x880000)

        # Button
        self._addWidget('apply_button', 'Button', self.xDialog.Width-115, self.xDialog.Height-20, 50, 14, Label = self.dUI.get('apply_button', "#err"), FontDescriptor = xFDTitle, TextColor = 0x005500)
        self._addWidget('cancel_button', 'Button', self.xDialog.Width-60, self.xDialog.Height-20, 50, 14, Label = self.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)







|
|


|
|
|
|


|
|
|


|


|
|







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
        nY3 = nY2 + 55
        nY4 = nY3 + 65

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

        # Info
        self._addWidget("graphic_info", 'FixedText', nX, nY1, nWidth, nHeight*2, Label = ui.get("graphic_info"), MultiLine = True, FontDescriptor = xFDSubTitle)
        self._addWidget("spell_info", 'FixedText', nX, nY1+20, nWidth, nHeight*2, Label = ui.get("spell_info"), MultiLine = True)

        # Line type
        self._addWidget('linetype_section', 'FixedLine', nX, nY2, nWidth, nHeight, Label = ui.get('linetype_section'), FontDescriptor = xFDTitle)
        self.xWaveLine = self._addWidget('wave_line', 'RadioButton', nX, nY2+15, nWidth, nHeight, Label = ui.get('wave_line'))
        self.xBoldWaveLine = self._addWidget('boldwave_line', 'RadioButton', nX, nY2+25, nWidth, nHeight, Label = ui.get('boldwave_line'))
        self.xBoldLine = self._addWidget('bold_line', 'RadioButton', nX, nY2+35, nWidth, nHeight, Label = ui.get('bold_line'))

        # Color
        self._addWidget("color_section", 'FixedLine', nX, nY3, nWidth, nHeight, Label = ui.get("color_section"), FontDescriptor = xFDTitle)
        self.xMulticolor = self._addWidget('multicolor_line', 'CheckBox', nX, nY3+15, nWidth, nHeight, Label = ui.get('multicolor_line'))
        self._addWidget('multicolor_descr', 'FixedText', nX, nY3+25, nWidth, nHeight*4, Label = ui.get('multicolor_descr'), MultiLine = True)

        # Restart message
        self._addWidget('restart', 'FixedText', nX, nY4, nWidth, nHeight*2, Label = ui.get('restart'), FontDescriptor = xFDTitle, MultiLine = True, TextColor = 0x880000)

        # Button
        self._addWidget('apply_button', 'Button', self.xDialog.Width-115, self.xDialog.Height-20, 50, 14, Label = ui.get('apply_button'), FontDescriptor = xFDTitle, TextColor = 0x005500)
        self._addWidget('cancel_button', 'Button', self.xDialog.Width-60, self.xDialog.Height-20, 50, 14, Label = ui.get('cancel_button'), 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)

Modified gc_lang/fr/oxt/GraphicOptions/go_strings.py from [fd57d7ab87] to [46318c07da].






1

2





3

4

5
6
7
8
9
10
11





def getUI (sLang):

    if sLang in dStrings:





        return dStrings[sLang]

    return dStrings["fr"]


dStrings = {
    "fr": {
        "title": "Grammalecte · Options graphiques",

        "graphic_info": "Apparence du soulignement des erreurs grammaticales et typographiques",
        "spell_info": "L’apparence du soulignement des erreurs orthographiques (trait ondulé rouge) n’est pas modifiable",
>
>
>
>
>
|
>

>
>
>
>
>
|
>
|
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# strings for Graphic Options

sUI = "fr"


def selectLang (sLang):
    global sUI
    if sLang in dStrings:
        sUI = sLang


def get (sMsgCode):
    try:
        return dStrings[sUI].get(sMsgCode, sMsgCode)
    except:
        return "#error"


dStrings = {
    "fr": {
        "title": "Grammalecte · Options graphiques",

        "graphic_info": "Apparence du soulignement des erreurs grammaticales et typographiques",
        "spell_info": "L’apparence du soulignement des erreurs orthographiques (trait ondulé rouge) n’est pas modifiable",

Modified gc_lang/fr/oxt/Lexicographer/Enumerator.py from [6f8637a9b7] to [d6e795f3c6].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Enumerator of Words
# by Olivier R.
# License: MPL 2

import unohelper
import uno
import traceback
import platform

import helpers
import enum_strings
import grammalecte.graphspell as sc

from com.sun.star.task import XJobExecutor
from com.sun.star.awt import XActionListener
from com.sun.star.awt import XTopWindowListener

from com.sun.star.awt.MessageBoxButtons import BUTTONS_OK










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Enumerator of Words
# by Olivier R.
# License: MPL 2

import unohelper
import uno
import traceback
import platform

import helpers
import enum_strings as ui
import grammalecte.graphspell as sc

from com.sun.star.task import XJobExecutor
from com.sun.star.awt import XActionListener
from com.sun.star.awt import XTopWindowListener

from com.sun.star.awt.MessageBoxButtons import BUTTONS_OK
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
            xColumnModel.addColumn(xCol)
        for k, w in kwargs.items():
            setattr(xGridModel, k, w)
        self.xDialog.insertByName(name, xGridModel)
        return xGridModel

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

        # dialog
        self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx)
        self.xDialog.Width = 240
        self.xDialog.Height = 280
        self.xDialog.Title = self.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







|





|







99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
            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.selectLang(sLang)

        # dialog
        self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx)
        self.xDialog.Width = 240
        self.xDialog.Height = 280
        self.xDialog.Title = ui.get('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
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
        nY1 = 5
        nY2 = nY1 + 225

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

        # List
        self._addWidget("list_section", 'FixedLine', nX, nY1, nWidth, nHeight, Label = self.dUI.get("list_section", "#err"), FontDescriptor = xFDTitle)
        self._addWidget('count_button', 'Button', nX, nY1+12, 70, 11, Label = self.dUI.get('count_button', "#err"))
        self._addWidget('count2_button', 'Button', nX+75, nY1+12, 70, 11, Label = self.dUI.get('count2_button', "#err"))
        self._addWidget('unknown_button', 'Button', nX+150, nY1+12, 70, 11, Label = self.dUI.get('unknown_button', "#err"))
        self.xGridModel = self._addGrid("list_grid", nX, nY1+25, nWidth, 181, \
            [ {"Title": self.dUI.get("words", "#err"), "ColumnWidth": 175}, {"Title": "Occurrences", "ColumnWidth": 45} ], \
            SelectionModel = uno.Enum("com.sun.star.view.SelectionType", "MULTI") \
        )
        self._addWidget('num_of_entries', 'FixedText', nX, nY1+210, 30, nHeight, Label = self.dUI.get('num_of_entries', "#err"), Align = 2)
        self.xNumWord = self._addWidget('num_of_entries_res', 'FixedText', nX+35, nY1+210, 25, nHeight, Label = "—")
        self._addWidget('tot_of_entries', 'FixedText', nX+60, nY1+210, 30, nHeight, Label = self.dUI.get('tot_of_entries', "#err"), Align = 2)
        self.xTotWord = self._addWidget('tot_of_entries_res', 'FixedText', nX+95, nY1+210, 30, nHeight, Label = "—")
        self.xSearch = self._addWidget('search_button', 'Button', nX+145, nY1+210, 30, nHeight, Label = ">>>", HelpText=self.dUI.get('goto', "#err"), Enabled = False)
        self.xExport = self._addWidget('export_button', 'Button', nX+180, nY1+210, 40, nHeight, Label = self.dUI.get('export', "#err"), Enabled = False)

        # Tag
        # Note: the only way to group RadioButtons is to create them successively
        self._addWidget("charstyle_section", 'FixedLine', nX, nY2, 200, nHeight, Label = self.dUI.get("charstyle_section", "#err"), FontDescriptor = xFDTitle)
        self.xAccent = self._addWidget('emphasis', 'RadioButton', nX, nY2+12, 55, nHeight, Label = self.dUI.get('emphasis', "#err"))
        self.xStrongAccent = self._addWidget('strong_emphasis', 'RadioButton', nX+60, nY2+12, 70, nHeight, Label = self.dUI.get('strong_emphasis', "#err"))
        self.xNoAccent = self._addWidget('nostyle', 'RadioButton', nX+140, nY2+12, 45, nHeight, Label = self.dUI.get('nostyle', "#err"))

        self.xTag = self._addWidget('tag_button', 'Button', self.xDialog.Width-40, nY2+10, 30, 11, Label = self.dUI.get('tag_button', "#err"), FontDescriptor = xFDTitle, TextColor = 0x005500, Enabled=False)

        # Progress bar
        self.xProgressBar = self._addWidget('progress_bar', 'ProgressBar', nX, self.xDialog.Height-25, 160, 14)
        self.xProgressBar.ProgressValueMin = 0
        self.xProgressBar.ProgressValueMax = 1 # to calculate later

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

        # container
        self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx)
        self.xContainer.setModel(self.xDialog)
        self.xGridControl = self.xContainer.getControl('list_grid')
        self.xContainer.getControl('count_button').addActionListener(self)
        self.xContainer.getControl('count_button').setActionCommand('Count')







|
|
|
|

|


|

|

|
|



|
|
|
|

|







|







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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
        nY1 = 5
        nY2 = nY1 + 225

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

        # List
        self._addWidget("list_section", 'FixedLine', nX, nY1, nWidth, nHeight, Label = ui.get("list_section"), FontDescriptor = xFDTitle)
        self._addWidget('count_button', 'Button', nX, nY1+12, 70, 11, Label = ui.get('count_button'))
        self._addWidget('count2_button', 'Button', nX+75, nY1+12, 70, 11, Label = ui.get('count2_button'))
        self._addWidget('unknown_button', 'Button', nX+150, nY1+12, 70, 11, Label = ui.get('unknown_button'))
        self.xGridModel = self._addGrid("list_grid", nX, nY1+25, nWidth, 181, \
            [ {"Title": ui.get("words"), "ColumnWidth": 175}, {"Title": "Occurrences", "ColumnWidth": 45} ], \
            SelectionModel = uno.Enum("com.sun.star.view.SelectionType", "MULTI") \
        )
        self._addWidget('num_of_entries', 'FixedText', nX, nY1+210, 30, nHeight, Label = ui.get('num_of_entries'), Align = 2)
        self.xNumWord = self._addWidget('num_of_entries_res', 'FixedText', nX+35, nY1+210, 25, nHeight, Label = "—")
        self._addWidget('tot_of_entries', 'FixedText', nX+60, nY1+210, 30, nHeight, Label = ui.get('tot_of_entries'), Align = 2)
        self.xTotWord = self._addWidget('tot_of_entries_res', 'FixedText', nX+95, nY1+210, 30, nHeight, Label = "—")
        self.xSearch = self._addWidget('search_button', 'Button', nX+145, nY1+210, 30, nHeight, Label = ">>>", HelpText=ui.get('goto'), Enabled = False)
        self.xExport = self._addWidget('export_button', 'Button', nX+180, nY1+210, 40, nHeight, Label = ui.get('export'), Enabled = False)

        # Tag
        # Note: the only way to group RadioButtons is to create them successively
        self._addWidget("charstyle_section", 'FixedLine', nX, nY2, 200, nHeight, Label = ui.get("charstyle_section"), FontDescriptor = xFDTitle)
        self.xAccent = self._addWidget('emphasis', 'RadioButton', nX, nY2+12, 55, nHeight, Label = ui.get('emphasis'))
        self.xStrongAccent = self._addWidget('strong_emphasis', 'RadioButton', nX+60, nY2+12, 70, nHeight, Label = ui.get('strong_emphasis'))
        self.xNoAccent = self._addWidget('nostyle', 'RadioButton', nX+140, nY2+12, 45, nHeight, Label = ui.get('nostyle'))

        self.xTag = self._addWidget('tag_button', 'Button', self.xDialog.Width-40, nY2+10, 30, 11, Label = ui.get('tag_button'), FontDescriptor = xFDTitle, TextColor = 0x005500, Enabled=False)

        # Progress bar
        self.xProgressBar = self._addWidget('progress_bar', 'ProgressBar', nX, self.xDialog.Height-25, 160, 14)
        self.xProgressBar.ProgressValueMin = 0
        self.xProgressBar.ProgressValueMax = 1 # to calculate later

        # Close
        self._addWidget('close_button', 'Button', self.xDialog.Width-60, self.xDialog.Height-25, 50, 14, Label = ui.get('close_button'), FontDescriptor = xFDTitle, TextColor = 0x550000)

        # container
        self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx)
        self.xContainer.setModel(self.xDialog)
        self.xGridControl = self.xContainer.getControl('list_grid')
        self.xContainer.getControl('count_button').addActionListener(self)
        self.xContainer.getControl('count_button').setActionCommand('Count')
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
        self.xContainer.createPeer(xToolkit, None)
        #self.xContainer.execute()          # Don’t excute for non modal dialog

    # XActionListener
    def actionPerformed (self, xActionEvent):
        try:
            if xActionEvent.ActionCommand == "Count":
                self.count(self.dUI.get("words", "#err"))
                self.xTag.Enabled = True
                self.xSearch.Enabled = True
                self.xExport.Enabled = True
            elif xActionEvent.ActionCommand == "CountByLemma":
                self.count(self.dUI.get("lemmas", "#err"), bByLemma=True)
                self.xTag.Enabled = False
                self.xSearch.Enabled = False
                self.xExport.Enabled = True
            elif xActionEvent.ActionCommand == "UnknownWords":
                self.count(self.dUI.get("unknown_words", "#err"), bOnlyUnknownWords=True)
                self.xTag.Enabled = True
                self.xSearch.Enabled = True
                self.xExport.Enabled = True
            elif xActionEvent.ActionCommand == "Search":
                if not self.xGridControl.hasSelectedRows():
                    return
                lRow = self.xGridControl.getSelectedRows()







|




|




|







190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
        self.xContainer.createPeer(xToolkit, None)
        #self.xContainer.execute()          # Don’t excute for non modal dialog

    # XActionListener
    def actionPerformed (self, xActionEvent):
        try:
            if xActionEvent.ActionCommand == "Count":
                self.count(ui.get("words"))
                self.xTag.Enabled = True
                self.xSearch.Enabled = True
                self.xExport.Enabled = True
            elif xActionEvent.ActionCommand == "CountByLemma":
                self.count(ui.get("lemmas"), bByLemma=True)
                self.xTag.Enabled = False
                self.xSearch.Enabled = False
                self.xExport.Enabled = True
            elif xActionEvent.ActionCommand == "UnknownWords":
                self.count(ui.get("unknown_words"), bOnlyUnknownWords=True)
                self.xTag.Enabled = True
                self.xSearch.Enabled = True
                self.xExport.Enabled = True
            elif xActionEvent.ActionCommand == "Search":
                if not self.xGridControl.hasSelectedRows():
                    return
                lRow = self.xGridControl.getSelectedRows()
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
                if platform.system() != "Windows":
                    spfExported = "/" + spfExported
                #spfExported = os.path.join(os.path.expanduser("~"), "fr.personal.json")
                with open(spfExported, "w", encoding="utf-8") as hDst:
                    hDst.write(sText)
        except:
            sMessage = traceback.format_exc()
            MessageBox(self.xDocument, sMessage, self.dUI.get('export_title', "#err"), ERRORBOX)

    @_waitPointer
    def tagText (self, aWord, sAction=""):
        if not sAction:
            return
        self.xProgressBar.ProgressValueMax = self._countParagraph()
        self.xProgressBar.ProgressValue = 0







|







344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
                if platform.system() != "Windows":
                    spfExported = "/" + spfExported
                #spfExported = os.path.join(os.path.expanduser("~"), "fr.personal.json")
                with open(spfExported, "w", encoding="utf-8") as hDst:
                    hDst.write(sText)
        except:
            sMessage = traceback.format_exc()
            MessageBox(self.xDocument, sMessage, ui.get('export_title'), ERRORBOX)

    @_waitPointer
    def tagText (self, aWord, sAction=""):
        if not sAction:
            return
        self.xProgressBar.ProgressValueMax = self._countParagraph()
        self.xProgressBar.ProgressValue = 0

Modified gc_lang/fr/oxt/Lexicographer/enum_strings.py from [566a315685] to [2ba14d763e].






1

2





3

4

5
6
7
8
9
10
11





def getUI (sLang):

    if sLang in dStrings:





        return dStrings[sLang]

    return dStrings["fr"]


dStrings = {
    "fr": {
        "title": "Grammalecte · Recenseur de mots",

        "list_section": "Énumération des occurrences",
        "count_button": "Compter tout",
>
>
>
>
>
|
>

>
>
>
>
>
|
>
|
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# strings for Enumerator

sUI = "fr"


def selectLang (sLang):
    global sUI
    if sLang in dStrings:
        sUI = sLang


def get (sMsgCode):
    try:
        return dStrings[sUI].get(sMsgCode, sMsgCode)
    except:
        return "#error"


dStrings = {
    "fr": {
        "title": "Grammalecte · Recenseur de mots",

        "list_section": "Énumération des occurrences",
        "count_button": "Compter tout",

Modified gc_lang/fr/rules.grx from [28c18e3796] to [4effd688cb].

21257
21258
21259
21260
21261
21262
21263
21264
21265
21266
21267
21268
21269
21270
21271
        <<- /conf/ -3>> fonds                   && Confusion : fonds (ce qui constitue une richesse) ≠ fond (partie la plus basse/profonde).

    à [fond|fonts] [perdu+ses]
        <<- /conf/ ->> à fonds perdus           && Confusion : fonds (ce qui constitue une richesse) ≠ fond (partie la plus basse/profonde).

    [fond|fonts] [>monétaire|spéculatif+s|>international|souverain+s]
    [fond|fonts] [de|d’] [commerce|garantie|roulement|pension|placement|retraite|roulement|solidarité]
    [fond|fonts] d’ [aide|investissement|indemnisation]
        <<- /conf/ -1>> fonds                   && Confusion : fonds (ce qui constitue une richesse) ≠ fond (partie la plus basse/profonde).

    fonds baptismaux
        <<- /conf/ -1>> fonts                   && Confusion. Écrivez “fonts”, qui vient du mot latin ‹fons› et signifie « fontaine, source ».

    [un|le|du|ce] [fonds|fonts] [de|d’] ?[la|l’]¿ [assiette|bouteille|cuve|casserolle|marmite|poêle]
    [un|le|du|ce] [fonds|fonts] du [seau|tupperware|wok]







|







21257
21258
21259
21260
21261
21262
21263
21264
21265
21266
21267
21268
21269
21270
21271
        <<- /conf/ -3>> fonds                   && Confusion : fonds (ce qui constitue une richesse) ≠ fond (partie la plus basse/profonde).

    à [fond|fonts] [perdu+ses]
        <<- /conf/ ->> à fonds perdus           && Confusion : fonds (ce qui constitue une richesse) ≠ fond (partie la plus basse/profonde).

    [fond|fonts] [>monétaire|spéculatif+s|>international|souverain+s]
    [fond|fonts] [de|d’] [commerce|garantie|roulement|pension|placement|retraite|roulement|solidarité]
    [fond|fonts] d’ [aide|investissement|indemnisation|urgence]
        <<- /conf/ -1>> fonds                   && Confusion : fonds (ce qui constitue une richesse) ≠ fond (partie la plus basse/profonde).

    fonds baptismaux
        <<- /conf/ -1>> fonts                   && Confusion. Écrivez “fonts”, qui vient du mot latin ‹fons› et signifie « fontaine, source ».

    [un|le|du|ce] [fonds|fonts] [de|d’] ?[la|l’]¿ [assiette|bouteille|cuve|casserolle|marmite|poêle]
    [un|le|du|ce] [fonds|fonts] du [seau|tupperware|wok]