diff options
author | fujiwarat <takao.fujiwara1@gmail.com> | 2021-07-16 13:08:02 +0900 |
---|---|---|
committer | fujiwarat <takao.fujiwara1@gmail.com> | 2021-07-16 13:08:02 +0900 |
commit | a4939f67f9de8275219e2cfcd3873e0fbe59058f (patch) | |
tree | e9588d6a8afd1e0cc6fb284ee20605846b2ea19f | |
parent | b952d30a1b7c741052c168fe1081ecb4d4b1c034 (diff) | |
download | ibus-a4939f67f9de8275219e2cfcd3873e0fbe59058f.tar.gz |
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.
-rw-r--r-- | setup/enginedialog.py | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/setup/enginedialog.py b/setup/enginedialog.py index e1c322bf..470f801c 100644 --- a/setup/enginedialog.py +++ b/setup/enginedialog.py @@ -120,12 +120,26 @@ class EngineDialog(Gtk.Dialog): 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 |