def _table_mode_process_key_event (self, key):
        '''Xingma Mode Process Key Event'''
        cond_letter_translate = lambda (c): \
            self._convert_to_full_width (c) if self._full_width_letter [self._mode] else c
        cond_punct_translate = lambda (c): \
            self._convert_to_full_width (c) if self._full_width_punct [self._mode] else c

        if key.mask & modifier.RELEASE_MASK:
            return True
        if self._editor.is_empty ():
            # we have not input anything
            if key.code <= 127 and ( unichr(key.code) not in self._valid_input_chars ) \
                    and (not key.mask & modifier.ALT_MASK + modifier.CONTROL_MASK):
                if key.code == keysyms.space:
                    self.commit_string (cond_letter_translate (unichr (key.code)))
                    return True
                if ascii.ispunct (key.code):
                    self.commit_string (cond_punct_translate (unichr (key.code)))
                    return True
                if ascii.isdigit (key.code):
                    self.commit_string (cond_letter_translate (unichr (key.code)))
                    return True
            elif key.code > 127 :
                return False

        if key.code == keysyms.Escape:
            self.reset ()
            self._update_ui ()
            return True
        
        elif key.code in (keysyms.Return, keysyms.KP_Enter):
            commit_string = self._editor.get_all_input_strings ()
            self.commit_string (commit_string)
            return True
        
        elif key.code in (keysyms.Down, keysyms.KP_Down) :
            res = self._editor.arrow_down ()
            self._update_ui ()
            return res
        
        elif key.code in (keysyms.Up, keysyms.KP_Up):
            res = self._editor.arrow_up ()
            self._update_ui ()
            return res
        
        elif key.code in (keysyms.Left, keysyms.KP_Left) and key.mask & modifier.CONTROL_MASK:
            res = self._editor.control_arrow_left ()
            self._update_ui ()
            return res
        
        elif key.code in (keysyms.Right, keysyms.KP_Right) and key.mask & modifier.CONTROL_MASK:
            res = self._editor.control_arrow_right ()
            self._update_ui ()
            return res
        
        elif key.code in (keysyms.Left, keysyms.KP_Left):
            res = self._editor.arrow_left ()
            self._update_ui ()
            return res
        
        elif key.code in (keysyms.Right, keysyms.KP_Right):
            res = self._editor.arrow_right ()
            self._update_ui ()
            return res
        
        elif key.code == keysyms.BackSpace and key.mask & modifier.CONTROL_MASK:
            res = self._editor.control_backspace ()
            self._update_ui ()
            return res
        
        elif key.code == keysyms.BackSpace:
            res = self._editor.backspace ()
            self._update_ui ()
            return res
        
        elif key.code == keysyms.Delete  and key.mask & modifier.CONTROL_MASK:
            res = self._editor.control_delete ()
            self._update_ui ()
            return res
        
        elif key.code == keysyms.Delete:
            res = self._editor.delete ()
            self._update_ui ()
            return res

        elif key.code >= keysyms._1 and key.code <= keysyms._9 and self._editor._candidates[0] and key.mask & modifier.CONTROL_MASK:
            res = self._editor.number (key.code - keysyms._1)
            self._update_ui ()
            return res

        elif key.code >= keysyms._1 and key.code <= keysyms._9 and self._editor._candidates[0] and key.mask & modifier.ALT_MASK:
            res = self._editor.alt_number (key.code - keysyms._1)
            self._update_ui ()
            return res

        elif key.code == keysyms.space:
            self._editor._first = 0

            in_str = self._editor.get_all_input_strings()
            sp_res = self._editor.space ()
            #return (KeyProcessResult,whethercommit,commitstring)
            if sp_res[0]:
                if self._editor.is_down_press:
                    if sp_res[1]:
                        self._editor.is_down_press = False
                        self.commit_string (sp_res[1]+ " ")
                        self.db.check_phrase (sp_res[1], in_str)
                    else:
                        self.commit_string (in_str+ " ")
                        self.db.check_phrase (in_str, in_str)
                else:
                    if sp_res[1].lower() == in_str.lower():
                        self.commit_string (sp_res[1]+ " ")
                        self.db.check_phrase (sp_res[1], in_str)
                    else:
                        self.commit_string (in_str+ " ")
                        self.db.check_phrase (in_str, in_str)
            else:
                if sp_res[1] == u' ':
                    self.commit_string (cond_letter_translate (u" "))

            self._refresh_properties ()
            self._update_ui ()
            return True
        # now we ignore all else hotkeys
        elif key.mask & modifier.CONTROL_MASK+modifier.ALT_MASK:
            return False

        elif key.mask & modifier.ALT_MASK:
            return False

        elif unichr(key.code) in self._valid_input_chars or \
                (unichr(key.code) in u'[email protected]#$%' ):
            self._editor._first = 0
            if self._auto_commit and ( len(self._editor._chars[0]) == self._ml \
                    or len (self._editor._chars[0]) in self.db.pkeylens ):
                # it is time to direct commit
                sp_res = self._editor.space ()
                #return (whethercommit,commitstring)
                if sp_res[0]:
                    self.commit_string (sp_res[1])
                    #self.add_string_len(sp_res[1])
                    self.db.check_phrase (sp_res[1],sp_res[2])
                    
            res = self._editor.add_input ( unichr(key.code) )
            if not res:
                if ascii.ispunct (key.code):
                    key_char = cond_punct_translate (unichr (key.code))
                else:
                    key_char = cond_letter_translate (unichr (key.code))
                sp_res = self._editor.space ()
                #return (KeyProcessResult,whethercommit,commitstring)
                if sp_res[0]:
                    self.commit_string (sp_res[1] + key_char)
                    #self.add_string_len(sp_res[1])
                    self.db.check_phrase (sp_res[1],sp_res[2])
                    return True
                else:
                    self.commit_string ( key_char )
                    return True
            else:
                if self._auto_commit and self._editor.one_candidate () and \
                        (len(self._editor._chars[0]) == self._ml ):
                    return True

            self._update_ui ()
            return True
        
        elif key.code in self._page_down_keys \
                and self._editor._candidates[0]:
            res = self._editor.page_down()
            self._update_lookup_table ()
            return res

        elif key.code in self._page_up_keys \
                and self._editor._candidates[0]:
            res = self._editor.page_up ()
            self._update_lookup_table ()
            return res
        
        elif key.code >= keysyms._1 and key.code <= keysyms._9 and self._editor._candidates[0]:
            input_keys = self._editor.get_all_input_strings ()
            res = self._editor.number (key.code - keysyms._1)
            if res:
                commit_string = self._editor.get_preedit_strings ()
                self.commit_string (commit_string+ " ")
                self._refresh_properties ()
                self._update_ui ()
                # modify freq info
                self.db.check_phrase (commit_string, input_keys)
            return True
        
        elif key.code <= 127:
            if not self._editor._candidates[0]:
                commit_string = self._editor.get_all_input_strings ()
            else:
                self._editor.commit_to_preedit ()
                commit_string = self._editor.get_preedit_strings ()
            self._editor.clear ()
            if ascii.ispunct (key.code):
                self.commit_string ( commit_string + cond_punct_translate (unichr (key.code)))
            else:
                self.commit_string ( commit_string + cond_letter_translate (unichr (key.code)))
            return True
        return False