本文整理汇总了Python中backend.Backend.set_filter方法的典型用法代码示例。如果您正苦于以下问题:Python Backend.set_filter方法的具体用法?Python Backend.set_filter怎么用?Python Backend.set_filter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backend.Backend
的用法示例。
在下文中一共展示了Backend.set_filter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: InputPad
# 需要导入模块: from backend import Backend [as 别名]
# 或者: from backend.Backend import set_filter [as 别名]
#.........这里部分代码省略.........
punc_list = self.PUNC_MAP[self.punc_index]
self.textedit.textCursor().insertText( punc_list[index], self.textedit.normal_format )
self.textedit.ensureCursorVisible()
self.set_mode( self.MODE_NORMAL )
self.context_update()
elif code == self.KEYCODE_BACKSPACE :
self.set_mode( self.MODE_NORMAL )
self.context_update()
elif code == 1 :
self.punc_index = self.punc_index + 1
if self.punc_index < len( self.PUNC_MAP ) :
pass
else :
self.punc_index = 0
self.context_update()
elif self.mode == self.MODE_NAVIGATE :
if code == self.KEYCODE_NAVIGATE :
self.set_mode( self.MODE_NORMAL )
self.context_update()
elif code == 5 :
self.set_mode( self.MODE_NORMAL )
self.context_update()
elif code == 2 :
self.textedit.moveCursor( QtGui.QTextCursor.Up )
elif code == 8 :
self.textedit.moveCursor( QtGui.QTextCursor.Down )
elif code == 4 :
self.textedit.moveCursor( QtGui.QTextCursor.Left )
elif code == 6 :
self.textedit.moveCursor( QtGui.QTextCursor.Right )
elif code == self.KEYCODE_BACKSPACE :
self.textedit.textCursor().deletePreviousChar()
self.textedit.ensureCursorVisible()
elif self.mode == self.MODE_ROLLER :
if code >= 0 and code <= 9 :
self.roller.roll( code )
self.context_update()
#elif code == 1 :
#self.roller.stop()
elif code == self.KEYCODE_BACKSPACE :
if self.roller.code > 0 :
self.roller.cancel()
else :
self.textedit.textCursor().deletePreviousChar()
self.textedit.ensureCursorVisible()
self.context_update()
elif code == self.KEYCODE_MODE :
if self.roller.code > 0 :
self.roller.stop()
self.set_mode( self.MODE_NORMAL )
self.context_update()
elif self.mode == self.MODE_FILTER :
if code >= 1 and code <= 6 :
pinyin_index = self.pinyin_index + code - 1
if pinyin_index < ( self.pinyin_list ) :
self.backend.set_filter( self.pinyin_list[pinyin_index] )
self.backend.gen_cand_list()
self.set_mode( self.MODE_SELECT )
self.context_update()
elif code == 8 :
self.backend.set_filter( "" )
self.backend.gen_cand_list()
self.set_mode( self.MODE_SELECT )
self.context_update()
elif code == 7 :
if self.pinyin_index > 0 :
self.pinyin_index = self.pinyin_index - 6
self.context_update()
elif code == 9 :
if ( self.pinyin_index + 6 ) < len( self.pinyin_list ) :
self.pinyin_index = self.pinyin_index + 6
self.context_update()
@QtCore.Slot( int )
def slot_key_longpress( self, code ) :
if self.mode == self.MODE_NORMAL :
if code >= 0 and code <= 9 :
self.textedit.textCursor().insertText( str( code ), self.textedit.normal_format )
self.textedit.ensureCursorVisible()
elif self.mode == self.MODE_ROLLER :
if code >= 0 and code <= 9 :
if self.roller.code > 0 :
self.roller.stop()
self.textedit.textCursor().insertText( str( code ), self.textedit.normal_format )
self.textedit.ensureCursorVisible()
pass
def closeEvent( self, event ) :
if self.daemon_flag :
#self.setAttribute( QtCore.Qt.WA_Maemo5PortraitOrientation, True )
self.hide()
event.ignore()
if not self.portrait :
self.rotater.resize( 1, 1 )
self.rotater.show()
self.textedit.set_preedit( "" )
self.set_mode( self.MODE_NORMAL )
text = self.textedit.toPlainText()
self.request_commit.emit( text )
else :
event.accept()