#Author: Gazetdinov A. aka _ALBERT_ #email: tarlovka@rambler.ru #site: www.mobi.ru import appuifw list_layout=[ u'EScreen', u'EApplicationWindow', u'EStatusPane', u'EMainPane', u'EControlPane', u'ESignalPane', u'EContextPane', u'ETitlePane', u'EBatteryPane', u'EUniversalIndicatorPane', u'ENaviPane', u'EFindPane', u'EWallpaperPane', u'EIndicatorPane', u'EAColumn', u'EBColumn', u'ECColumn', u'EDColumn', u'EStaconTop', u'EStaconBottom', u'EStatusPaneBottom', u'EControlPaneBottom', u'EControlPaneTop', u'EStatusPaneTop'] list_layout_appuifw=[ appuifw.EScreen, appuifw.EApplicationWindow, appuifw.EStatusPane, appuifw.EMainPane, appuifw.EControlPane, appuifw.ESignalPane, appuifw.EContextPane, appuifw.ETitlePane, appuifw.EBatteryPane, appuifw.EUniversalIndicatorPane, appuifw.ENaviPane, appuifw.EFindPane, appuifw.EWallpaperPane, appuifw.EIndicatorPane, appuifw.EAColumn, appuifw.EBColumn, appuifw.ECColumn, appuifw.EDColumn, appuifw.EStaconTop, appuifw.EStaconBottom, appuifw.EStatusPaneBottom, appuifw.EControlPaneBottom, appuifw.EControlPaneTop, appuifw.EStatusPaneTop] list_screen=[ u'normal', u'large', u'full'] list_orientation=[ u'avtomatic', u'portrait', u'landscape'] list_exit=[ u'\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u0435 \u0432\u044b\u0445\u043e\u0434 \u0438\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b?', u'\u0423\u0432\u0435\u0440\u0435\u043d\u044b \u0447\u0442\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0432\u044b\u0439\u0442\u0438?', u'\u0417\u0430\u043a\u0440\u044b\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0438\u043b\u0438 \u0432\u0441\u0435 \u0442\u0430\u043a\u0438 \u043d\u0435\u0442?', u'\u041d\u0430\u0436\u043c\u0438 OK \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043e\u0447\u0435\u043d\u044c \u0443\u0432\u0435\u0440\u0435\u043d.'] label_exit=list_exit[0] ############################################################### def app_layout(): global list_layout,list_layout_appuifw index=appuifw.popup_menu(list_layout, u'\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u043f\u0443\u043d\u043a\u0442:') if index>=0: try: tuple=appuifw.app.layout(list_layout_appuifw[index]) except: appuifw.query(u'\u041f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430! \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0443\u043d\u043a\u0442 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u0430\u0448\u0438\u043c \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043e\u043c.', 'query') else: appuifw.query(u'\u0412\u044b\u0441\u043e\u0442\u0430: '+unicode(tuple[0][0])+u'\n\u0428\u0438\u0440\u0438\u043d\u0430: '+unicode(tuple[0][1])+u'\n\u041a\u043e\u043e\u0440\u0434. X: '+unicode(tuple[1][0])+u'\n\u041a\u043e\u043e\u0440\u0434. Y: '+unicode(tuple[1][1]), 'query') def app_screen(): global list_screen index=appuifw.popup_menu(list_screen, u'\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u043e\u0440\u0438\u0435\u043d\u0442-\u0438\u0438:') if index>=0: appuifw.app.screen=str(list_screen[index]) def app_title(): title=appuifw.query(u'\u0418\u043c\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b:', 'text') if len(title)>=0: appuifw.app.title=title def app_oriention(): global list_orientation index=appuifw.popup_menu(list_orientation, u'\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u0430:') if index>=0: try: appuifw.app.orientation=str(list_orientation[index]) except: appuifw.query(u'\u041e\u0448\u0438\u0431\u043a\u0430! \u0412\u0430\u0448 \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u0434\u0430\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442.', 'query') def app_full_name(): appuifw.query(u'\u041f\u0443\u0442\u044c \u043a \u0444\u0430\u0439\u043b\u0443: '+appuifw.app.full_name(), 'query') def app_exit_key_handler(): global list_exit,label_exit index=appuifw.popup_menu(list_exit, u'\u0412\u0430\u0440\u0438\u0430\u043d\u0442 \u043d\u0430\u0434\u043f\u0438\u0441\u0438:') if index>=0: label_exit=list_exit[index] def app_uid(): appuifw.query(u'UID \u043f\u0440\u043e\u0433\u0440-\u043c\u044b: '+appuifw.app.uid(), 'query') app_menu_old=[] def app_menu_back(): global app_menu_old appuifw.app.menu=app_menu_old def app_menu(): global app_menu_old if appuifw.query(u'\u0421\u043a\u0440\u044b\u0442\u044c \u043c\u0435\u043d\u044e?' ,'query')==1: app_menu_old=appuifw.app.menu appuifw.app.menu=[(u'\u0412\u0435\u0440\u043d\u0443\u0442\u044c \u043c\u0435\u043d\u044e',app_menu_back)] ############################################################### list_note=[ u'info', u'error', u'conf'] list_query=[ u'text', u'code', u'number', u'float', u'date', u'time', u'query'] label_query=[ u'\u0442\u0435\u043a\u0441\u0442', u'\u043f\u0430\u0440\u043e\u043b\u044c', u'\u0447\u0438\u0441\u043b\u043e', u'\u0432\u0435\u0449-\u043e\u0435 \u0447\u0438\u0441\u043b\u043e', u'\u0434\u0430\u0442\u0443', u'\u0434\u0430\u0442\u0443'] list_selection=[ u'\u042f\u043d\u0432\u0430\u0440\u044c', u'\u0424\u0435\u0432\u0440\u0430\u043b\u044c', u'\u041c\u0430\u0440\u0442', u'\u0410\u043f\u0440\u0435\u043b\u044c', u'\u041c\u0430\u0439', u'\u0418\u044e\u043d\u044c', u'\u0418\u044e\u043b\u044c', u'\u0410\u0432\u0433\u0443\u0441\u0442', u'\u0421\u0435\u043d\u0442\u044f\u0431\u0440\u044c', u'\u041e\u043a\u0442\u044f\u0431\u0440\u044c', u'\u041d\u043e\u044f\u0431\u0440\u044c', u'\u0414\u0435\u043a\u0430\u0431\u0440\u044c'] ############################################################### def dialog_note(): global list_note index=appuifw.popup_menu(list_note, u'\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0442\u0438\u043f:') if index>=0: appuifw.note(u'\u0422\u0443\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435.', str(list_note[index])) def dialog_query(): global list_query,label_query index=appuifw.popup_menu(list_query, u'\u0412\u044b\u0431\u0435\u0440\u0438\u0442\u0435 \u0442\u0438\u043f:') if index>=0: if index==6: appuifw.query(u'\u0422\u0443\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435. \u041d\u0430\u0436\u043c\u0438 OK \u0435\u0441\u043b\u0438 \u0441\u043e\u0433\u043b\u0430\u0441\u0435\u043d, \u0438\u043d\u0430\u0447\u0435 \u041e\u0442\u043c\u0435\u043d\u0430.', 'query') else: appuifw.query(u'\u0412\u0432\u043e\u0434\u0438\u043c '+label_query[index]+':', str(list_query[index])) def dialog_multi_query(): appuifw.multi_query(u'\u041f\u0438\u0448\u0435\u043c \u0440\u0430\u0437:',u'\u041f\u0438\u0448\u0435\u043c \u0434\u0432\u0430:') def query_index(index): global list_selection if index>=0: if index==11 or index==0 or index==1: part=u'\u044d\u0438\u043c\u043d\u0438\u0439' elif index==2 or index==3 or index==4: part=u'\u0432\u0435\u0441\u0435\u043d\u043d\u0438\u0439' elif index==5 or index==6 or index==7: part=u'\u043b\u0435\u0442\u043d\u0438\u0439' elif index==8 or index==9 or index==10: part=u'\u043e\u0441\u0435\u043d\u043d\u0438\u0439' appuifw.query(u'\u0422\u044b \u0432\u044b\u0431\u0440\u0430\u043b '+list_selection[index]+u'. \u042d\u0442\u043e '+part+u' \u043c\u0435\u0441\u044f\u0446.', 'query') def dialog_popup_menu(): global list_selection index=appuifw.popup_menu(list_selection, u'\u0412\u044b\u0431\u0435\u0440\u0438 \u043c\u0435\u0441\u044f\u0446.') query_index(index) def dialog_selection_list(): global list_selection index=appuifw.selection_list(list_selection, 1) query_index(index) def dialog_multi_selection_list(): global list_selection index=appuifw.multi_selection_list(list_selection, search_field=1) appuifw.query(u'\u0418\u043d\u0434\u0435\u043a\u0441\u044b: '+unicode(index), 'query') ############################################################### def exit(): global label_exit if appuifw.query(label_exit, 'query') == 1: appuifw.app.set_exit() def available_fonts(): fonts=appuifw.available_fonts() index=appuifw.popup_menu(fonts, u'\u0412\u0441\u0435 \u0448\u0440\u0438\u0444\u0442\u044b:') if index>=0: argument=appuifw.query(u'\u0412\u044b \u0432\u044b\u0431\u0440\u0430\u043b\u0438 \u0448\u0440\u0438\u0444\u0442: '+fonts[index]+u'. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0435\u0433\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c?', 'query') if argument==1: appuifw.query(u'\u041e\u0439! \u042f \u0437\u0430\u0431\u044b\u043b \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0448\u0440\u0438\u0444\u0442\u044b Python \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043d\u0435 \u043c\u043e\u0436\u0435\u0442.', 'query') ############################################################### menu_dialog=( (u'note', dialog_note), (u'query', dialog_query), (u'multi_query', dialog_multi_query), (u'popup_menu', dialog_popup_menu), (u'selection_list', dialog_selection_list), (u'multi_selection_list', dialog_multi_selection_list)) menu_app=( (u'layout', app_layout), (u'screen', app_screen), (u'title', app_title), (u'oriention', app_oriention), (u'full_name', app_full_name), (u'exit_key_handler', app_exit_key_handler), (u'uid', app_uid), (u'menu', app_menu)) menu=[ (u'\u041e\u0431\u044a\u0435\u043a\u0442 app', menu_app), (u'\u0414\u0438\u0430\u043b\u043e\u0433\u043e\u0432\u044b\u0435', menu_dialog), (u'\u0421\u043f\u0438\u0441\u043e\u043a \u0448\u0440\u0438\u0444\u0442\u043e\u0432', available_fonts), (u'\u0412\u044b\u0439\u0442\u0438', exit)] ############################################################### appuifw.app.menu=menu appuifw.app.title=u'Interface' appuifw.app.exit_key_handler=exit import e32 e32.Ao_lock().wait()