Skip to content

Commit

Permalink
add callback
Browse files Browse the repository at this point in the history
  • Loading branch information
jardon committed Oct 1, 2024
1 parent e0711bc commit b17afa5
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions vanilla_first_setup/defaults/keyboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class KeyboardRow(Adw.ActionRow):
suffix_bin = Gtk.Template.Child()

def __init__(
self, title, subtitle, layout, variant, key, selected_keyboard, **kwargs
self, title, subtitle, layout, variant, key, selected_keyboard, toggled_callback, **kwargs
):
super().__init__(**kwargs)
self.__title = title
Expand All @@ -46,11 +46,7 @@ def __init__(
self.set_subtitle(subtitle)
self.suffix_bin.set_label(key)

self.select_button.connect("toggled", self.__on_check_button_toggled)

def __on_check_button_toggled(self, widget):
self.__selected_keyboard["layout"] = self.__layout
self.__selected_keyboard["variant"] = self.__variant
self.select_button.connect("toggled", toggled_callback, self)


@Gtk.Template(resource_path="/org/vanillaos/FirstSetup/gtk/default-keyboard.ui")
Expand Down Expand Up @@ -80,7 +76,6 @@ def __init__(self, window, distro_info, key, step, **kwargs):
self.selected_keyboard
)
for i, widget in enumerate(self.__keyboard_rows):
widget.select_button.connect("toggle", self.__keyboard_verify)
self.all_keyboards_group.append(widget)

# controllers
Expand Down Expand Up @@ -179,6 +174,7 @@ def __generate_keyboard_list_widgets(self, selected_keyboard):
keyboard_variant,
keyboard_key,
selected_keyboard,
self.__on_check_button_toggled,
)

if len(keyboard_widgets) > 0:
Expand Down Expand Up @@ -262,3 +258,8 @@ def __set_keyboard_layout(self, layout, variant=None):
@property
def step_id(self):
return self.__key

def __on_check_button_toggled(self, widget):
self.selected_keyboard["layout"] = self.widget.__layout
self.selected_keyboard["variant"] = self.widget.__variant
self.btn_next.set_sensitive(True)

0 comments on commit b17afa5

Please sign in to comment.