import appuifw import location import urllib # import messaging # 20041229 adapted from http://crschmidt.net/blog/archives/10/locative-technology/ # see http://www.kwark.org/x/cell # (3311 only works from .nl) class App: def save_data(self): #u = urllib.urlopen("http://crschmidt.net/cell/?n1=%s&n2=%s&l=%s&c=%s&com=%s"%(self.loc[0], self.loc[1], self.loc[2],self.loc[3], urllib.quote(self.form[0][2]))) #u.close() txt = u"cell " + unicode(location.gsm_location()) + u" " + self.form[0][2] nam = u"3311" nbr = "3311" if appuifw.query(u"Send " + txt + u" 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) def __init__(self): self.loc = location.gsm_location() self.loc_string = unicode(self.loc) fields = [(u'Comment', "text"), (u'Cell info', "text", self.loc_string)] self.form = appuifw.Form(fields, appuifw.FFormDoubleSpaced) self.form.menu = [(u'Send', self.save_data), (u'Update', self.update_form)] def run_form(self): self.form.execute() def update_form(self): self.loc = location.gsm_location() self.loc_string = unicode(self.loc) self.run_form() if __name__ == '__main__': app = App() app.__init__() app.run_form()