[ djpero.84 @ 16.10.2008. 09:13 ] @
Zna li neko zasto mi pola funkcija koje rade u Python skripti ne rade kad napravim sis od iste skripte? Kao sto je izlaz iz aplikacije ili sl. Code: import appuifw import e32 import sysinfo from time import ctime import globalui import codecs import inbox from audio import * from appuifw import * from e32socket import * def reboot(): #Reboots the phone by calling Starter.exe""" #Ask if the user wants to reboot or no if appuifw.query(u"Da li ste sigurni?", 'query'): #Reboots the device e32.start_exe(u'Z:\\System\\Programs\\Starter.exe', '', 0) def menu_1(): globalui.global_msg_query(unicode(sysinfo.battery())+u"%",u"Baterija") def menu_2(): globalui.global_msg_query(unicode(sysinfo.signal_bars())+u" podioka",u"Signal") def menu_3(): globalui.global_msg_query(sysinfo.imei(),u"IMEI") globalui.global_msg_query(sysinfo.sw_version(),u"Firmware") def menu_4(): globalui.global_msg_query(u"Pero Knezevic\[email protected]",u"Author") def menu_6(): reboot() def menu_5(): box = inbox.Inbox() msg = box.sms_messages() f = codecs.open('E:/Others/listSMS.txt', 'w', 'utf8') # open file in UTF8 for i in msg: f.write(box.address(i)) f.write('\n') f.write(ctime(box.time(i))) # convert seconds in a string f.write('\n') f.write(box.content(i)) f.write('\n-----------------------------------------------------\n') f.close() k = 'Z:\\data\\Sounds\\Digital\\Chat alert.aac' s = Sound.open(k) s.play() #appuifw.note(u"SMS-ovi smimljeni u fajl: 'e:/Others/listSMS.txt'", "info") try: phone = bt_obex_discover() addr=phone[0] port=phone[1].values()[0] file = u'E:\\Others\\listSMS.txt' bt_obex_send_file(addr, port , file) appuifw.note(u"Fajl je poslan!","info") except Exception, error: appuifw.note(unicode(error), "error") def menu_izlaz(): app_lock.signal() def exit_key_handler(): app_lock.signal() # define a callback function def shout(): index = lb.current() if index==0: menu_1() if index==1: menu_2() if index==2: menu_3() if index==3: menu_5() if index==4: menu_6() if index==5: menu_4() if index==6: menu_izlaz() entries = [u"Baterija",u"Signal",u"IMEI i firmware",u"Snimi&Posalji SMS-ove",u"Restart telefona",u"Autor",u"Izlaz"] lb = appuifw.Listbox(entries,shout) app_lock = e32.Ao_lock() appuifw.app.body = lb appuifw.app.title = u"s60 Info" appuifw.app.exit_key_handler = exit_key_handler app_lock.wait() |