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
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
|
"""
Grammar checker default options
"""
# generated code, do not edit
# source: gc_core/py/lang_core/gc_options.py
import traceback
dOptions = {}
_sAppContext = "Python"
def load (sContext="Python"):
global dOptions
global _sAppContext
_sAppContext = sContext
dOptions = getDefaultOptions(sContext)
def setOption (sOpt, bVal):
"set option <sOpt> with <bVal> if it exists"
if sOpt in dOptions:
dOptions[sOpt] = bVal
def setOptions (dOpt):
"update the dictionary of options with <dOpt>"
for sKey, bVal in dOpt.items():
if sKey in dOptions:
dOptions[sKey] = bVal
def resetOptions ():
"set options to default values"
global dOptions
dOptions = getDefaultOptions()
def displayOptions (sLang="${lang}"):
"display the list of grammar checking options"
print("Options:")
print("\n".join( [ k+":\t"+str(v)+"\t"+getUI(sLang).get(k, ("?", ""))[0] for k, v in sorted(dOptions.items()) ] ))
print("")
def getUI (sLang):
"returns dictionary of UI labels"
if sLang in _dOptLabel:
return _dOptLabel[sLang]
return _dOptLabel["fr"]
def getDefaultOptions (sContext=""):
"returns dictionary of options"
if not sContext:
sContext = _sAppContext
if sContext in _dDefaultOpt:
|
>
|
>
>
>
>
>
|
|
|
|
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
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
|
"""
Grammar checker default options
"""
# generated code, do not edit
# source: gc_core/py/lang_core/gc_options.py
import traceback
dOptions = {}
_sAppContext = "Python"
def load (sContext="Python"):
global dOptions
global _sAppContext
_sAppContext = sContext
dOptions = getDefaultOptions(sContext)
def setOption (sOpt, bVal):
"set option <sOpt> with <bVal> if it exists"
if sOpt in dOptions:
dOptions[sOpt] = bVal
def setOptions (dOpt):
"update the dictionary of options with <dOpt>, only known options are updated"
for sKey, bVal in dOpt.items():
if sKey in dOptions:
dOptions[sKey] = bVal
def getOptions ():
"return a copy of options as dictionary"
return dOptions.copy()
def resetOptions ():
"set options to default values"
global dOptions
dOptions = getDefaultOptions()
def displayOptions (sLang="${lang}"):
"display the list of grammar checking options"
print("Options:")
print("\n".join( [ k+":\t"+str(v)+"\t"+getOptionLabels(sLang).get(k, ("?", ""))[0] for k, v in sorted(dOptions.items()) ] ))
print("")
def getOptionLabels (sLang="${sLang}"):
"returns dictionary of UI labels"
if sLang in _dOptLabel:
return _dOptLabel[sLang]
return _dOptLabel["${sLang}"]
def getDefaultOptions (sContext=""):
"returns dictionary of options"
if not sContext:
sContext = _sAppContext
if sContext in _dDefaultOpt:
|