Grammalecte  Diff

Differences From Artifact [eb41943f0c]:

To Artifact [ad3a7ac1f9]:


1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
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 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
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)
            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")
            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
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 = 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, \
            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 = dUI.get('pythonver', "#err") + "{0[0]}.{0[1]}.{0[2]}".format(sys.version_info))
                            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 = dUI.get('console', "#err"), FontDescriptor = xFD2, TextColor = 0x666666)
                            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 = dUI.get('message', "#err"), FontDescriptor = xFD2, Align = 1)
            self._addWidget('lblURL1', 'FixedHyperlink', 10, 170, nLblWidth, 10, Label = dUI.get('sponsor', "#err"), \
            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 = dUI.get('sponsor2', "#err"), \
            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 = dUI.get('link', "#err"), \
            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')