Advertisement
Guest User

sms_gui

a guest
Jan 24th, 2010
642
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.01 KB | None | 0 0
  1. import messaging
  2. import appuifw,e32
  3.  
  4. def quit():
  5.     print "Thank you for using this service"
  6.            
  7. def send_error():
  8.     appuifw.note(u"Sending cancelled!!","error")   
  9.  
  10. def enter_phno():
  11.     ph=appuifw.query(u"Enter no.","text")
  12.     return ph
  13.    
  14. def enter_no():
  15.     n=appuifw.query(u"How many times do you want to send?","number")
  16.     return n
  17.    
  18. def enter_body():
  19.     body=appuifw.query(u"Enter the body of sms :","text",u"u r doomed...") 
  20.     return body
  21.    
  22. def check(n,ph):
  23.     q=appuifw.query(u"Send "+str(n)+" sms to "+str(ph)+"?","query")
  24.     return q
  25.  
  26. def send(n,ph,body):
  27.     for i in range(n):
  28.         messaging.sms_send(ph,str(body))
  29.     appuifw.note(u"Sms sent!!","conf")
  30.     print "Sms sent!!"
  31.        
  32.        
  33. appuifw.app.exit_key_handler = quit
  34. appuifw.app.title = u'SMS'
  35.  
  36. ph=enter_phno()
  37. if ph:
  38.     n=enter_no()
  39.     if n:
  40.         body=enter_body()
  41.         if body:
  42.             q=check(n,ph)
  43.             if q:
  44.                 send(n,ph,body)
  45.             else:
  46.                 send_error()
  47.                 quit()
  48.         else:
  49.             send_error()
  50.             quit()
  51.     else:
  52.         send_error()
  53.         quit()
  54. else:
  55.     send_error()
  56.     quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement