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
Ximper Linux
tuneit
Commits
d16e2560
Commit
d16e2560
authored
Jan 23, 2025
by
Roman Alifanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init RadioChoiceWidget
parent
ce83dad2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
0 deletions
+72
-0
RadioChoiceWidget.py
src/settings/widgets/RadioChoiceWidget.py
+70
-0
__init__.py
src/settings/widgets/__init__.py
+2
-0
No files found.
src/settings/widgets/RadioChoiceWidget.py
0 → 100644
View file @
d16e2560
from
gi.repository
import
Gtk
,
Adw
from
.BaseWidget
import
BaseWidget
class
RadioChoiceWidget
(
BaseWidget
):
def
create_row
(
self
):
main_box
=
Adw
.
PreferencesRow
()
content_box
=
Gtk
.
Box
(
orientation
=
Gtk
.
Orientation
.
VERTICAL
,
spacing
=
6
,
margin_top
=
8
,
margin_bottom
=
8
,
margin_start
=
12
,
margin_end
=
12
)
main_box
.
set_child
(
content_box
)
title_label
=
Gtk
.
Label
(
label
=
self
.
setting
.
name
,
halign
=
Gtk
.
Align
.
START
)
title_label
.
add_css_class
(
"heading"
)
content_box
.
append
(
title_label
)
if
self
.
setting
.
help
:
subtitle_label
=
Gtk
.
Label
(
label
=
self
.
setting
.
help
,
halign
=
Gtk
.
Align
.
START
,
wrap
=
True
,
margin_bottom
=
4
)
subtitle_label
.
add_css_class
(
"caption"
)
subtitle_label
.
add_css_class
(
"dim-label"
)
content_box
.
append
(
subtitle_label
)
radio_container
=
Gtk
.
Box
(
orientation
=
Gtk
.
Orientation
.
VERTICAL
,
spacing
=
4
)
content_box
.
append
(
radio_container
)
current_value
=
self
.
setting
.
_get_backend_value
()
group
=
None
# Создаем радио-кнопки
for
label
,
value
in
self
.
setting
.
map
.
items
():
radio
=
Gtk
.
CheckButton
(
label
=
label
,
halign
=
Gtk
.
Align
.
START
,
)
radio
.
set_active
(
value
==
current_value
)
if
group
:
radio
.
set_group
(
group
)
else
:
group
=
radio
radio
.
connect
(
"toggled"
,
self
.
_on_toggle
,
value
)
radio_container
.
append
(
radio
)
return
main_box
def
_on_toggle
(
self
,
button
,
value
):
if
button
.
get_active
():
self
.
setting
.
_set_backend_value
(
value
)
src/settings/widgets/__init__.py
View file @
d16e2560
from
.BooleanWidget
import
BooleanWidget
from
.ChoiceWidget
import
ChoiceWidget
from
.RadioChoiceWidget
import
RadioChoiceWidget
from
.EntryWidget
import
EntryWidget
from
.NumStepper
import
NumStepper
...
...
@@ -7,6 +8,7 @@ from .NumStepper import NumStepper
class
WidgetFactory
:
widget_map
=
{
'choice'
:
ChoiceWidget
,
'radiochoice'
:
RadioChoiceWidget
,
'boolean'
:
BooleanWidget
,
'entry'
:
EntryWidget
,
'number'
:
NumStepper
,
...
...
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