[bug 559] Add menu autocomplete

Follwing errors were being thrown:

FAILED tests/test_prefseditor_keybindings.py::test_keybinding_successfully_reassigned_after_clearing[accel_params0] - AttributeError: 'TreeModelFilter' object has no attribute 'set'

It seems earlier the Gtk.ListStore()  was directly being passed in the test cases. After the changes to the Preferences to add a search filter bar we had added a filter Gtk.TreeModelFilter and for the widget we were setting it:
        widget.set_model(self.treemodelfilter)

Now it seemed that instead of Gtk.ListStore() the object Gtk.TreeModelFilter was being received and since it did not have a "set" function the above error was thrown.

I have made changes so that the Gtk.ListStore() is taken from Gtk.TreeModelFilter via get_model function and this indirection is removed.
This commit is contained in:
Vishweshwar Saran Singh Deo 2022-11-01 18:24:15 +05:30
parent fdcf8facf4
commit d08cee42ee

View File

@ -103,7 +103,8 @@ def test_message_dialog_is_shown_on_duplicate_accel_assignment(
)
widget = prefs_editor.builder.get_object("keybindingtreeview")
liststore = widget.get_model()
treemodelfilter = widget.get_model()
liststore = treemodelfilter.get_model()
# Replace default accelerator with a test one
prefs_editor.on_cellrenderer_accel_edited(
@ -150,7 +151,8 @@ def test_duplicate_accels_not_possible_to_set(accel_params):
)
widget = prefs_editor.builder.get_object("keybindingtreeview")
liststore = widget.get_model()
treemodelfilter = widget.get_model()
liststore = treemodelfilter.get_model()
binding = liststore.get_value(liststore.get_iter(path), 0)
all_default_accelerators = {
@ -231,7 +233,8 @@ def test_keybinding_edit_produce_expected_accels(
prefs_editor = prefseditor.PrefsEditor(term=term)
widget = prefs_editor.builder.get_object("keybindingtreeview")
liststore = widget.get_model()
treemodelfilter = widget.get_model()
liststore = treemodelfilter.get_model()
path = 0 # Edit the first listed key binding in `Preferences>Keybindings`
key, mods, hardware_keycode = input_key_params
@ -277,7 +280,8 @@ def test_keybinding_successfully_reassigned_after_clearing(accel_params):
prefs_editor = prefseditor.PrefsEditor(term=term)
widget = prefs_editor.builder.get_object("keybindingtreeview")
liststore = widget.get_model()
treemodelfilter = widget.get_model()
liststore = treemodelfilter.get_model()
path, key, mods, hardware_keycode = accel_params
# Assign a key binding