From b17afa5976e95c6791725f2c10b629b2943bf964 Mon Sep 17 00:00:00 2001 From: Jarred Wilson Date: Tue, 1 Oct 2024 15:46:18 +0000 Subject: [PATCH] add callback --- vanilla_first_setup/defaults/keyboard.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/vanilla_first_setup/defaults/keyboard.py b/vanilla_first_setup/defaults/keyboard.py index 961d8eb7..0a2f3655 100644 --- a/vanilla_first_setup/defaults/keyboard.py +++ b/vanilla_first_setup/defaults/keyboard.py @@ -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 @@ -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") @@ -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 @@ -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: @@ -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) \ No newline at end of file