From a4939f67f9de8275219e2cfcd3873e0fbe59058f Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Fri, 16 Jul 2021 13:08:02 +0900 Subject: [PATCH] setup: Enhance engine search function ibus-setup can search both the language names and input method names in the top language list but when you search a language keyword in the language list and move to the input method list after click the hit language name, any input methods could not be shown because the language didn't hit in any input method names. In this enhancement, ibus-setup can show the input methods to hit the language names. --- setup/enginedialog.py | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/setup/enginedialog.py b/setup/enginedialog.py index e1c322bf9..470f801c3 100644 --- a/setup/enginedialog.py +++ b/setup/enginedialog.py @@ -120,12 +120,26 @@ def __list_filter(self, row, data): return True if word in row.untrans.lower(): return True - if row.lang_info and row.name in self.__engines_for_lang: - for row_e in self.__engines_for_lang[row.name]: - if word in row_e.name.lower(): - return True - if word in row_e.untrans.lower(): - return True + # Search engine name in language list + if row.lang_info: + if row.name in self.__engines_for_lang.keys(): + for row_l in self.__engines_for_lang[row.name]: + if word in row_l.name.lower(): + return True + if word in row_l.untrans.lower(): + return True + # Search language name in engine list + if not row.lang_info: + for l in self.__engines_for_lang.keys(): + if word in l.lower(): + for row_l in self.__engines_for_lang[l]: + if row.name == row_l.name: + return True + for (trans, untrans) in self.__untrans_for_lang.items(): + if word in untrans.lower(): + for row_l in self.__engines_for_lang[trans]: + if row.name == row_l.name: + return True return False