Grammalecte  Check-in [507372a50d]

Overview
Comment:[lo][bug] lexicon editor: USERPROFILE unknown on Linux
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | lo
Files: files | file ages | folders
SHA3-256: 507372a50d3753de562fb474c90d0c56cd35c2d8e2dc1c3c7e34cb2879e63351
User & Date: olr on 2018-04-14 17:31:14
Other Links: manifest | tags
Context
2018-04-14
19:38
[lo] lexicon editor: update + translations check-in: b9c72f6c5f user: olr tags: lo, trunk
17:31
[lo][bug] lexicon editor: USERPROFILE unknown on Linux check-in: 507372a50d user: olr tags: lo, trunk
17:28
[fr] pt: très bien/mal + correction d’un message check-in: fb7078506b user: olr tags: fr, trunk
Changes

Modified gc_lang/fr/oxt/DictOptions/LexiconEditor.py from [bbf80e041f] to [1cf16e149d].

382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
...
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
        #xFilePicker.setMultiSelectionMode(False)
        #nResult = xFilePicker.execute()
        #if nResult == 1:
        #    lFile = xFilePicker.getSelectedFiles()
        #    lFile = xFilePicker.getFiles()
        #    print(lFile)
        # workaround
        spfImported = os.path.join(os.environ['USERPROFILE'], "fr.personal.json")
        if os.path.isfile(spfImported):
            with open(spfImported, "r", encoding="utf-8") as hDst:
                sJSON = hDst.read()
                try:
                    sTest = json.loads(sJSON)
                except:
                    sMessage = self.dUI.get('wrong_json', "#err_msg: %s") % spfImported
................................................................................
            self.xOptionNode.setPropertyValue("personal_dic", "")
            self.xSettingNode.commitChanges()
            self.xNumDic.Label = "0"
            self.xDateDic.Label = self.dUI.get("void", "#err")

    def exportDictionary (self):
        try:
            spfExported = os.path.join(os.environ['USERPROFILE'], "fr.personal.json")    
            sJSON = self.xOptionNode.getPropertyValue("personal_dic")
            if sJSON:
                with open(spfExported, "w", encoding="utf-8") as hDst:
                    hDst.write(sJSON)
                sMessage = self.dUI.get('export_message', "#err_msg: %s") % spfExported
            else:
                sMessage = self.dUI.get('empty_dictionary', "#err")







|







 







|







382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
...
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
        #xFilePicker.setMultiSelectionMode(False)
        #nResult = xFilePicker.execute()
        #if nResult == 1:
        #    lFile = xFilePicker.getSelectedFiles()
        #    lFile = xFilePicker.getFiles()
        #    print(lFile)
        # workaround
        spfImported = os.path.join(os.path.expanduser("~"), "fr.personal.json")
        if os.path.isfile(spfImported):
            with open(spfImported, "r", encoding="utf-8") as hDst:
                sJSON = hDst.read()
                try:
                    sTest = json.loads(sJSON)
                except:
                    sMessage = self.dUI.get('wrong_json', "#err_msg: %s") % spfImported
................................................................................
            self.xOptionNode.setPropertyValue("personal_dic", "")
            self.xSettingNode.commitChanges()
            self.xNumDic.Label = "0"
            self.xDateDic.Label = self.dUI.get("void", "#err")

    def exportDictionary (self):
        try:
            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 = self.dUI.get('export_message', "#err_msg: %s") % spfExported
            else:
                sMessage = self.dUI.get('empty_dictionary', "#err")