Grammalecte  Diff

Differences From Artifact [4ef478c592]:

To Artifact [fbcf41e9ef]:


75
76
77
78
79
80
81
82

83
84

85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
75
76
77
78
79
80
81

82
83

84
85


86
87
88
89
90
91
92
93
94
95
96
97
98
99
100


101
102
103
104
105


106
107
108
109
110
111
112
113
114
115
116
117




118
119
120
121














-
+

-
+

-
-















-
-





-
-












-
-
-
-




-
-
-
-
-
-
-
            # 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, 60, 10, Align = 1, TextColor = 0x666666, FontDescriptor = xFD2, \
            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', 70, 124, 40, 10, \
            self._addWidget('console_button', 'Button', nLblWidth-40, 124, 40, 10, \
                            Label = dUI.get('console', "#err"), FontDescriptor = xFD2, TextColor = 0x666666)
            self.xAutoConsole = self._addWidget('autoconsole', 'CheckBox', 120, 125, 40, 10, \
                                                Label = dUI.get('autoconsole', "#err"), HelpText = dUI.get("autoconsole_descr", "#err"))

            # 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)

            self._loadOptions()

            # 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')
            self.xContainer.getControl('autoconsole').addActionListener(self)
            self.xContainer.getControl('autoconsole').setActionCommand('AutoConsole')
            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 == 'Console':
                helpers.startConsole()
            elif xActionEvent.ActionCommand == "AutoConsole":
                xChild = self.xGLOptionNode.getByName("o_fr")
                xChild.setPropertyValue("start_console", self.xAutoConsole.State)
                self.xGLOptionNode.commitChanges()
            else:
                self.xContainer.endExecute()
        except:
            traceback.print_exc()

    def _loadOptions (self):
        try:
            xChild = self.xGLOptionNode.getByName("o_fr")
            self.xAutoConsole.State = xChild.getPropertyValue("start_console")
        except:
            traceback.print_exc()