Index: gc_core/py/oxt/Grammalecte.py ================================================================== --- gc_core/py/oxt/Grammalecte.py +++ gc_core/py/oxt/Grammalecte.py @@ -30,16 +30,16 @@ self.locales = [] for i in gce.locales: l = gce.locales[i] self.locales.append(Locale(l[0], l[1], l[2])) self.locales = tuple(self.locales) - xCurCtx = uno.getComponentContext() + xContext = uno.getComponentContext() # init gce.load("Writer", "nInt") # GC options - # opt_handler.load(xCurCtx) - dOpt = Options.load(xCurCtx) + # opt_handler.load(xContext) + dOpt = Options.load(xContext) gce.setOptions(dOpt) # dictionaries options self.loadUserDictionaries() # underlining options self.setWriterUnderliningStyle() Index: gc_core/py/oxt/OptionsDialog.xcs ================================================================== --- gc_core/py/oxt/OptionsDialog.xcs +++ gc_core/py/oxt/OptionsDialog.xcs @@ -10,18 +10,18 @@ - The data for one leaf. + Grammar options for language ${lang}. ${xcs_options} - The data for one leaf. + Other options for language ${lang}. 1 1 0 @@ -30,10 +30,12 @@ 1 BOLDWAVE + + 0 Index: gc_core/py/oxt/helpers.py ================================================================== --- gc_core/py/oxt/helpers.py +++ gc_core/py/oxt/helpers.py @@ -8,11 +8,11 @@ from com.sun.star.beans import PropertyValue from com.sun.star.uno import RuntimeException as _rtex -def start_console (): +def startConsole (): "open console from APSO extension" try: xContext = uno.getComponentContext() xContext.ServiceManager.createInstance("apso.python.script.organizer.impl") # now we can import apso_utils library Index: gc_lang/fr/oxt/About/About.py ================================================================== --- gc_lang/fr/oxt/About/About.py +++ gc_lang/fr/oxt/About/About.py @@ -35,10 +35,11 @@ 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 @@ -76,14 +77,16 @@ 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-50, 10, Align = 1, TextColor = 0x666666, FontDescriptor = xFD2, \ + self._addWidget('lblpython', 'FixedText', 10, 125, 60, 10, Align = 1, TextColor = 0x666666, FontDescriptor = xFD2, \ Label = dUI.get('pythonver', "#err") + "{0[0]}.{0[1]}.{0[2]}".format(sys.version_info)) - xConsoleButton = self._addWidget('console_button', 'Button', nLblWidth-30, 124, 40, 10, \ - Label = dUI.get('console', "#err"), FontDescriptor = xFD2, TextColor = 0x666666) + self._addWidget('console_button', 'Button', 70, 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 @@ -95,15 +98,19 @@ 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: @@ -111,10 +118,21 @@ # XActionListener def actionPerformed (self, xActionEvent): try: if xActionEvent.ActionCommand == 'Console': - helpers.start_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() Index: gc_lang/fr/oxt/About/ab_strings.py ================================================================== --- gc_lang/fr/oxt/About/ab_strings.py +++ gc_lang/fr/oxt/About/ab_strings.py @@ -11,12 +11,14 @@ "title": "Grammalecte", "version": "Version : ${version}", "license": "Licence : GPL 3", "website": "Site web", - "pythonver": "Machine Python : v", + "pythonver": "Python v", "console": "Console", + "autoconsole": "Auto", + "autoconsole_descr": "Lance la console au démarrage de LibreOffice", "message": "Avec le soutien de", "sponsor": "La Mouette…", "sponsor2": "Algoo…", "link": "… et de nombreux contributeurs.", @@ -28,16 +30,18 @@ "title": "Grammalecte", "version": "Version: ${version}", "license": "License: GPL 3", "website": "Web site", - "pythonver": "Python machine: v", + "pythonver": "Python v", "console": "Console", + "autoconsole": "Auto", + "autoconsole_descr": "Launch the console at the start of LibreOffice", "message": "With the support of", "sponsor": "La Mouette…", "sponsor2": "Algoo…", "link": "… and many contributors.", "close": "~OK" } } Index: gc_lang/fr/oxt/AppLauncher.py ================================================================== --- gc_lang/fr/oxt/AppLauncher.py +++ gc_lang/fr/oxt/AppLauncher.py @@ -1,6 +1,5 @@ -# -*- coding: utf8 -*- # Grammalecte AppLauncher # by Olivier R. # License: MPL 2 import unohelper @@ -21,10 +20,15 @@ # In this extension, French is default language. # It is assumed that those who need to use the French dictionaries understand French and may not understand English. xSettings = helpers.getConfigSetting("/org.openoffice.Setup/L10N", False) sLocale = xSettings.getByName("ooLocale") # Note: look at ooSetupSystemLocale value? self.sLang = sLocale[0:2] + # console + xSettings = helpers.getConfigSetting("/org.openoffice.Lightproof_grammalecte/Other/", False) + xChild = xSettings.getByName("o_fr") + if xChild.getPropertyValue("start_console"): + helpers.startConsole() # XJobExecutor def trigger (self, sCmd): try: if sCmd == "About":