Commit c3784816 authored by Roman Alifanov's avatar Roman Alifanov

small fixes

parent cc174e2a
......@@ -13,13 +13,15 @@ class Setting:
self.backend = setting_data.get('backend')
self.key = setting_data.get('key')
self.default = setting_data.get('default')
if len(setting_data.get('gtype')) > 2:
self.gtype = setting_data.get('gtype')[0]
else:
self.gtype = setting_data.get('gtype')
self.gtype = setting_data.get('gtype', [])
self.map = setting_data.get('map', self._default_map())
self.data = setting_data.get('data', {})
if len(self.gtype) > 2:
self.gtype = self.gtype[0]
else:
self.gtype = self.gtype
def _default_map(self):
if self.type == 'boolean':
# Дефолтная карта для булевых настроек
......@@ -27,7 +29,10 @@ class Setting:
if self.type == 'choice':
# Дефолтная карта для выборов
map = {}
range = self._get_backend_range()[1]
range = self._get_backend_range()
if range is None:
return {}
for var in range:
print(var)
......@@ -35,7 +40,11 @@ class Setting:
return map
if self.type == 'number':
map = {}
range = self._get_backend_range()[1]
range = self._get_backend_range()
if range is None:
return {}
map["upper"] = range[1]
map["lower"] = range[0]
......
......@@ -31,7 +31,7 @@ class GSettingsBackend(Backend):
print(f"[DEBUG] Получение значения: schema={schema_name}, key={key_name}, gtype={gtype}")
try:
value = schema.get_range(key_name)
return value.unpack()
return value.unpack()[1]
except Exception as e:
print(f"[ERROR] Ошибка при получении значения {key}: {e}")
return None
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment