Index: gc_lang/fr/oxt/DictOptions/DictOptions.py ================================================================== --- gc_lang/fr/oxt/DictOptions/DictOptions.py +++ gc_lang/fr/oxt/DictOptions/DictOptions.py @@ -42,11 +42,11 @@ xLocations = xSettings.getByName("Locations") # dialog self.xDialog = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialogModel', self.ctx) self.xDialog.Width = 200 - self.xDialog.Height = 290 + self.xDialog.Height = 255 self.xDialog.Title = dUI.get('title', "#title#") xWindowSize = helpers.getWindowSize() self.xDialog.PositionX = int((xWindowSize.Width / 2) - (self.xDialog.Width / 2)) self.xDialog.PositionY = int((xWindowSize.Height / 2) - (self.xDialog.Height / 2)) @@ -82,30 +82,33 @@ # Personal dictionary section self._addWidget("personal_section", 'FixedLine', nX, nY3, nWidth, nHeight, Label = dUI.get("personal_section", "#err"), FontDescriptor = xFDTitle) self.xActivatePersonnal = self._addWidget('activate_personal', 'CheckBox', nX, nY3+15, nWidth, nHeight, Label = dUI.get('activate_personal', "#err"), State = True) self._addWidget('activate_personnal_descr', 'FixedText', nX, nY3+25, nWidth, nHeight*3, Label = dUI.get('activate_personal_descr', "#err"), MultiLine = True) - self._addWidget('import_personal', 'FixedText', nX, nY3+55, nWidth, nHeight, Label = dUI.get('import_personal', "#err"), FontDescriptor = xFDSubTitle) - + self._addWidget('import_personal', 'FixedText', nX, nY3+55, nWidth-60, nHeight, Label = dUI.get('import_personal', "#err"), FontDescriptor = xFDSubTitle) + self.xMsg = self._addWidget('msg', 'FixedText', nX, nY3+65, nWidth-50, nHeight, Label = "[néant]") + self._addWidget('import_button', 'Button', self.xDialog.Width-50, nY3+65, 40, 10, Label = dUI.get('import_button', "#err"), TextColor = 0x005500) self._addWidget('create_dictionary', 'FixedText', nX, nY3+75, nWidth, nHeight*2, Label = dUI.get('create_dictionary', "#err"), MultiLine = True) # Button - self._addWidget('apply_button', 'Button', self.xDialog.Width-120, self.xDialog.Height-25, 50, 14, Label = dUI.get('apply_button', "#err"), TextColor = 0x00AA00) - self._addWidget('cancel_button', 'Button', self.xDialog.Width-10, self.xDialog.Height-25, 50, 14, Label = dUI.get('cancel_button', "#err"), TextColor = 0xAA0000) + self._addWidget('apply_button', 'Button', self.xDialog.Width-120, self.xDialog.Height-25, 50, 14, Label = dUI.get('apply_button', "#err"), FontDescriptor = xFDTitle, TextColor = 0x005500) + self._addWidget('cancel_button', 'Button', self.xDialog.Width-60, self.xDialog.Height-25, 50, 14, Label = dUI.get('cancel_button', "#err"), FontDescriptor = xFDTitle, TextColor = 0x550000) # container self.xContainer = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.UnoControlDialog', self.ctx) self.xContainer.setModel(self.xDialog) self.xContainer.getControl('apply_button').addActionListener(self) self.xContainer.getControl('apply_button').setActionCommand('Apply') + self.xContainer.getControl('import_button').addActionListener(self) + self.xContainer.getControl('import_button').setActionCommand('Import') self.xContainer.getControl('cancel_button').addActionListener(self) self.xContainer.getControl('cancel_button').setActionCommand('Cancel') self.xContainer.setVisible(False) toolkit = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.ExtToolkit', self.ctx) self.xContainer.createPeer(toolkit, None) self.xContainer.execute() - + # XActionListener def actionPerformed (self, xActionEvent): try: if xActionEvent.ActionCommand == 'Apply': if False: @@ -115,10 +118,26 @@ v1 = xLocations[0].replace(self.sCurrentDic, self.sSelectedDic) v2 = xLocations[1].replace(self.sCurrentDic, self.sSelectedDic) #xSettings.replaceByName("Locations", xLocations) # doesn't work, see line below uno.invoke(xSettings, "replaceByName", ("Locations", uno.Any("[]string", (v1, v2)))) xSettings.commitChanges() + elif xActionEvent.ActionCommand == "Import": + #xFilePicker = uno.createUnoService("com.sun.star.ui.dialogs.FilePicker") + xFilePicker = self.xSvMgr.createInstanceWithContext('com.sun.star.ui.dialogs.SystemFilePicker', self.ctx) + xFilePicker.appendFilter("Supported files", "*.json; *.bdic") + #xFilePicker.setDisplayDirectory("") + #xFilePicker.setMultiSelectionMode(True) + nResult = xFilePicker.execute() + print(nResult) + if nResult == 1: + print("two") + lFile = xFilePicker.getSelectedFiles() + print("one") + lFile = xFilePicker.getFiles() + print(lFile) + else: + pass self.xContainer.endExecute() except: traceback.print_exc() # XJobExecutor Index: gc_lang/fr/oxt/DictOptions/do_strings.py ================================================================== --- gc_lang/fr/oxt/DictOptions/do_strings.py +++ gc_lang/fr/oxt/DictOptions/do_strings.py @@ -7,18 +7,18 @@ "fr": { "title": "Grammalecte · Options des dictionnaires", "spelling_section": "Correcteur orthographique", "activate_main": "Activer le correcteur orthographique de Grammalecte", - "activate_main_descr": "Supplante le correcteur orthographique inclus dans LibreOffice (Hunspell)", + "activate_main_descr": "Supplante le correcteur orthographique inclus dans LibreOffice (Hunspell).", "personal_section": "Dictionnaire personnel", "activate_personal": "Utiliser", "activate_personal_descr": "Le dictionnaire personnel est une commodité pour ajouter le vocabulaire qui vous est utile. Il ne supplante pas le dictionnaire commun ; il ne fait qu’ajouter de nouveaux mots.", "import_personal": "Importer un dictionnaire personnel", - "import": "Importer", - "create_dictionary": "Vous pouvez créer un dictionnaire personnel avec l’extension Grammalecte pour Firefox ou Chrome", + "import_button": "Importer", + "create_dictionary": "Vous pouvez créer un dictionnaire personnel avec l’extension Grammalecte pour Firefox ou Chrome.", "suggestion_section": "Moteur de suggestion orthographique", "activate_spell_sugg": "Activer le moteur de suggestion de Grammalecte", "activate_spell_sugg_descr": "Désactivée, cette option remplace la suggestion orthographique de Grammalecte par celle fournie par LibreOffice (Hunspell). Les mots inclus dans le dictionnaire personnalisé ne seront plus inclus aux suggestions.", @@ -34,16 +34,16 @@ "personal_section": "Personal dictionary", "activate_personal": "Use", "activate_personal_descr": "The personal dictionary is a commodity to add the vocabulary you want. It doesn’t override the common dictionary ; it only adds new words.", "import_personal": "Import a personal dictionary", - "import": "Import", - "create_dictionary": "You can create a personal dictionary with the Grammalecte addon for Firefox or Chrome", + "import_button": "Import", + "create_dictionary": "You can create a personal dictionary with the Grammalecte addon for Firefox or Chrome.", "suggestion_section": "Spell suggestion engine", "activate_spell_sugg": "Activate the suggestion engine of Grammalecte", "activate_spell_sugg_descr": "Disactivated, this option replace the spell suggestion engine of Grammalecte by the one of LibreOffice (Hunspell). Words included in the personal dictionary won’t be included among suggestions.", "apply_button": "Apply", "cancel_button": "Cancel", }, }