Grammalecte  Check-in [f604501c2d]

Overview
Comment:[lo] Lexicon editor: fix several issues, word count and message error
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | lo
Files: files | file ages | folders
SHA3-256: f604501c2d2b048bd85281543cb7513f0b3d319f5ec65011b732baa2b480c4de
User & Date: olr on 2021-03-04 18:19:54
Other Links: manifest | tags
Context
2021-03-05
10:14
[fr] v2.1.2 check-in: 8d70c5ae60 user: olr tags: trunk, fr, v2.1.2
2021-03-04
18:19
[lo] Lexicon editor: fix several issues, word count and message error check-in: f604501c2d user: olr tags: trunk, lo
18:06
[lo] Lexicon editor: fix message when exporting dictionary check-in: d7da56eb82 user: olr tags: trunk, lo
Changes

Modified gc_lang/fr/oxt/DictOptions/LexiconEditor.py from [827d8362b3] to [89035c1a7a].

386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
        sJSON = self.xOptionNode.getPropertyValue("personal_dic")
        if sJSON:
            try:
                self.oPersonalDicJSON = json.loads(sJSON)
                oIBDAWG = ibdawg.IBDAWG(self.oPersonalDicJSON)
                for i, aEntry in enumerate(oIBDAWG.select()):
                    xGridDataModel.addRow(i, aEntry)
                self.xNumLex.Label = str(i)
                self.xNumDic.Label = str(i)
                self.xDateDic.Label = oIBDAWG.sDate
            except:
                sMessage = ui.get('not_loaded')
                sMessage += traceback.format_exc()
                MessageBox(self.xDocument, sMessage, ui.get('load_title'), ERRORBOX)
        else:
            self.xNumLex.Label = 0







|
|







386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
        sJSON = self.xOptionNode.getPropertyValue("personal_dic")
        if sJSON:
            try:
                self.oPersonalDicJSON = json.loads(sJSON)
                oIBDAWG = ibdawg.IBDAWG(self.oPersonalDicJSON)
                for i, aEntry in enumerate(oIBDAWG.select()):
                    xGridDataModel.addRow(i, aEntry)
                self.xNumLex.Label = str(i+1)
                self.xNumDic.Label = str(i+1)
                self.xDateDic.Label = oIBDAWG.sDate
            except:
                sMessage = ui.get('not_loaded')
                sMessage += traceback.format_exc()
                MessageBox(self.xDocument, sMessage, ui.get('load_title'), ERRORBOX)
        else:
            self.xNumLex.Label = 0
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
            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)
                except:
                    sMessage = ui.get('wrong_json', "#err_msg: %s") % spfImported
                    MessageBox(self.xDocument, sMessage, ui.get('import_title'), ERRORBOX)
                else:
                    self.xOptionNode.setPropertyValue("personal_dic", sJSON)
                    self.xSettingNode.commitChanges()
                    self.loadLexicon()
        else:
            sMessage = ui.get('file_not_found', "#err_msg: %s") % spfImported
            MessageBox(self.xDocument, sMessage, ui.get('import_title'), ERRORBOX)

    @_waitPointer
    def saveLexicon (self):
        xGridDataModel = self.xGridModelLex.GridDataModel
        lEntry = []
        for i in range(xGridDataModel.RowCount):







|






|







425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
            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)
                except:
                    sMessage = ui.get('wrong_json') % spfImported
                    MessageBox(self.xDocument, sMessage, ui.get('import_title'), ERRORBOX)
                else:
                    self.xOptionNode.setPropertyValue("personal_dic", sJSON)
                    self.xSettingNode.commitChanges()
                    self.loadLexicon()
        else:
            sMessage = ui.get('file_not_found') % spfImported
            MessageBox(self.xDocument, sMessage, ui.get('import_title'), ERRORBOX)

    @_waitPointer
    def saveLexicon (self):
        xGridDataModel = self.xGridModelLex.GridDataModel
        lEntry = []
        for i in range(xGridDataModel.RowCount):