mirror of
https://github.com/altlinux/gpupdate.git
synced 2025-10-14 19:33:19 +03:00
Added the ability to query a dictionary across multiple dconf paths
This commit is contained in:
@@ -93,6 +93,9 @@ class Dconf_registry():
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_matching_keys(path):
|
def get_matching_keys(path):
|
||||||
|
if path[0] != '/':
|
||||||
|
path = '/' + path
|
||||||
|
|
||||||
try:
|
try:
|
||||||
process = subprocess.Popen(['dconf', 'list', path],
|
process = subprocess.Popen(['dconf', 'list', path],
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
||||||
@@ -176,13 +179,13 @@ class Dconf_registry():
|
|||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_dictionary_from_dconf(self, startswith):
|
def get_dictionary_from_dconf(self, *startswith_list):
|
||||||
output_dict = {}
|
output_dict = {}
|
||||||
dconf_dict = self.get_key_values(self.get_matching_keys(startswith))
|
for startswith in startswith_list:
|
||||||
|
dconf_dict = self.get_key_values(self.get_matching_keys(startswith))
|
||||||
for key, value in dconf_dict.items():
|
for key, value in dconf_dict.items():
|
||||||
keys_tmp = key.split('/')
|
keys_tmp = key.split('/')
|
||||||
output_dict.setdefault('/'.join(keys_tmp[0:-1])[1:], {})[keys_tmp[-1]] = value
|
update_dict(output_dict.setdefault('/'.join(keys_tmp[0:-1])[1:], {}), {keys_tmp[-1]: value})
|
||||||
|
|
||||||
return output_dict
|
return output_dict
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user