Overview
Comment: | [tb] lexicon editor: update |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | tb | multid |
Files: | files | file ages | folders |
SHA3-256: |
d61338b1a89050b16403dd90dd48cd05 |
User & Date: | olr on 2018-03-18 17:27:35 |
Other Links: | branch diff | manifest | tags |
Context
2018-03-19
| ||
12:37 | [tb] store personal dictionary in file instead of preferences.js: create a file handler to simplify the mess check-in: 2d0855bb95 user: olr tags: tb, multid | |
2018-03-18
| ||
17:27 | [tb] lexicon editor: update check-in: d61338b1a8 user: olr tags: tb, multid | |
2018-03-17
| ||
16:51 | [tb] lexicon editor: useless import check-in: ebf940de4a user: olr tags: tb, multid | |
Changes
Modified gc_lang/fr/tb/content/lex_editor.css from [acf1557d56] to [2ca5e4943b].
1 2 3 4 5 6 7 8 9 | /* CSS */ /* Dictionary */ .dictionary { font-size: 18px; font-weight: bold; color: hsl(210, 50%, 50%); | < < < | < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | /* CSS */ /* Dictionary */ .dictionary { font-size: 18px; font-weight: bold; color: hsl(210, 50%, 50%); } .dic_text { font-size: 18px; color: hsl(210, 50%, 50%); } .align_right { text-align: right; } /* Add new words */ .section { |
︙ | ︙ | |||
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | } #generated_words_table { width: 400px; height: 600px; } /* Lexicon tab */ #lexicon_table { width: 600px; height: 650px; } .info_label { width: 120px; } .data { width: 90px; } | > > > > > | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | } #generated_words_table { width: 400px; height: 600px; } .delete_entry { color: hsl(0, 100%, 50%); font-weight: bold; } /* Lexicon tab */ #lexicon_table { width: 600px; height: 650px; } .info_label { width: 120px; } .data { width: 90px; } |
Modified gc_lang/fr/tb/content/lex_editor.js from [89f16a45e4] to [4b52ef9dfc].
︙ | ︙ | |||
63 64 65 66 67 68 69 | this.nEntry = 0 this._createHeader(); this.listen(); } _createHeader () { let xListheadNode = createNode("listhead"); | < < | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | this.nEntry = 0 this._createHeader(); this.listen(); } _createHeader () { let xListheadNode = createNode("listhead"); for (let sColumn of this.lColumn) { xListheadNode.appendChild(createNode("listheader", { label: sColumn })); } this.xTable.appendChild(xListheadNode); let xListcolsNode = createNode("listcols"); for (let cColumn of this.lColumnWidth) { xListcolsNode.appendChild(createNode("listcol", { flex: cColumn })); } this.xTable.appendChild(xListcolsNode); } clear () { |
︙ | ︙ | |||
111 112 113 114 115 116 117 | } this.nEntry += lFlex.length; this.showEntryNumber(); } showEntryNumber () { if (this.xNumEntry) { | | | < < > | > | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | } this.nEntry += lFlex.length; this.showEntryNumber(); } showEntryNumber () { if (this.xNumEntry) { this.xNumEntry.value = this.nEntry; } } _addRow (lData) { let xRowNode = createNode("listitem", { id: this.sNodeId + "_item_" + this.iEntryIndex, value: this.iEntryIndex }); for (let data of lData) { xRowNode.appendChild(createNode("listcell", { label: data })); } this.xTable.appendChild(xRowNode); this.iEntryIndex += 1; } listen () { this.xTable.addEventListener("click", (xEvent) => { this.onTableClick(xEvent); }, false); } onTableClick (xEvent) { try { let xElem = xEvent.target; console.log(xElem); if (xElem.className) { if (xElem.className.startsWith(this.sNodeId+"_item_")) { console.log("!"); this.deleteRow(xElem.value); } } } catch (e) { showError(e); } |
︙ | ︙ | |||
447 448 449 450 451 452 453 454 455 456 457 458 459 460 | let lEntry = []; for (let s of this.oIBDAWG.select()) { lEntry.push(s.split("\t")); } oLexiconTable.fill(lEntry); this.setDictData(this.oIBDAWG.nEntry, this.oIBDAWG.sDate); enableElement("export_button"); } }, setDictData: function (nEntries, sDate) { document.getElementById("dic_num_entries").value = nEntries; document.getElementById("dic_save_date").value = sDate; }, | > > | 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | let lEntry = []; for (let s of this.oIBDAWG.select()) { lEntry.push(s.split("\t")); } oLexiconTable.fill(lEntry); this.setDictData(this.oIBDAWG.nEntry, this.oIBDAWG.sDate); enableElement("export_button"); } else { disableElement("export_button"); } }, setDictData: function (nEntries, sDate) { document.getElementById("dic_num_entries").value = nEntries; document.getElementById("dic_save_date").value = sDate; }, |
︙ | ︙ | |||
471 472 473 474 475 476 477 | if (lEntry.length > 0) { let oDAWG = new DAWG(lEntry, "S", "fr", "Français", "Dictionnaire personnel", xProgressNode); let oJSON = oDAWG.createBinaryJSON(1); prefs.setCharPref("oPersonalDictionary", JSON.stringify(oJSON)); this.oIBDAWG = new IBDAWG(oJSON); this.setDictData(this.oIBDAWG.nEntry, this.oIBDAWG.sDate); //browser.runtime.sendMessage({ sCommand: "setDictionary", dParam: {sType: "personal", oDict: oJSON}, dInfo: {} }); | > | > > | > | 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 | if (lEntry.length > 0) { let oDAWG = new DAWG(lEntry, "S", "fr", "Français", "Dictionnaire personnel", xProgressNode); let oJSON = oDAWG.createBinaryJSON(1); prefs.setCharPref("oPersonalDictionary", JSON.stringify(oJSON)); this.oIBDAWG = new IBDAWG(oJSON); this.setDictData(this.oIBDAWG.nEntry, this.oIBDAWG.sDate); //browser.runtime.sendMessage({ sCommand: "setDictionary", dParam: {sType: "personal", oDict: oJSON}, dInfo: {} }); enableElement("export_button"); } else { prefs.setCharPref("oPersonalDictionary", ""); this.setDictData(0, "[néant]"); disableElement("export_button"); } }, import: function () { console.log("import"); }, export: function () { |
︙ | ︙ | |||
512 513 514 515 516 517 518 | } }); } } | | | | 516 517 518 519 520 521 522 523 524 525 526 527 528 | } }); } } const oLexiconTable = new Table("lexicon_table", ["Flexions", "Lemmes", "Étiquettes"], [10, 7, 10], "progress_lexicon", "num_entries"); const oGenWordsTable = new Table("generated_words_table", ["Flexions", "Étiquettes"], [1, 1], "progress_new_words"); oBinaryDict.load(); oBinaryDict.listen(); oGenerator.listen(); |
Modified gc_lang/fr/tb/content/lex_editor.xul from [9a4f4b9ece] to [121a38c9de].
︙ | ︙ | |||
14 15 16 17 18 19 20 | width="500" onload="document.getElementById('grammalecte-lexicon-editor-window').centerWindowOnScreen();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <!-- Other elements go here --> <hbox> <label class="dictionary" value="Dictionnaire personnel" /> | > | | > | | > | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | width="500" onload="document.getElementById('grammalecte-lexicon-editor-window').centerWindowOnScreen();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <!-- Other elements go here --> <hbox> <label class="dictionary" value="Dictionnaire personnel" /> <spacer flex="1" /> <label class="dic_text align_right" value="Enregistré le :" /> <label id="dic_save_date" class="dic_text" value="[néant]" /> <spacer flex="1" /> <label id="dic_num_entries" class="dic_text align_right" value="0" /> <label class="dic_text" value="entrées" /> <spacer flex="1" /> <button id="export_button" label="Exporter" /> </hbox> <tabbox id="tabs" selectedIndex="0"> <tabs> <tab label="&tab.editor.label;"/> <tab label="&tab.lexicon.label;"/> |
︙ | ︙ |