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
0d493f11
Commit
0d493f11
authored
Mar 12, 2025
by
Roman Alifanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
block signal handlers while changing widget value programmatically
parent
3bcfab63
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
BooleanWidget.py
src/settings/setting/widgets/BooleanWidget.py
+6
-1
ChoiceWidget.py
src/settings/setting/widgets/ChoiceWidget.py
+4
-1
No files found.
src/settings/setting/widgets/BooleanWidget.py
View file @
0d493f11
...
...
@@ -10,7 +10,7 @@ class BooleanWidget(BaseWidget):
valign
=
Gtk
.
Align
.
CENTER
,
halign
=
Gtk
.
Align
.
CENTER
,
)
self
.
switch
.
connect
(
"notify::active"
,
self
.
_on_boolean_toggled
)
self
.
handler_id
=
self
.
switch
.
connect
(
"notify::active"
,
self
.
_on_boolean_toggled
)
self
.
row
.
set_activatable_widget
(
self
.
switch
)
...
...
@@ -25,7 +25,10 @@ class BooleanWidget(BaseWidget):
def
_update_initial_state
(
self
):
current_value
=
self
.
setting
.
_get_backend_value
()
is_active
=
current_value
==
self
.
setting
.
map
.
get
(
True
)
with
self
.
switch
.
handler_block
(
self
.
handler_id
):
self
.
switch
.
set_active
(
is_active
)
self
.
_update_reset_visibility
()
def
update_display
(
self
):
...
...
@@ -41,6 +44,8 @@ class BooleanWidget(BaseWidget):
default_value
=
self
.
setting
.
map
.
get
(
self
.
setting
.
default
)
self
.
setting
.
_set_backend_value
(
default_value
)
with
self
.
switch
.
handler_block
(
self
.
handler_id
):
self
.
switch
.
set_active
(
self
.
setting
.
default
)
self
.
_update_reset_visibility
()
...
...
src/settings/setting/widgets/ChoiceWidget.py
View file @
0d493f11
...
...
@@ -16,7 +16,7 @@ class ChoiceWidget(BaseWidget):
self
.
_set_dropdown_width
(
items
)
self
.
_update_dropdown_selection
()
self
.
dropdown
.
connect
(
"notify::selected"
,
self
.
_on_choice_changed
)
self
.
handler_id
=
self
.
dropdown
.
connect
(
"notify::selected"
,
self
.
_on_choice_changed
)
control_box
=
Gtk
.
Box
(
spacing
=
6
,
orientation
=
Gtk
.
Orientation
.
HORIZONTAL
)
control_box
.
append
(
self
.
reset_revealer
)
...
...
@@ -32,6 +32,8 @@ class ChoiceWidget(BaseWidget):
def
_update_dropdown_selection
(
self
):
current_index
=
self
.
setting
.
_get_selected_row_index
()
with
self
.
dropdown
.
handler_block
(
self
.
handler_id
):
self
.
dropdown
.
set_selected
(
current_index
)
def
_set_dropdown_width
(
self
,
items
):
...
...
@@ -59,6 +61,7 @@ class ChoiceWidget(BaseWidget):
default_value
=
self
.
setting
.
_get_default_row_index
()
if
default_value
is
not
None
:
with
self
.
dropdown
.
handler_block
(
self
.
handler_id
):
self
.
dropdown
.
set_selected
(
default_value
)
self
.
setting
.
_set_backend_value
(
self
.
setting
.
default
)
...
...
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