Grammalecte  Check-in [cac2434abd]

Overview
Comment:[lo] lexicon editor: deal with empty dictionary
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | lo | multid
Files: files | file ages | folders
SHA3-256: cac2434abd0df7485e1515de9d067a533bcd30715767a1a1db86603ccd1bd954
User & Date: olr on 2018-03-21 08:07:04
Other Links: branch diff | manifest | tags
Context
2018-03-21
08:20
[fr][bug] conj_generator: correction: flexion vide si nCut = 0 check-in: 479b4f4cfb user: olr tags: fr, multid
08:07
[lo] lexicon editor: deal with empty dictionary check-in: cac2434abd user: olr tags: lo, multid
07:48
[fx] lexicon editor: deal with empty dictionary check-in: 019062699a user: olr tags: fx, multid
Changes

Modified gc_lang/fr/oxt/DictOptions/LexiconEditor.py from [1b519e944b] to [9c50f96337].

132
133
134
135
136
137
138
139
140
141
142
143
144
145
146

        nHeight = 10

        #### Dictionary section
        self._addWidget("dictionary_section", 'FixedLine', nX1, nY0, 180, nHeight, Label = self.dUI.get("dictionary_section", "#err"), FontDescriptor = xFDTitle, TextColor = 0x000088)
        self._addWidget("save_date_label", 'FixedText', nXB, nY0+2, 80, nHeight, Label = self.dUI.get("save_date_label", "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x000088)
        self._addWidget("num_of_entries_label2", 'FixedText', nXC, nY0+2, 65, nHeight, Label = self.dUI.get("num_of_entries_label", "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x000088)
        self.xDateDic = self._addWidget("save_date", 'FixedText', nXB+85, nY0+2, 75, nHeight, Label = "-", FontDescriptor = xFDSubTitle, TextColor = 0x000088)
        self.xNumDic = self._addWidget("num_of_entries2", 'FixedText', nXC+70, nY0+2, 45, nHeight, Label = "0", FontDescriptor = xFDSubTitle, TextColor = 0x000088)
        self.xExport = self._addWidget('export_button', 'Button', nXC+150, nY0, 50, 12, Label = self.dUI.get('export_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x005500)

        #### Add word
        self._addWidget("add_section", 'FixedLine', nX1, nY1, 180, nHeight, Label = self.dUI.get("add_section", "#err"), FontDescriptor = xFDTitle)
        self.xLemma = self._addWidget('lemma', 'Edit', nX1, nY1+10, 120, 14, FontDescriptor = xFDTitle)








|







132
133
134
135
136
137
138
139
140
141
142
143
144
145
146

        nHeight = 10

        #### Dictionary section
        self._addWidget("dictionary_section", 'FixedLine', nX1, nY0, 180, nHeight, Label = self.dUI.get("dictionary_section", "#err"), FontDescriptor = xFDTitle, TextColor = 0x000088)
        self._addWidget("save_date_label", 'FixedText', nXB, nY0+2, 80, nHeight, Label = self.dUI.get("save_date_label", "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x000088)
        self._addWidget("num_of_entries_label2", 'FixedText', nXC, nY0+2, 65, nHeight, Label = self.dUI.get("num_of_entries_label", "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x000088)
        self.xDateDic = self._addWidget("save_date", 'FixedText', nXB+85, nY0+2, 75, nHeight, Label = self.dUI.get("void", "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x000088)
        self.xNumDic = self._addWidget("num_of_entries2", 'FixedText', nXC+70, nY0+2, 45, nHeight, Label = "0", FontDescriptor = xFDSubTitle, TextColor = 0x000088)
        self.xExport = self._addWidget('export_button', 'Button', nXC+150, nY0, 50, 12, Label = self.dUI.get('export_button', "#err"), FontDescriptor = xFDSubTitle, TextColor = 0x005500)

        #### Add word
        self._addWidget("add_section", 'FixedLine', nX1, nY1, 180, nHeight, Label = self.dUI.get("add_section", "#err"), FontDescriptor = xFDTitle)
        self.xLemma = self._addWidget('lemma', 'Edit', nX1, nY1+10, 120, 14, FontDescriptor = xFDTitle)

321
322
323
324
325
326
327


328
329
330
331
332
333




334
335
336
337
338
339
340
341
342

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


        oDAWG = dawg.DAWG(lEntry, "S", "fr", "Français", "Dictionnaire personnel")
        oJSON = oDAWG.getBinaryAsJSON()
        xChild = self.xSettingNode.getByName("o_fr")
        xChild.setPropertyValue("personal_dic", json.dumps(oJSON, ensure_ascii=False))
        self.xSettingNode.commitChanges()
        self.xNumLex.Label = str(oJSON["nEntry"])




        self.xNumDic.Label = str(oJSON["nEntry"])
        self.xDateDic.Label = oJSON["sDate"]

    def _getRadioValue (self, *args):
        for x in args:
            if x.State:
                return x.HelpText
        return None








>
>
|
|
<
|
|
|
>
>
>
>
|
|







321
322
323
324
325
326
327
328
329
330
331

332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347

    @_waitPointer
    def saveLexicon (self):
        xGridDataModel = self.xGridModelLex.GridDataModel
        lEntry = []
        for i in range(xGridDataModel.RowCount):
            lEntry.append(xGridDataModel.getRowData(i))
        xChild = self.xSettingNode.getByName("o_fr")
        if lEntry:
            oDAWG = dawg.DAWG(lEntry, "S", "fr", "Français", "Dictionnaire personnel")
            oJSON = oDAWG.getBinaryAsJSON()

            xChild.setPropertyValue("personal_dic", json.dumps(oJSON, ensure_ascii=False))
            self.xSettingNode.commitChanges()
            self.xNumDic.Label = str(oJSON["nEntry"])
            self.xDateDic.Label = oJSON["sDate"]
        else:
            xChild.setPropertyValue("personal_dic", "")
            self.xSettingNode.commitChanges()
            self.xNumDic.Label = "0"
            self.xDateDic.Label = self.dUI.get("void", "#err")

    def _getRadioValue (self, *args):
        for x in args:
            if x.State:
                return x.HelpText
        return None

Modified gc_lang/fr/oxt/DictOptions/lxe_strings.py from [8c03183532] to [d7a0d062ca].

63
64
65
66
67
68
69

70
71
72
73
74
75
76
77
78
79
80
        "save_button": "Enregistrer",

        # Dictionary
        "dictionary_section": "Dictionnaire personnel",
        "save_date_label": "Date d’enregistrement :",
        "num_of_entries_label": "Nombre d’entrées :",
        "export_button": "Exporter",


        #
        "close_button": "Fermer",
    },
    # Traduction délibérément limitée
    "en": {
        "title": "Grammalecte · Lexical editor",
        
        "close_button": "Close",
    },
}







>






|




63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
        "save_button": "Enregistrer",

        # Dictionary
        "dictionary_section": "Dictionnaire personnel",
        "save_date_label": "Date d’enregistrement :",
        "num_of_entries_label": "Nombre d’entrées :",
        "export_button": "Exporter",
        "void": "[néant]",

        #
        "close_button": "Fermer",
    },
    # Traduction délibérément limitée
    "en": {
        "title": "Grammalecte · Lexicon editor",
        
        "close_button": "Close",
    },
}