Grammalecte  Diff

Differences From Artifact [827d8362b3]:

To Artifact [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):