def set_dictionary_names(self, dictionary_names, update_dconf=True):
'''Set current dictionary names
:param dictionary_names: List of names of dictionaries to use
:type dictionary_names: List of strings
:param update_dconf: Whether to write the change to dconf.
Set this to False if this method is
called because the dconf key changed
to avoid endless loops when the dconf
key is changed twice in a short time.
:type update_dconf: boolean
'''
if dictionary_names == self._dictionary_names: # nothing to do
return
self._dictionary_names = dictionary_names
self.db.hunspell_obj.set_dictionary_names(dictionary_names)
if self._emoji_predictions:
if (not self.emoji_matcher
or
self.emoji_matcher.get_languages()
!= dictionary_names):
self.emoji_matcher = itb_emoji.EmojiMatcher(
languages=dictionary_names)
if not self.is_empty():
self._update_ui()
if update_dconf:
self._config.set_value(
self._config_section,
'dictionary',
GLib.Variant.new_string(','.join(dictionary_names)))
评论列表
文章目录