Logo Search packages:      
Sourcecode: ibus-table version File versions  Download package

def table::editor::ap_candidate (   self,
  candi 
)

append candidate to lookup_table

Definition at line 424 of file table.py.

00424                                   :
        '''append candidate to lookup_table'''
        if not self._py_mode:
            _p_index = self.get_index('phrase')
            _fkey = self.get_index('m0')
        else:
            _p_index = 8
            _fkey = 1
        if self.db._is_chinese:
            _tbks = u''.join( map(self._deparser , candi[_fkey + len(self._tabkey_list) : _p_index-1 ] ) )
            if self._py_mode:
                # restore tune symbol
                _tbks = _tbks.replace('!','↑1').replace('@','↑2').replace('#','↑3').replace('$','↑4').replace('%','↑5')
        else:
            _tbks = u''.join( map(self._deparser , candi[_fkey + len(self._tabkey_list) : _p_index ] ) )
        _phrase = candi[_p_index]
        # further color implementation needed :)
        # here -2 is the pos of num, -1 is the pos of . 0 is the pos of string
        #attrs = ibus.AttrList ([ibus.AttributeForeground (0x8e2626, -2, 1)])
        attrs = ibus.AttrList ()
        # this is the part of tabkey
        attrs.append( ibus.AttributeForeground ( 0x1973a2, 0, \
            len(_phrase) + len(_tbks)))
        if candi[-2] < 0:
            # this is a user defined phrase:
            attrs.append ( ibus.AttributeForeground (0x7700c3, 0, len(_phrase)) )
        elif candi[-1] > 0:
            # this is a sys phrase used by user:
            attrs.append ( ibus.AttributeForeground (0x000000, 0, len(_phrase)) )
        else:
            # this is a system phrase haven't been used:
            attrs.append ( ibus.AttributeForeground (0x000000, 0, len(_phrase)) )
        self._lookup_table.append_candidate ( _phrase + _tbks, attrs )
        self._lookup_table.show_cursor (False)

    def filter_candidates (self, candidates):


Generated by  Doxygen 1.6.0   Back to index