def set_emoji_prediction_mode(self, mode, update_dconf=True):
'''Sets the emoji prediction mode
:param mode: Whether to switch emoji prediction on or off
:type mode: boolean
: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 DEBUG_LEVEL > 1:
sys.stderr.write(
"set_emoji_prediction_mode(%s, update_dconf = %s)\n"
%(mode, update_dconf))
if mode == self._emoji_predictions:
return
self._emoji_predictions = mode
self._init_or_update_property_menu(
self.emoji_prediction_mode_menu, mode)
if (self._emoji_predictions
and (not self.emoji_matcher
or
self.emoji_matcher.get_languages()
!= self._dictionary_names)):
self.emoji_matcher = itb_emoji.EmojiMatcher(
languages=self._dictionary_names)
self._update_ui()
if update_dconf:
self._config.set_value(
self._config_section,
'emojipredictions',
GLib.Variant.new_boolean(mode))
评论列表
文章目录