print "Hello Kernighan and Ritchie!"
import appuifw
appuifw.app.title = u"Hello K and R"
appuifw.note(u"Hello Kernighan and Ritchie!", "info")
import appuifw
import e32
old_title = appuifw.app.title
appuifw.app.title = u"SMS sending"
class NumbersView:
def __init__(self, SMS_multiviewApp):
self.SMS_multiviewApp = SMS_multiviewApp
self.dict = [(u"Jim", "55512345"), (u"Jane", "55567890")]
self.names = [item[0] for item in self.dict]
self.numbers = [item[1] for item in self.dict]
self.numbers_list = appuifw.Listbox(self.names, self.handle_select)
self.index = None
appuifw.app.body = self.numbers_list
class ChoiceView:
def __init__(self, SMS_multiviewApp):
self.SMS_multiviewApp = SMS_multiviewApp
self.texts = [u"I am late",
u"What is for dinner?",
u"Do you need anything from the supermarket?",
u"How about a round of golf after work?"]
self.listbox = appuifw.Listbox(self.texts, self.handle_select)
def activate(self):
appuifw.app.body = self.listbox
appuifw.app.menu = [(u"Select", self.handle_select),
(u"Send", self.handle_send)]
def handle_select(self):
i = self.listbox.current()
appuifw.note(u"Selected: " + self.get_text(),"info")
def handle_send(self):
appuifw.app.activate_tab(3)
self.SMS_multiviewApp.handle_tab(3)
def get_text(self):
return self.texts[self.listbox.current()]
class SendView:
def __init__(self, SMS_multiviewApp):
self.SMS_multiviewApp = SMS_multiviewApp
self.log_text = appuifw.Text()
self.log_contents = u""
def activate(self):
self.log_text.set(self.log_contents)
appuifw.app.body = self.log_text
appuifw.app.menu = []
nbr = self.SMS_multiviewApp.get_number()
txt = self.SMS_multiviewApp.get_text()
nam = self.SMS_multiviewApp.get_name()
if appuifw.query(u"Send message to " + nam + "?", "query"):
t = u"Sent " + txt + " to " + nbr + " (" + nam + ")\n"
self.log_contents += t
self.log_text.add(t)
# messaging.sms_send(nbr, txt)
class SMS_multiviewApp:
def __init__(self):
self.lock = e32.Ao_lock()
appuifw.app.exit_key_handler = self.exit_key_handler
self.n_view = NumbersView(self)
self.c_view = ChoiceView(self)
self.t_view = TextView(self)
self.s_view = SendView(self)
self.views = [self.n_view, self.c_view, self.t_view, self.s_view]
appuifw.app.set_tabs([u"Numbers", u"Choice", u"Text", u"Send"],
self.handle_tab)
sock=socket.socket(socket.AF_BT,socket.SOCK_STREAM)
#좀더 빠른 시작을 위해서 연결할 주소와 포트는 여기에.
target="" #("00:20:e0:76:c3:52",1)
if not target:
address,services=socket.bt_discover()
print "Discovered: %s, %s"%(address,services)
if len(services)>1:
import appuifw
choices=services.keys()
choices.sort()
choice=appuifw.popup_menu(
[unicode(services[x])+": "+x for x in choices],u"Choose port:")
target=(address,services[choices[choice]])
else:
target=(address,services.values()[0])
print "Connecting to "+str(target)
sock.connect(target)
socketio=socket_stdio(sock)
realio=(sys.stdout,sys.stdin,sys.stderr)
(sys.stdout,sys.stdin,sys.stderr)=(socketio,socketio,socketio)
이전 글 : 액션스크립트 2.0 미리보기(2)
다음 글 : 윈도우 디스크 정리 팁
최신 콘텐츠