1
0
mirror of https://github.com/altlinux/gpupdate.git synced 2025-03-21 18:50:38 +03:00

glib_map function to convert Python data to GLib (GSettings) type system

This commit is contained in:
Игорь Чудов 2020-07-13 15:59:10 +04:00
parent 63e7dab1ee
commit ace949d4ec
Signed by untrusted user: nir
GPG Key ID: 0F3883600CAE7AAC

View File

@ -46,6 +46,16 @@ class system_gsetting:
with open(self.file_path, 'w') as f:
config.write(f)
def glib_map(value, glib_type):
result_value = value
if glib_type == 'i':
result_value = GLib.Variant(glib_type, int(value))
else:
result_value = GLib.Variant(glib_type, value)
return result_value
class user_gsetting:
def __init__(self, schema, path, value):
self.schema = schema