Skip to content

Commit

Permalink
Support substring matching in qube name text fields
Browse files Browse the repository at this point in the history
  • Loading branch information
alimirjamali committed Jul 1, 2024
1 parent 60b54a6 commit 0589ae8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion qrexec/tools/qrexec_policy_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,22 @@ def apply_model(
completion.set_inline_selection(True)
completion.set_inline_completion(True)
completion.set_popup_completion(True)
completion.set_popup_single_match(False)
completion.set_popup_single_match(True)
completion.set_model(list_store)
completion.set_text_column(1)

entry_box.set_completion(completion)

def qube_matching_function(completion: Gtk.EntryCompletion,
key: str,
iterator: Gtk.TreeIter,
user_data: object) -> bool:
# pylint: disable=unused-argument
modelstr = completion.get_model()[iterator][1]
return key.lower() in modelstr.lower()

completion.set_match_func(qube_matching_function, None)

if activation_trigger:
entry_box.connect(
"activate",
Expand Down

0 comments on commit 0589ae8

Please sign in to comment.