Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / uitest / libreoffice / uno / propertyvalue.py
blobce8622113a9af15d18d1658389496fb197d29725
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 try:
9 import uno
10 except ImportError:
11 print("pyuno not found: try to set PYTHONPATH and URE_BOOTSTRAP variables")
12 print("PYTHONPATH=/installation/opt/program")
13 print("URE_BOOTSTRAP=file:///installation/opt/program/fundamentalrc")
14 raise
16 def mkPropertyValue(name, value):
17 """ Create a UNO PropertyValue from two input values.
18 """
19 return uno.createUnoStruct("com.sun.star.beans.PropertyValue",
20 name, 0, value, 0)
22 def mkPropertyValues(vals):
23 """ Create UNO property values from a map.
24 """
25 return tuple([mkPropertyValue(name, value) for (name, value) in vals.items()])
27 def convert_property_values_to_dict(propMap):
28 """ Create a dictionary from a sequence of property values
29 """
30 ret = {}
31 for entry in propMap:
32 name = entry.Name
33 val = entry.Value
34 ret[name] = val
36 return ret
38 # vim: set shiftwidth=4 softtabstop=4 expandtab: