Overview
Comment: | [build][fx] build gc options for webextension, +panel ui update for options |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | build | fx | webext2 |
Files: | files | file ages | folders |
SHA3-256: |
5510b54076a1c21cbfa8c10833858602 |
User & Date: | olr on 2017-08-27 07:21:58 |
Other Links: | branch diff | manifest | tags |
Context
2017-08-27
| ||
09:19 | [fx] main panel ui adjustment check-in: 8c33d83d25 user: olr tags: fx, webext2 | |
07:21 | [build][fx] build gc options for webextension, +panel ui update for options check-in: 5510b54076 user: olr tags: build, fx, webext2 | |
05:06 | [fx] main panel ui update (add font-awesome) check-in: 6f222d4ea6 user: olr tags: fx, webext2 | |
Changes
Modified compile_rules.py from [c1af58c8e6] to [579060f9e8].
︙ | ︙ | |||
515 516 517 518 519 520 521 522 523 524 525 526 527 528 | lFinal.append([sOption, lTemp]) return lFinal def prepareOptions (lOptionLines): "returns a dictionary with data about options" sLang = "" lStructOpt = [] lOpt = [] dOptLabel = {} dOptPriority = {} for sLine in lOptionLines: sLine = sLine.strip() if sLine.startswith("OPTGROUP/"): | > | 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 | lFinal.append([sOption, lTemp]) return lFinal def prepareOptions (lOptionLines): "returns a dictionary with data about options" sLang = "" sDefaultUILang = "" lStructOpt = [] lOpt = [] dOptLabel = {} dOptPriority = {} for sLine in lOptionLines: sLine = sLine.strip() if sLine.startswith("OPTGROUP/"): |
︙ | ︙ | |||
537 538 539 540 541 542 543 544 545 546 547 548 549 550 | elif sLine.startswith("OPTPRIORITY/"): m = re.match("OPTPRIORITY/([a-z0-9]+): *([0-9])$", sLine) dOptPriority[m.group(1)] = int(m.group(2)) elif sLine.startswith("OPTLANG/"): m = re.match("OPTLANG/([a-z][a-z](?:_[A-Z][A-Z]|)):(.+)$", sLine) sLang = m.group(1)[:2] dOptLabel[sLang] = { "__optiontitle__": m.group(2).strip() } elif sLine.startswith("OPTLABEL/"): m = re.match("OPTLABEL/([a-z0-9]+):(.+)$", sLine) dOptLabel[sLang][m.group(1)] = list(map(str.strip, m.group(2).split("|"))) if "|" in m.group(2) else [m.group(2).strip(), ""] else: print("# Error. Wrong option line in:\n ") print(sLine) print(" options defined for: " + ", ".join([ t[0] for t in lOpt ])) | > > > | | 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 | elif sLine.startswith("OPTPRIORITY/"): m = re.match("OPTPRIORITY/([a-z0-9]+): *([0-9])$", sLine) dOptPriority[m.group(1)] = int(m.group(2)) elif sLine.startswith("OPTLANG/"): m = re.match("OPTLANG/([a-z][a-z](?:_[A-Z][A-Z]|)):(.+)$", sLine) sLang = m.group(1)[:2] dOptLabel[sLang] = { "__optiontitle__": m.group(2).strip() } elif sLine.startswith("OPTDEFAULTUILANG:"): m = re.match("OPTDEFAULTUILANG: *([a-z][a-z](?:_[A-Z][A-Z]|))$", sLine) sDefaultUILang = m.group(1)[:2] elif sLine.startswith("OPTLABEL/"): m = re.match("OPTLABEL/([a-z0-9]+):(.+)$", sLine) dOptLabel[sLang][m.group(1)] = list(map(str.strip, m.group(2).split("|"))) if "|" in m.group(2) else [m.group(2).strip(), ""] else: print("# Error. Wrong option line in:\n ") print(sLine) print(" options defined for: " + ", ".join([ t[0] for t in lOpt ])) dOptions = { "lStructOpt": lStructOpt, "dOptLabel": dOptLabel, "sDefaultUILang": sDefaultUILang } dOptions.update({ "dOpt"+k: v for k, v in lOpt }) return dOptions, dOptPriority def printBookmark (nLevel, sComment, nLine): print(" {:>6}: {}".format(nLine, " " * nLevel + sComment)) |
︙ | ︙ | |||
583 584 585 586 587 588 589 | else: print("Error in definition: ", end="") print(sLine.strip()) elif sLine.startswith("TEST:"): lTest.append("{:<8}".format(i) + " " + sLine[5:].strip()) elif sLine.startswith("TODO:"): pass | | | 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 | else: print("Error in definition: ", end="") print(sLine.strip()) elif sLine.startswith("TEST:"): lTest.append("{:<8}".format(i) + " " + sLine[5:].strip()) elif sLine.startswith("TODO:"): pass elif sLine.startswith(("OPTGROUP/", "OPTSOFTWARE:", "OPT/", "OPTLANG/", "OPTDEFAULTUILANG:", "OPTLABEL/", "OPTPRIORITY/")): lOpt.append(sLine) elif re.match("[ \t]*$", sLine): pass elif sLine.startswith("!!"): m = zBookmark.search(sLine) nExMk = len(m.group(0)) if sLine[nExMk:].strip(): |
︙ | ︙ |
Modified gc_lang/fr/build.py from [94ac224191] to [3334f6b510].
︙ | ︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | def createWebExtension (sLang, dVars): "create Web-extension" print("Building WebExtension") helpers.createCleanFolder("_build/webext/"+sLang) dir_util.copy_tree("gc_lang/"+sLang+"/webext/", "_build/webext/"+sLang) dir_util.copy_tree("grammalecte-js", "_build/webext/"+sLang+"/grammalecte") with helpers.cd("_build/webext/"+sLang): os.system("web-ext build") def createFirefoxExtension (sLang, dVars): "create extension for Firefox" print("Building extension for Firefox") helpers.createCleanFolder("_build/xpi/"+sLang) dir_util.copy_tree("gc_lang/"+sLang+"/xpi/", "_build/xpi/"+sLang) dir_util.copy_tree("grammalecte-js", "_build/xpi/"+sLang+"/grammalecte") | > > > > > > > > > > > > > > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | def createWebExtension (sLang, dVars): "create Web-extension" print("Building WebExtension") helpers.createCleanFolder("_build/webext/"+sLang) dir_util.copy_tree("gc_lang/"+sLang+"/webext/", "_build/webext/"+sLang) dir_util.copy_tree("grammalecte-js", "_build/webext/"+sLang+"/grammalecte") dVars['webextOptionsHTML'] = _createOptionsForWebExtension(dVars) helpers.copyAndFileTemplate("_build/webext/"+sLang+"/panel/main.html", "_build/webext/"+sLang+"/panel/main.html", dVars) with helpers.cd("_build/webext/"+sLang): os.system("web-ext build") def _createOptionsForWebExtension (dVars): sHTML = "" sLang = dVars['sDefaultUILang'] for sSection, lOpt in dVars['lStructOpt']: sHTML += f'\n<div id="subsection_{sSection}" class="opt_subsection">\n <h2 data-l10n-id="option_{sSection}">{dVars["dOptLabel"][sLang][sSection][0]}</h2>\n' for lLineOpt in lOpt: for sOpt in lLineOpt: sHTML += f' <p><input type="checkbox" id="option_{sOpt}" /><label id="option_label_{sOpt}" for="option_{sOpt}" data-l10n-id="option_{sOpt}">{dVars["dOptLabel"][sLang][sOpt][0]}</label></p>\n' sHTML += '</div>\n' return sHTML def createFirefoxExtension (sLang, dVars): "create extension for Firefox" print("Building extension for Firefox") helpers.createCleanFolder("_build/xpi/"+sLang) dir_util.copy_tree("gc_lang/"+sLang+"/xpi/", "_build/xpi/"+sLang) dir_util.copy_tree("grammalecte-js", "_build/xpi/"+sLang+"/grammalecte") |
︙ | ︙ | |||
50 51 52 53 54 55 56 | for lLineOpt in lOpt: for sOpt in lLineOpt: sHTML += ' <p><input type="checkbox" id="option_'+sOpt+'" /><label id="option_label_'+sOpt+'" for="option_'+sOpt+'" data-l10n-id="option_'+sOpt+'"></label></p>\n' sHTML += '</div>\n' # Creating translation data dProperties = {} for sLang in dVars['dOptLabel'].keys(): | | | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | for lLineOpt in lOpt: for sOpt in lLineOpt: sHTML += ' <p><input type="checkbox" id="option_'+sOpt+'" /><label id="option_label_'+sOpt+'" for="option_'+sOpt+'" data-l10n-id="option_'+sOpt+'"></label></p>\n' sHTML += '</div>\n' # Creating translation data dProperties = {} for sLang in dVars['dOptLabel'].keys(): dProperties[sLang] = "\n".join( [ "option_" + sOpt + " = " + dVars['dOptLabel'][sLang][sOpt][0].replace(" [!]", " [!]") for sOpt in dVars['dOptLabel'][sLang] ] ) return sHTML, dProperties def createThunderbirdExtension (sLang, dVars, spLangPack): "create extension for Thunderbird" print("Building extension for Thunderbird") sExtensionName = dVars['tb_identifier'] + "-v" + dVars['version'] + '.xpi' |
︙ | ︙ |
Modified gc_lang/fr/rules.grx from [0f44118652] to [d97de02612].
︙ | ︙ | |||
96 97 98 99 100 101 102 103 104 105 106 107 108 109 | OPT/latex: False False False False False False # Priority: from 0 to 9. Default priority is 4. OPTPRIORITY/tu: 6 OPTPRIORITY/conf: 5 OPTPRIORITY/ocr: 3 # Labels OPTLANG/fr_FR: Grammalecte (Français) OPTLABEL/basic: Typographie OPTLABEL/typo: Signes typographiques OPTLABEL/apos: Apostrophe typographique|Correction des apostrophes droites. Automatisme possible dans le menu Outils > Options d’autocorrection > Options linguistiques > Guillemets simples > Remplacer (à cocher) OPTLABEL/esp: Espaces surnuméraires|Signale les espaces inutiles entre les mots, en début et en fin de ligne. | > | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | OPT/latex: False False False False False False # Priority: from 0 to 9. Default priority is 4. OPTPRIORITY/tu: 6 OPTPRIORITY/conf: 5 OPTPRIORITY/ocr: 3 OPTDEFAULTUILANG: fr_FR # Labels OPTLANG/fr_FR: Grammalecte (Français) OPTLABEL/basic: Typographie OPTLABEL/typo: Signes typographiques OPTLABEL/apos: Apostrophe typographique|Correction des apostrophes droites. Automatisme possible dans le menu Outils > Options d’autocorrection > Options linguistiques > Guillemets simples > Remplacer (à cocher) OPTLABEL/esp: Espaces surnuméraires|Signale les espaces inutiles entre les mots, en début et en fin de ligne. |
︙ | ︙ |
Modified gc_lang/fr/webext/panel/main.css from [76f23fca76] to [f237fc22d0].
︙ | ︙ | |||
118 119 120 121 122 123 124 | overflow: auto; } #page h1 { margin: 0 0 10px 0; color: hsl(210, 70%, 70%); font: bold 30px 'Yanone Kaffeesatz', "Liberation Sans Narrow", sans-serif; } | < < < < < < | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | overflow: auto; } #page h1 { margin: 0 0 10px 0; color: hsl(210, 70%, 70%); font: bold 30px 'Yanone Kaffeesatz', "Liberation Sans Narrow", sans-serif; } /* Home */ #home_page { display: block; background-color: hsl(210, 20%, 92%); min-height: 100%; } #home_page #mainlogo { padding: 5px 20px 20px 20px; background-color: hsl(210, 20%, 96%); } #home_page .notice { margin-top: 5px; font-size: 12px; |
︙ | ︙ | |||
166 167 168 169 170 171 172 | /* Grammar checking options */ #gc_options_page { display: none; padding: 20px; | > > > > | > > > > > > > > > > > > > > > > > > > > > > > < < < | 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | /* Grammar checking options */ #gc_options_page { display: none; padding: 20px; } .opt_subsection { margin: 5px 0; padding: 10px; background-color: hsl(210, 20%, 92%); border-radius: 3px; } .opt_subsection h2 { color: hsl(210, 30%, 50%); margin-bottom: 3px; font-size: 16px; font-family: "Trebuchet MS", sans-serif; } .opt_subsection p { padding: 2px 3px; display: flex; align-items: center; } .opt_subsection p:hover { background-color: hsl(210, 20%, 86%); border-radius: 2px; } .opt_subsection label { flex: 1; font-size: 12px; } .opt_subsection input { order: 1 } /* Spell checking options */ #sc_options_page { display: none; padding: 20px; } #dictionaries_info { margin: 10px 0; padding: 10px; border-radius: 3px; background-color: hsl(0, 50%, 40%); color: hsl(0, 10%, 96%); } |
︙ | ︙ |
Modified gc_lang/fr/webext/panel/main.html from [7260f06aa5] to [88d7997a2b].
︙ | ︙ | |||
73 74 75 76 77 78 79 | <p><span class="key" data-l10n-id="keyCJ"></span> ❱ <span class="goto" data-l10n-id="keyLabelCJ"></span></p> </div> </section> <!-- #help_page --> <section id="gc_options_page" class="page"> <h1>OPTIONS GRAMMATICALES</h1> <div id="grammar_options"> | | | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | <p><span class="key" data-l10n-id="keyCJ"></span> ❱ <span class="goto" data-l10n-id="keyLabelCJ"></span></p> </div> </section> <!-- #help_page --> <section id="gc_options_page" class="page"> <h1>OPTIONS GRAMMATICALES</h1> <div id="grammar_options"> ${webextOptionsHTML} </div> <p class="center" style="margin: 10px 0;"><a id="default_options" href="#" onclick="return false;">Options par défaut</a></p> </section> <!-- #gc_options_page --> <section id="sc_options_page" class="page"> <h1>OPTIONS ORTHOGRAPHIQUES</h1> <div id="spelling_options"> |
︙ | ︙ |