Skip to content

Commit

Permalink
Manual invocation of trust search (#738)
Browse files Browse the repository at this point in the history
Addresses slowness in search due to compounding search events by
changing the search bar behavior to only begin filtering when `Enter`
key is pressed instead of upon any key press.

The root cause of the slowness was multiple compounding search events
generated by the 150 millisecond keystroke delay. That is now eliminated
at the cost of having to press enter to initiate search.

Closes #684
  • Loading branch information
egbicker authored Mar 2, 2023
1 parent 3cb75f5 commit 90e1fea
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fapolicy_analyzer/glade/searchable_list.glade
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<property name="primary_icon_name">edit-find-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="primary_icon_sensitive">False</property>
<signal name="search-changed" handler="on_search_changed" swapped="no"/>
<signal name="activate" handler="on_search_activate" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
Expand Down
1 change: 1 addition & 0 deletions fapolicy_analyzer/tests/test_searchable_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def test_filtering(widget):
view = widget.get_object("treeView")
viewFilter = widget.get_object("search")
viewFilter.set_text("foo")
widget.on_search_activate()
refresh_gui(delay=0.3)
paths = [x[0] for x in view.get_model()]
assert "foo" in paths
Expand Down
2 changes: 1 addition & 1 deletion fapolicy_analyzer/ui/searchable_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,6 @@ def on_view_selection_changed(self, selection):
data = [model[i] for i in treeiter] if model and treeiter else []
self.selection_changed(data)

def on_search_changed(self, search):
def on_search_activate(self, *args):
self._store.refilter()
self._update_list_status(self._get_tree_count())

0 comments on commit 90e1fea

Please sign in to comment.