Grammalecte  Check-in [5d8a8c82b4]

Overview
Comment:[lo] éditeur lexical: décodage des caractères spéciaux des URL
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | lo
Files: files | file ages | folders
SHA3-256: 5d8a8c82b4e0a342609688dc3dfc0c3c9976a5ac62cbfe779c5b2d9d9eeaf491
User & Date: olr on 2023-03-24 15:17:27
Other Links: manifest | tags
Context
2023-06-10
12:10
[fr] faux positif et ajustements check-in: e47e52f2c6 user: olr tags: trunk, fr
2023-03-24
15:17
[lo] éditeur lexical: décodage des caractères spéciaux des URL check-in: 5d8a8c82b4 user: olr tags: trunk, lo
2023-03-23
13:44
[lo] change colors to be compatible wth dark theme check-in: b541db43f2 user: olr tags: trunk, lo
Changes

Modified gc_lang/fr/oxt/DictOptions/LexiconEditor.py from [50557d290a] to [4ab28bf540].

1
2
3
4
5
6
7

8
9
10
11
12
13
14
# Lexicon Editor
# by Olivier R.
# License: MPL 2

import unohelper
import uno
import json

import re
import os
import traceback
import platform

import helpers
import lxe_strings as ui







>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Lexicon Editor
# by Olivier R.
# License: MPL 2

import unohelper
import uno
import json
import urllib.parse
import re
import os
import traceback
import platform

import helpers
import lxe_strings as ui
417
418
419
420
421
422
423

424
425
426
427
428
429
430
                # lFile = xFilePicker.getSelectedFiles()
                lFile = xFilePicker.getFiles()
                #print(lFile)
                #MessageBox(self.xDocument, "File(s): " + str(lFile), "DEBUG", INFOBOX)
                spfImported = lFile[0][5:].lstrip("/") # remove file://
                if platform.system() != "Windows":
                    spfImported = "/" + spfImported

        except:
            spfImported = os.path.join(os.path.expanduser("~"), "fr.__personal__.json") # workaround
        if spfImported and os.path.isfile(spfImported):
            with open(spfImported, "r", encoding="utf-8") as hDst:
                sJSON = hDst.read()
                try:
                    sTest = json.loads(sJSON)







>







418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
                # lFile = xFilePicker.getSelectedFiles()
                lFile = xFilePicker.getFiles()
                #print(lFile)
                #MessageBox(self.xDocument, "File(s): " + str(lFile), "DEBUG", INFOBOX)
                spfImported = lFile[0][5:].lstrip("/") # remove file://
                if platform.system() != "Windows":
                    spfImported = "/" + spfImported
                spfImported = urllib.parse.unquote(spfImported)
        except:
            spfImported = os.path.join(os.path.expanduser("~"), "fr.__personal__.json") # workaround
        if spfImported and os.path.isfile(spfImported):
            with open(spfImported, "r", encoding="utf-8") as hDst:
                sJSON = hDst.read()
                try:
                    sTest = json.loads(sJSON)
470
471
472
473
474
475
476

477
478
479
480
481
482
483
            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")
                sJSON = self.xOptionNode.getPropertyValue("personal_dic")
                if sJSON:
                    with open(spfExported, "w", encoding="utf-8") as hDst:
                        hDst.write(sJSON)
                    sMessage = ui.get('export_message') % spfExported
                else:







>







472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
            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 = urllib.parse.unquote(spfExported)
                #spfExported = os.path.join(os.path.expanduser("~"), "fr.personal.json")
                sJSON = self.xOptionNode.getPropertyValue("personal_dic")
                if sJSON:
                    with open(spfExported, "w", encoding="utf-8") as hDst:
                        hDst.write(sJSON)
                    sMessage = ui.get('export_message') % spfExported
                else: