Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tuneit
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladimir Vaskov
tuneit
Commits
c3784816
Commit
c3784816
authored
Jan 13, 2025
by
Roman Alifanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small fixes
parent
cc174e2a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
+16
-7
__init__.py
src/settings/__init__.py
+15
-6
backends.py
src/settings/backends.py
+1
-1
No files found.
src/settings/__init__.py
View file @
c3784816
...
...
@@ -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
]
...
...
src/settings/backends.py
View file @
c3784816
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment