unhighlight rows on change

This commit is contained in:
sezanzeb 2020-11-15 00:40:19 +01:00
parent 80bd7deacd
commit 14267283f3
2 changed files with 10 additions and 0 deletions

View File

@ -111,6 +111,10 @@ class Row(Gtk.ListBoxRow):
"""Mark this row as changed.""" """Mark this row as changed."""
self.get_style_context().add_class('changed') self.get_style_context().add_class('changed')
def unhighlight(self):
"""Mark this row as unchanged."""
self.get_style_context().remove_class('changed')
def on_character_input_change(self, entry): def on_character_input_change(self, entry):
keycode = self.get_keycode() keycode = self.get_keycode()
character = self.get_character() character = self.get_character()

View File

@ -170,6 +170,11 @@ class Window:
key_list.forall(key_list.remove) key_list.forall(key_list.remove)
custom_mapping.empty() custom_mapping.empty()
def unhighlight_all_rows(self):
"""Remove all rows from the mappings table."""
key_list = self.get('key_list')
key_list.forall(lambda row: row.unhighlight())
def on_apply_system_layout_clicked(self, button): def on_apply_system_layout_clicked(self, button):
"""Load the mapping.""" """Load the mapping."""
setxkbmap(self.selected_device, None) setxkbmap(self.selected_device, None)
@ -315,3 +320,4 @@ class Window:
) )
custom_mapping.changed = False custom_mapping.changed = False
self.unhighlight_all_rows()