ScriptForge - (scriptforge.py) Dictionary class
The new SF_Dictionary class subclasses the dict native Python class
and implements 2 methods:
- ConvertToPropertyValues()
- ImportFromPropertyValues()
Usage:
dico = dict(A = 1, B = 2, C = 3)
myDict = CreateScriptService('Dictionary', dico) # Initialize myDict with the content of dico
myDict['D'] = 4
print(myDict) # {'A': 1, 'B': 2, 'C': 3, 'D': 4}
propval = myDict.ConvertToPropertyValues()
or, alternatively:
dico = dict(A = 1, B = 2, C = 3)
myDict = CreateScriptService('Dictionary') # Initialize myDict as an empty dict object
myDict.update(dico) # Load the values of dico into myDict
myDict['D'] = 4
print(myDict) # {'A': 1, 'B': 2, 'C': 3, 'D': 4}
propval = myDict.ConvertToPropertyValues()
Change-Id: I932e899062c39f3fe8ab05dcf3cd02acf2f060a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112488
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>