Overview
Comment: | [lo] bug: enumerator of words, fix export on Linux |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | lo |
Files: | files | file ages | folders |
SHA3-256: |
64e391ced99f90e8df55b4455ff8722d |
User & Date: | olr on 2020-04-10 18:19:27 |
Other Links: | manifest | tags |
Context
2020-04-10
| ||
19:10 | [lo] enumerator of words: help text for the button <find next occurrence> check-in: d506cb687a user: olr tags: trunk, lo | |
18:19 | [lo] bug: enumerator of words, fix export on Linux check-in: 64e391ced9 user: olr tags: trunk, lo | |
13:33 | [fr] ajustements check-in: b65934a406 user: olr tags: trunk, fr | |
Changes
Modified gc_lang/fr/oxt/Lexicographer/Enumerator.py from [60452afcd6] to [1069590a78].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # Enumerator of Words # by Olivier R. # License: MPL 2 import unohelper import uno import traceback import helpers import enum_strings import grammalecte.graphspell as sc 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 | # 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 |
︙ | ︙ | |||
321 322 323 324 325 326 327 | sText = "" for sWord, nOccur in sorted(self.dWord.items(), key=lambda t: t[1], reverse=True): sText += sWord + "\t" + str(nOccur) + "\n" 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", "*.txt") | | | > > | 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | sText = "" for sWord, nOccur in sorted(self.dWord.items(), key=lambda t: t[1], reverse=True): sText += sWord + "\t" + str(nOccur) + "\n" 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", "*.txt") xFilePicker.setDefaultName("word_count.txt") # doesn’t work on Windows xFilePicker.setDisplayDirectory("") xFilePicker.setMultiSelectionMode(False) nResult = xFilePicker.execute() if nResult == 1: # lFile = xFilePicker.getSelectedFiles() lFile = xFilePicker.getFiles() spfExported = lFile[0][5:].lstrip("/") # remove file:// 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) |
︙ | ︙ |