def __init__(self, title): ui.View.__init__(self) self.title = u'%s' % title self.body = ui.Text() self.exit_key_handler = self.close cls = self.__class__ self.body.bind(cls.EKeyYes, self.switch2next) self.body.bind(cls.EKeySelect, lambda: self.body.add(u'\u2029')) cls.all.append(self)
#巧⑥ㄨ№【天堂】(16982589) #请随意按数字键!^o^ import appuifw2 as appuifw appuifw.app.body = m = appuifw.Text() def cn(x): return x.decode('utf-8') m.focus = False m.read_only = 1 m.set(cn("禁止输入\nForbidden")) txt = [ cn("星海&专业潜水员"), cn("木易东"), cn("Η♂ГОΛБ♀У"), cn("ENO==9527"), cn("八脚麒麟"), cn("笕℡十╱兵★卫╲"), cn("悠悠鱼o0"), cn("?流星?"), cn("№榀榀※"), cn("◇ζ蝴蝶ぢ"), cn("古枫"), cn("陈小睿") ]
appuifw2模块的使用 by明天见 #输入法的操作只对自带的有效 import appuifw2,e32 cn=lambda s : s.decode("utf-8") print appuifw2.query(cn("吃了吗?"),"query",ok=cn("吃了"),cancel=cn("没有")) #ok按键和cancel按键名称 text=appuifw2.Text(move_callback=None,edit_callback=None,scrollbar=1,skinned=1,word_wrap=0,t9=1,fixed_case=0) #move_callback光标移动事件 #edit_callback编辑事件,文本发生变化调用此功能 #scrollbar,右边的滚动条 #skinned,背景使用主题背景 #word_wrap暂时没弄清有何用 #t9,英文的自动组词模式开关 #fixed_case英文输入模式大小写开关1则只能输入大写字母 appuifw2.app.title=cn("你好") text.indicator_text=u"HELLO" #设置输入法左边的文字(默认输入法时显示) appuifw2.app.body=text #text.add(text.indicator_text) text.insert(0,cn("Hello,how are you?")) text.insert(len(text),u"test.") #插入字符 text.set_pos(len(text)) text.apply(pos=3,length=-2) text.set_selection(0,9) #(pos,anchor)设置已选字符
def __init__(mode=''): appuifw2.app.title=u'Speak' appuifw2.app.set_tabs([],None) if mode=='launch': sys.setdefaultencoding('u8') globalui.global_note(u'Thank You for downloading Speak.') global wrap,ans,scroll,no,syst,loc,t,sav,nae,pth,ext,ppb,com,qua,dela,log wrap=ans=scroll=1 no=syst=loc=sav=dela=0 nae=u'Screenshot' pth=u'D:\\' ext=u'.jpg' ppb=24 qua=100 com='no' log='Off' try: #try loading settings dic=ini.read('C:\\system\\apps\\Speak\\settings.ini') appuifw2.app.screen=dic['Dsize'] appuifw2.app.orientation=dic['Orient'] wrap=dic['Word'] ans=dic['Theme'] scroll=dic['Scroll'] sav=dic['Save'] appuifw2.app.body=t=appuifw2.Text(skinned=ans,scrollbar=scroll,word_wrap=wrap) t.set_limit(dic['Limit']) t.color=dic['Fcolor'] t.font=dic['Font'] t.style=dic['Style'] t.highlight_color=dic['Hcolor'] envy.set_app_system(dic['System']) sop.set(dic['Lock']) pth=dic['Path'] nae=dic['Name'] ext=dic['Format'] ppb=dic['Bpp'] qua=dic['Quality'] com=dic['Compress'] dela=dic['Delay'] log=dic['Log'] if log=='On': if os.path.exists('c:\\private\\ebf52663'): sys.stderr=open('c:\\private\\ebf52663\\ErrorLog.txt', 'a') elif os.path.exists('d:\\private\\ebf52663'): sys.stderr=open('d:\\private\\ebf52663\\ErrorLog.txt', 'a') elif os.path.exists('e:\\private\\ebf52663'): sys.stderr=open('e:\\private\\ebf52663\\ErrorLog.txt', 'a') elif os.path.exists('f:\\private\\ebf52663'): sys.stderr=open('f:\\private\\ebf52663\\ErrorLog.txt', 'a') else: sys.stderr=open('d:\\ErrorLog.txt','a') globalui.global_note(u'Installation folder does not exists! Errors will be logged temporarily.', 'error') if sav: t.set(dic['Text']) else: t.set(u'Type your text here and press seak from options.') except: #else set to defaults envy.set_app_system(0) sop.set(0) appuifw2.app.orientation='automatic' appuifw2.app.screen='normal' appuifw2.app.body=t=appuifw2.Text(u'Type your text here and press speak from options.',skinned=ans,scrollbar=scroll,word_wrap=wrap) else: appuifw2.app.body=t save_set() appuifw2.app.menu = [(u'Speak',((u'All', speak),(u'Selected', speak_selected),(u'Word',speak_word))), (u'Edit',((u'Clear', t.clear), (u'Copy', copy), (u'Cut', cut),(u'Paste', paste), (u'Select all', t.select_all),(u'Select none', t.clear_selection), (u'Undo', undo),(u'Clear Undo',t.clear_undo), (u'Clear Clipboard',clr_clip))), (u'Find',((u'Normal',find), (u'Replace',replace))), (u'Text',((u'Send text as SMS', send_msg),(u'Save as txt',save),(u'Read from file', read),(u'Read from messages',read_messages))), (u'Goto', ((u'Go to line',gtl), (u'Start', top), (u'Middle', mid), (u'End', end), (u'Line Start', lst), (u'Line End', led), (u'Next Page', npe), (u'Previous Page', ppe))), (u'Text Info', info), (u'Settings \xbb', setting), (u'TTS Settings', set_speech), (u'Download Languages',visit)] appuifw2.app.exit_key_text = u'Misc' appuifw2.app.menu_key_text= u'Menu' appuifw2.app.exit_key_handler = exit_handle t.bind(63552, read_messages) t.bind(63553, save) t.bind(63617, setting) t.bind(63557, speak) t.bind(63586, aw)
import appuifw2 as aw import sys aw.e32.ao_yield() sys.path.append('e:\\') sys.path.append('c:\\') import windows_menu def ru(text): return text.decode('utf-8') #------------------------- # function for an example of the menu: aw.app.body = body = aw.Text() body.font = 'normal' body.focus = False def func(t='function is called with no arguments'): body.set(ru(t)) aw.app.exit_key_handler = exit #------------------------- # the most important: def menu(): # tab within the tab:
s_9 = appuifw.popup_menu([ru('字母'), ru('数字'), ru('默认')], ru('输入模式')) if s_9 == None: return if s_9 == 0: s_45.set_input_mode(appuifw.EHalfWidthTextInputMode) if s_9 == 1: s_45.set_input_mode(appuifw.ENumericInputMode) if s_9 == 2: s_45.set_input_mode(appuifw.ENullInputMode) def edit_callback(pos, num): appuifw.app.title = ru('字数: ') + unicode(len(s_45.get())) s_45.indicator_text = unicode(len(s_45.get())) appuifw.app.body = s_45 = appuifw.Text(edit_callback=edit_callback, scrollbar=True) s_45.color = (0, 0, 255) s_45.font = ('dense', 18) appuifw.app.menu = [(ru('切换'), s_6), (ru('标记'), ((ru('全选'), s_1), (ru('自定'), s_2))), (ru('模板'), ((ru('复制'), s_7), (ru('剪切'), s_5), (ru('粘帖'), s_8)))] lock = e32.Ao_lock() appuifw.app.exit_key_handler = lock.signal lock.wait()
if i.title.lower().startswith(text) or \ self.double and \ i.subtitle.lower().startswith(text): self.lb.append(i) if self.lb: self.lb.set_current(0) self.lb.end_update() if __name__ == '__main__': '''Список аналогичный для Listbox2''' L = [] for i in zip(range(6), ('a', 'b', 'c', 'A', 'B', 'C')): L.append(appuifw2.Item(unicode(i[1]), subtitle=unicode(i[0]))) t = appuifw2.Text() def callback(): #select_callback index = lb.current() #индекс appuifw2.app.body = t t.add(L[index].title) t.add(unicode(index)) appuifw2.app.exit_key_handler = menu def menu(): lb.execute() appuifw2.app.exit_key_handler = lock.signal lb = ListBox(select_callback=callback, double=1) #экземпляр lb.execute(L) #активация lock = e32.Ao_lock()
import appuifw2, appuifw appuifw2.app.body = m = appuifw2.Text(skinned=1) def cn(x): return x.decode("utf-8") m.focus = False m.font = (u'Sans MT 936_s60', 16) m.color = (0) m.set(cn('很抱歉,未找到相关的方程式,您可以尝试交换物质AB的顺序')) appuifw.e32.Ao_lock().wait()