hunspell_table.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:ibus-typing-booster 作者: mike-fabian 项目源码 文件源码
def set_current_imes(self, imes, update_dconf=True):
        '''Set current list of input methods

        :param imes: List of input methods
        :type imes: 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 imes == self._current_imes: # nothing to do
            return
        if len(imes) > self._current_imes_max:
            sys.stderr.write(
                'Trying to set more than the allowed maximum of %s '
                %self._current_imes_max
                + 'input methods.\n'
                + 'Trying to set: %s\n' %imes
                + 'Really setting: %s\n' %imes[:self._current_imes_max])
            imes = imes[:self._current_imes_max]
        if set(imes) != set(self._current_imes):
            # Input methods have been added or removed from the list
            # of current input methods. Initialize the
            # transliterators. If only the order of the input methods
            # has changed, initialising the transliterators is not
            # necessary (and neither is updating the transliterated
            # strings necessary).
            self._current_imes = imes
            self._init_transliterators()
        else:
            self._current_imes = imes
        self._update_preedit_ime_menu_dicts()
        self._init_or_update_property_menu_preedit_ime(
            self.preedit_ime_menu, current_mode=0)
        if not self.is_empty():
            self._update_ui()
        if self._remember_last_used_preedit_ime and update_dconf:
            self._config.set_value(
                self._config_section,
                'inputmethod',
                GLib.Variant.new_string(','.join(imes)))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号