Grammalecte  Check-in [13c026add9]

Overview
Comment:[tb] option for spelling selection
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tb | tbso
Files: files | file ages | folders
SHA3-256: 13c026add98a1d8cdda0a453008a399f3351abb137573575a9f56530272ab788
User & Date: olr on 2020-01-02 09:37:56
Other Links: branch diff | manifest | tags
Context
2020-01-20
10:16
merge trunk check-in: afed5163f0 user: olr tags: tbso
2020-01-02
09:37
[tb] option for spelling selection check-in: 13c026add9 user: olr tags: tb, tbso
09:21
[fr] dictionnaire 7.0: refonte du fichier des affixes, lemme féminin -> lemme masculin check-in: fed39fdd77 user: olr tags: trunk, fr, major_change
Changes

Modified gc_core/py/oxt/helpers.py from [c3e413f4e7] to [730b24becd].

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
        xContext.ServiceManager.createInstance("apso.python.script.organizer.impl")
        # now we can import apso_utils library
        from apso_utils import console
        console()
    except:
        try:
            xContext = uno.getComponentContext()
            xSvMgr = xContext.getServiceManager()
            xPathSettings = xSvMgr.createInstanceWithContext("com.sun.star.util.PathSettings", xContext)
            spPyInstallion = uno.fileUrlToSystemPath(xPathSettings.Module)
            subprocess.Popen(spPyInstallion + os.sep + "python")  # Start Python interactive Shell
        except:
            traceback.print_exc()


def xray (xObject):







<
|







17
18
19
20
21
22
23

24
25
26
27
28
29
30
31
        xContext.ServiceManager.createInstance("apso.python.script.organizer.impl")
        # now we can import apso_utils library
        from apso_utils import console
        console()
    except:
        try:
            xContext = uno.getComponentContext()

            xPathSettings = xContext.ServiceManager.createInstanceWithContext("com.sun.star.util.PathSettings", xContext)
            spPyInstallion = uno.fileUrlToSystemPath(xPathSettings.Module)
            subprocess.Popen(spPyInstallion + os.sep + "python")  # Start Python interactive Shell
        except:
            traceback.print_exc()


def xray (xObject):

Modified gc_lang/fr/mailext/content/overlay.js from [3152c4204d] to [fc3e43bc6f].

40
41
42
43
44
45
46








47
48
49
50
51
52
53
            this.xGCEWorker = new BasePromiseWorker('chrome://promiseworker/content/gce_worker.js');
            let that = this;
            let xPromise = this.xGCEWorker.post('loadGrammarChecker', [prefs.getCharPref("sGCOptions"), "Thunderbird"]);
            xPromise.then(
                function (aVal) {
                    console.log(aVal);
                    prefs.setCharPref("sGCOptions", aVal);








                    if (prefs.getBoolPref("bPersonalDictionary")) {
                        let sDicJSON = oFileHandler.loadFile("fr.personal.json");
                        if (sDicJSON) {
                            that.xGCEWorker.post('setDictionary', ["personal", sDicJSON]);
                        }
                    }
                },







>
>
>
>
>
>
>
>







40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
            this.xGCEWorker = new BasePromiseWorker('chrome://promiseworker/content/gce_worker.js');
            let that = this;
            let xPromise = this.xGCEWorker.post('loadGrammarChecker', [prefs.getCharPref("sGCOptions"), "Thunderbird"]);
            xPromise.then(
                function (aVal) {
                    console.log(aVal);
                    prefs.setCharPref("sGCOptions", aVal);
                    // spelling dictionary
                    if (prefs.getCharPref("sMainDicName")) {
                        let sMainDicName = prefs.getCharPref("sMainDicName");
                        if (sMainDicName == "fr-classic.json" || sMainDicName == "fr-reform.json") {
                            that.xGCEWorker.post("setDictionary", ["main", sMainDicName]);
                        }
                    }
                    // personal dictionary
                    if (prefs.getBoolPref("bPersonalDictionary")) {
                        let sDicJSON = oFileHandler.loadFile("fr.personal.json");
                        if (sDicJSON) {
                            that.xGCEWorker.post('setDictionary', ["personal", sDicJSON]);
                        }
                    }
                },

Modified gc_lang/fr/mailext/content/spell_options.css from [e88f1b0c74] to [618db9d4d2].

1
2
3
4
5
6
7
8
9
10
11
12
13










14
15
16
17
18
19
20
/* CSS */

#grouptitle {
	font-size: 16px;
	font-weight: bold;
	color: hsl(0, 50%, 50%);
}

.option {
	font-size: 16px;
	font-weight: bold;
	color: hsl(210, 50%, 50%);
}











description {
	width: 340px;
}

.dicdescr {
	margin-left: 27px;













>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* CSS */

#grouptitle {
	font-size: 16px;
	font-weight: bold;
	color: hsl(0, 50%, 50%);
}

.option {
	font-size: 16px;
	font-weight: bold;
	color: hsl(210, 50%, 50%);
}

.suboption {
    margin-left: 30px;
    font-size: 16px;
    font-weight: bold;
    color: hsl(210, 50%, 50%);
}
.suboption2 {
    margin-left: 30px;
}

description {
	width: 340px;
}

.dicdescr {
	margin-left: 27px;

Modified gc_lang/fr/mailext/content/spell_options.js from [2d7adbf6a9] to [c1f1aaa1bd].

10
11
12
13
14
15
16















17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33















34
35
36
37
38


var oDialogControl = {
    load: function () {
        try {
            // center window
            document.getElementById('grammalecte-spelloptions-window').centerWindowOnScreen();















            // Graphspell dictionaries
            document.getElementById('personal_dic').checked = prefs.getBoolPref('bPersonalDictionary');
            this.listen();
        }
        catch (e) {
            console.error(e);
        }
    },
    listen: function () {
        document.addEventListener("dialogaccept", (event) => {
            oDialogControl.setDictionaries();
        });
    },
    setDictionaries: function () {
        oSpellControl.init();
        this._setGraphspellDictionaries();
    },















    _setGraphspellDictionaries: function () {
        let bActivate = document.getElementById('personal_dic').checked;
        prefs.setBoolPref("bPersonalDictionary", bActivate);
    }
};







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|













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




10
11
12
13
14
15
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
47

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67


var oDialogControl = {
    load: function () {
        try {
            // center window
            document.getElementById('grammalecte-spelloptions-window').centerWindowOnScreen();
            // main spelling dictionary
            let sMainDicName = prefs.getCharPref('sMainDicName');
            console.log("spelling dictionary:", sMainDicName);
            if (sMainDicName == "fr-classic.json") {
                console.log("classic");
                document.getElementById("classic").checked = true;
            }
            else if (sMainDicName == "fr-reform.json") {
                console.log("reform");
                document.getElementById("reform").checked = true;
            }
            else if (sMainDicName == "fr-allvars.json") {
                console.log("allvars");
                document.getElementById("allvars").checked = true;
            }
            // personal dictionary
            document.getElementById('personal_dic').checked = prefs.getBoolPref('bPersonalDictionary');
            this.listen();
        }
        catch (e) {
            console.error(e);
        }
    },
    listen: function () {
        document.addEventListener("dialogaccept", (event) => {
            oDialogControl.setDictionaries();
        });
    },
    setDictionaries: function () {
        //oSpellControl.init();
        // main spelling dictionary

        let sMainDicName;
        if (document.getElementById("classic").checked) {
            console.log("classic");
            sMainDicName = "fr-classic.json";
        }
        else if (document.getElementById("reform").checked) {
            console.log("reform");
            sMainDicName = "fr-reform.json";
        }
        else if (document.getElementById("allvars").checked) {
            console.log("allvars");
            sMainDicName = "fr-allvars.json";
        }
        console.log("selected spelling dictionary:", sMainDicName);
        prefs.setCharPref("sMainDicName", sMainDicName);
        // personal dictionary
        let bActivate = document.getElementById('personal_dic').checked;
        prefs.setBoolPref("bPersonalDictionary", bActivate);
    }
};

Modified gc_lang/fr/mailext/content/spell_options.xul from [218f35c9f4] to [fb5553f523].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://grammarchecker/content/spell_options.css" type="text/css"?>

<!DOCTYPE dialog SYSTEM "chrome://grammarchecker/locale/spell_options.dtd">

<dialog
  id="grammalecte-spelloptions-window"
  title="&window.title;"
  orient="vertical"
  buttons="accept,cancel"
  width="400"
  height="300"
  onload="oDialogControl.load();"
  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

  <!-- Other elements go here -->

  <div class="dialogheader-title">&dialogheader.label;</div>













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://grammarchecker/content/spell_options.css" type="text/css"?>

<!DOCTYPE dialog SYSTEM "chrome://grammarchecker/locale/spell_options.dtd">

<dialog
  id="grammalecte-spelloptions-window"
  title="&window.title;"
  orient="vertical"
  buttons="accept,cancel"
  width="400"
  height="330"
  onload="oDialogControl.load();"
  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

  <!-- Other elements go here -->

  <div class="dialogheader-title">&dialogheader.label;</div>

37
38
39
40
41
42
43






44
45
46
47
48
49
50
51
52
53
54
55
56

    <groupbox with="380">
      <caption id="grouptitle" label="&grouptitle_graphspell;" />
      <description id="warning">&warning_graphspell;</description>

      <checkbox id="main_dic" class="option" label="&option.main_dic.label;" disabled="true" checked="true" />
      <description class="dicdescr">&option.main_dic.descr;</description>







      <checkbox id="community_dic" class="option disabled" label="&option.community_dic.label;" disabled="true" />
      <description class="dicdescr disabled">&option.community_dic.descr;</description>

      <checkbox id="personal_dic" class="option" label="&option.personal_dic.label;" />
      <description class="dicdescr">&option.personal_dic.descr;</description>
    </groupbox>
  </hbox>

  <script type="application/javascript" src="spell_options.js"/>
  <script type="application/javascript" src="spellchecker.js"/>

</dialog>







>
>
>
>
>
>













37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

    <groupbox with="380">
      <caption id="grouptitle" label="&grouptitle_graphspell;" />
      <description id="warning">&warning_graphspell;</description>

      <checkbox id="main_dic" class="option" label="&option.main_dic.label;" disabled="true" checked="true" />
      <description class="dicdescr">&option.main_dic.descr;</description>
      <label class="suboption" value="&option.main_dic.spelling;" />
      <radiogroup id="main_dic_name" class="suboption2" orient="horizontal">
        <radio id="classic" label="&option.main_dic.classic;" value="fr-classic.json" />
        <radio id="reform" label="&option.main_dic.reform;" value="fr-reform.json" />
        <radio id="allvars" label="&option.main_dic.allvars;" value="fr-allvars.json" />
      </radiogroup>

      <checkbox id="community_dic" class="option disabled" label="&option.community_dic.label;" disabled="true" />
      <description class="dicdescr disabled">&option.community_dic.descr;</description>

      <checkbox id="personal_dic" class="option" label="&option.personal_dic.label;" />
      <description class="dicdescr">&option.personal_dic.descr;</description>
    </groupbox>
  </hbox>

  <script type="application/javascript" src="spell_options.js"/>
  <script type="application/javascript" src="spellchecker.js"/>

</dialog>

Modified gc_lang/fr/mailext/defaults/preferences/grammarchecker.js from [1b1284d83a] to [8769787af8].

1
2
3
4
5
6
7
8
9
10
pref("extensions.grammarchecker.sGCOptions", "");
pref("extensions.grammarchecker.sTFOptions", "");
pref("extensions.grammarchecker.bDictModern", false);
pref("extensions.grammarchecker.bDictClassic", true);
pref("extensions.grammarchecker.bDictReform", false);
pref("extensions.grammarchecker.bDictClassicReform", false);
pref("extensions.grammarchecker.bCheckSignature", true);
pref("extensions.grammarchecker.bExtendedDictionary", false);
pref("extensions.grammarchecker.bCommunityDictionary", false);
pref("extensions.grammarchecker.bPersonalDictionary", true);







|


1
2
3
4
5
6
7
8
9
10
pref("extensions.grammarchecker.sGCOptions", "");
pref("extensions.grammarchecker.sTFOptions", "");
pref("extensions.grammarchecker.bDictModern", false);
pref("extensions.grammarchecker.bDictClassic", true);
pref("extensions.grammarchecker.bDictReform", false);
pref("extensions.grammarchecker.bDictClassicReform", false);
pref("extensions.grammarchecker.bCheckSignature", true);
pref("extensions.grammarchecker.sMainDicName", "fr-allvars.json");
pref("extensions.grammarchecker.bCommunityDictionary", false);
pref("extensions.grammarchecker.bPersonalDictionary", true);

Modified gc_lang/fr/mailext/gce_worker.js from [75d21bf0e4] to [3191c72f90].

351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
    if (!oSpellChecker) {
        postMessage(createResponse("setDictionary", "# Error. SpellChecker not loaded.", dInfo, true));
        return;
    }
    //console.log("setDictionary", sDictionary);
    switch (sDictionary) {
        case "main":
            oSpellChecker.setMainDictionary(oDict);
            break;
        case "community":
            oSpellChecker.setCommunityDictionary(oDict);
            break;
        case "personal":
            oSpellChecker.setPersonalDictionary(oDict);
            break;







|







351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
    if (!oSpellChecker) {
        postMessage(createResponse("setDictionary", "# Error. SpellChecker not loaded.", dInfo, true));
        return;
    }
    //console.log("setDictionary", sDictionary);
    switch (sDictionary) {
        case "main":
            oSpellChecker.setMainDictionary(oDict, dInfo["sExtPath"]+"/grammalecte/graphspell/_dictionaries");
            break;
        case "community":
            oSpellChecker.setCommunityDictionary(oDict);
            break;
        case "personal":
            oSpellChecker.setPersonalDictionary(oDict);
            break;

Modified gc_lang/fr/mailext/locale/en/spell_options.dtd from [d953b5f96a] to [fc8174b93b].

1
2
3
4
5
6
7




8
9
10
11
12
13
14
<!ENTITY window.title "Grammalecte · Spelling options">
<!ENTITY dialogheader.label "Spelling options">

<!ENTITY grouptitle_graphspell "Graphspell Dictionaries (Grammalecte)">
<!ENTITY warning_graphspell "These dictionaries are used only when analyzing texts.">
<!ENTITY option.main_dic.label "Main dictionary">
<!ENTITY option.main_dic.descr "About 83 000 entries, 500 000 flexions. Not editable, not deactivable.">




<!ENTITY option.community_dic.label "Community dictionary">
<!ENTITY option.community_dic.descr "Feature to come..">
<!ENTITY option.personal_dic.label "Personal dictionary">
<!ENTITY option.personal_dic.descr "The personal dictionary is created and edited via the lexicon editor.">

<!ENTITY grouptitle_hunspell "Hunspell Dictionaries (Thunderbird)">
<!ENTITY warning_hunspell "These dictionaries are only used when you are writing texts (red underlining). Select dictionaries you want to see in textareas list. Selected dictionaries are added instantly. Whereas unselected dictionnaries will be removed only at Thunderbird’s restart.">







>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!ENTITY window.title "Grammalecte · Spelling options">
<!ENTITY dialogheader.label "Spelling options">

<!ENTITY grouptitle_graphspell "Graphspell Dictionaries (Grammalecte)">
<!ENTITY warning_graphspell "These dictionaries are used only when analyzing texts.">
<!ENTITY option.main_dic.label "Main dictionary">
<!ENTITY option.main_dic.descr "About 83 000 entries, 500 000 flexions. Not editable, not deactivable.">
<!ENTITY option.main_dic.spelling "Spelling">
<!ENTITY option.main_dic.classic "Classic">
<!ENTITY option.main_dic.reform "Reform 1990">
<!ENTITY option.main_dic.allvars "All variants">
<!ENTITY option.community_dic.label "Community dictionary">
<!ENTITY option.community_dic.descr "Feature to come..">
<!ENTITY option.personal_dic.label "Personal dictionary">
<!ENTITY option.personal_dic.descr "The personal dictionary is created and edited via the lexicon editor.">

<!ENTITY grouptitle_hunspell "Hunspell Dictionaries (Thunderbird)">
<!ENTITY warning_hunspell "These dictionaries are only used when you are writing texts (red underlining). Select dictionaries you want to see in textareas list. Selected dictionaries are added instantly. Whereas unselected dictionnaries will be removed only at Thunderbird’s restart.">

Modified gc_lang/fr/mailext/locale/fr/spell_options.dtd from [f2b4df7a35] to [5ab4900b2b].

1
2
3
4
5
6
7




8
9
10
11
12
13
14
<!ENTITY window.title "Grammalecte · Options orthographiques">
<!ENTITY dialogheader.label "Options orthographiques">

<!ENTITY grouptitle_graphspell "Dictionnaires de Grammalecte">
<!ENTITY warning_graphspell "Ces dictionnaires ne sont utilisés que lors de l’analyse grammaticale.">
<!ENTITY option.main_dic.label "Dictionnaire principal">
<!ENTITY option.main_dic.descr "Environ 83 000 entrées, 500 000 flexions. Ni éditable, ni désactivable.">




<!ENTITY option.community_dic.label "Dictionnaire communautaire">
<!ENTITY option.community_dic.descr "Fonctionnalité à venir.">
<!ENTITY option.personal_dic.label "Dictionnaire personnel">
<!ENTITY option.personal_dic.descr "Le dictionnaire personnel est créé et édité via l’éditeur lexical.">

<!ENTITY grouptitle_hunspell "Dictionnaires Hunspell (Thunderbird)">
<!ENTITY warning_hunspell "Ces dictionnaires ne sont utilisés que lors de l’écriture de texte (soulignement rouge). Cochez les dictionnaires que vous voulez voir apparaître dans la liste des dictionnaires utilisables. L’ajout des dictionnaires se fait instantanément. En revanche, les dictionnaires ôtés ne disparaîtront qu’au redémarrage de Thunderbird.">







>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!ENTITY window.title "Grammalecte · Options orthographiques">
<!ENTITY dialogheader.label "Options orthographiques">

<!ENTITY grouptitle_graphspell "Dictionnaires de Grammalecte">
<!ENTITY warning_graphspell "Ces dictionnaires ne sont utilisés que lors de l’analyse grammaticale.">
<!ENTITY option.main_dic.label "Dictionnaire principal">
<!ENTITY option.main_dic.descr "Environ 83 000 entrées, 500 000 flexions. Ni éditable, ni désactivable.">
<!ENTITY option.main_dic.spelling "Orthographe">
<!ENTITY option.main_dic.classic "Classique">
<!ENTITY option.main_dic.reform "Réforme 1990">
<!ENTITY option.main_dic.allvars "Toutes variantes">
<!ENTITY option.community_dic.label "Dictionnaire communautaire">
<!ENTITY option.community_dic.descr "Fonctionnalité à venir.">
<!ENTITY option.personal_dic.label "Dictionnaire personnel">
<!ENTITY option.personal_dic.descr "Le dictionnaire personnel est créé et édité via l’éditeur lexical.">

<!ENTITY grouptitle_hunspell "Dictionnaires Hunspell (Thunderbird)">
<!ENTITY warning_hunspell "Ces dictionnaires ne sont utilisés que lors de l’écriture de texte (soulignement rouge). Cochez les dictionnaires que vous voulez voir apparaître dans la liste des dictionnaires utilisables. L’ajout des dictionnaires se fait instantanément. En revanche, les dictionnaires ôtés ne disparaîtront qu’au redémarrage de Thunderbird.">

Modified gc_lang/fr/mailext/worker/gce_worker.js from [086c0afb9f] to [abd0c9c4ba].

73
74
75
76
77
78
79
80
81
82
83
84
85

86
87
88
89

90
91
92
93
94
95
96
        }
        catch (e) {
            console.log("# Error: " + e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message);
        }
    }
}

function setDictionary (sTypeDic, sDicJSON) {
    try {
        console.log("set dictionary: " + sTypeDic);
        let oJSON = JSON.parse(sDicJSON);
        switch (sTypeDic) {
            case "extended":

                break;
            case "community":
                break;
            case "personal":

                oSpellChecker.setPersonalDictionary(oJSON);
                break;
            default:
                console.log("[GCE worker] unknown dictionary type");
        }
    }
    catch (e) {







|


<

|
>




>







73
74
75
76
77
78
79
80
81
82

83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
        }
        catch (e) {
            console.log("# Error: " + e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message);
        }
    }
}

function setDictionary (sTypeDic, sDictionary) {
    try {
        console.log("set dictionary: " + sTypeDic);

        switch (sTypeDic) {
            case "main":
                oSpellChecker.setMainDictionary(sDictionary);
                break;
            case "community":
                break;
            case "personal":
                let oJSON = JSON.parse(sDictionary);
                oSpellChecker.setPersonalDictionary(oJSON);
                break;
            default:
                console.log("[GCE worker] unknown dictionary type");
        }
    }
    catch (e) {