From: NeilBrown Date: Thu, 12 Dec 2013 21:55:53 +0000 (+1100) Subject: sms: remove some white space X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=625a8c60f2a3d70d307a887f3149a56b73f4ddab;p=plato.git sms: remove some white space --- diff --git a/sms/sendsms.py b/sms/sendsms.py index 748abef..bdacecd 100755 --- a/sms/sendsms.py +++ b/sms/sendsms.py @@ -31,11 +31,11 @@ # Somehow senders can be configured. # e.g. sms-exetel needs username, password, sender strings. # press-and-hold on the send button allows a sender to be selected. -# +# # # Send an SMS message using some backend. -# +# # # TODO: # 'del' to return to 'list' view @@ -57,7 +57,7 @@ # new message becomes non-new when replied to # '' button doesn't select, but just makes choice. # 'new' becomes 'select' when has been pressed. -# DONE Start in 'read', preferrably 'new' +# DONE Start in 'read', preferrably 'new' # DONE always report status from send # DONE draft/new/recv/sent/all - 5 groups # DONE allow scrolling through list @@ -109,7 +109,6 @@ from fingerscroll2 import FingerScroll # Writing recognistion code import math - def LoadDict(dict): # Upper case. # Where they are like lowercase, we either double @@ -251,7 +250,6 @@ def LoadDict(dict): dict.add("","S(4)1,7.S(7)7,1") # "" dict.add("", "S(4)2,6") - class DictSegment: # Each segment has for elements: # direction: Right Straight Left (R=cw, L=ccw) @@ -319,7 +317,6 @@ class DictPattern: cnt += m return cnt - class Dictionary: # The dictionary hold all the pattern for symbols and # performs lookup @@ -361,7 +358,6 @@ class Dictionary: if pos == "bot": return bot return mid - class Point: # This represents a point in the path and all the points leading # up to it. It allows us to find the direction and curvature from @@ -548,7 +544,6 @@ class BBox: y = 1 return y*3 + x - def different(*args): cur = 0 for i in args: @@ -691,7 +686,6 @@ class PPath: t += t1 + '.' return t[:-1] - class text_input: def __init__(self, page, callout): @@ -714,7 +708,7 @@ class text_input: def set_colour(self, col): self.colour = col - + def press(self, c, ev): if not self.active: return @@ -777,14 +771,8 @@ class text_input: print "Failed to match pattern:", patn return sym - - - - ######################################################################## - - class FingerText(gtk.TextView): def __init__(self): gtk.TextView.__init__(self) @@ -834,7 +822,7 @@ class FingerText(gtk.TextView): def insert_at_cursor(self, text): self.get_buffer().insert_at_cursor(text) - + class FingerEntry(gtk.Entry): def __init__(self): gtk.Entry.__init__(self) @@ -857,7 +845,7 @@ class SMSlist(gtk.DrawingArea): self.connect("expose-event", self.redraw) self.connect("configure-event", self.reconfig) - + self.connect("button_release_event", self.release) self.connect("button_press_event", self.press) self.set_events(gtk.gdk.EXPOSURE_MASK @@ -882,7 +870,6 @@ class SMSlist(gtk.DrawingArea): self.queue_draw() - def set_book(self, book): self.book = book @@ -963,9 +950,8 @@ class SMSlist(gtk.DrawingArea): self.width, self.lineheight) self.draw_sms(self.smslist[i], (i - self.top) * self.lineheight) - def draw_sms(self, sms, yoff): - + self.modify_font(self.smallfont) tm = time.strftime("%Y-%m-%d %H:%M:%S", sms.time[0:6]+(0,0,0)) then = time.mktime(sms.time[0:6]+(0,0,-1)) @@ -1026,7 +1012,7 @@ class SMSlist(gtk.DrawingArea): self.top = 0 self.refresh() - + def release(self,w,ev): pass @@ -1064,8 +1050,6 @@ def book_parse(book, name): cnt += 1 name = name[0:-1] return book_lookup(book, name, cnt) - - def book_name(book, num): if len(num) < 8: @@ -1142,7 +1126,7 @@ class SendSMS(gtk.Window): self.set_title("SendSMS") self.store = store self.connect('destroy', self.close_win) - + self.selecting = False self.viewing = False self.book = None @@ -1200,7 +1184,7 @@ class SendSMS(gtk.Window): l.modify_font(self.button_font) l.show() h.pack_start(l, expand=False) - + self.numentry = FingerEntry() h.pack_start(self.numentry) self.numentry.modify_font(self.button_font) @@ -1274,7 +1258,7 @@ class SendSMS(gtk.Window): h.pack_end(b, expand=False) l = gtk.Label('search:') ; l.show() h.pack_start(l, expand=False) - + e = gtk.Entry() ; e.show() self.search_entry = e h.pack_start(e) @@ -1289,13 +1273,12 @@ class SendSMS(gtk.Window): self.listview.assign_colour('bg-0', 'yellow') self.listview.assign_colour('bg-1', 'pink') self.listview.assign_colour('bg-selected', 'white') - + self.listbox = gtk.VBox() self.listbox.add(self.listview) v.add(self.listbox) self.listbox.show() - bb = gtk.HBox() ; bb.show() bb.set_size_request(-1,80) bb.set_homogeneous(True) @@ -1303,7 +1286,6 @@ class SendSMS(gtk.Window): self.buttonA = self.add_button(bb, 'Sent', self.rotate_list, 'A') self.buttonB = self.add_button(bb, 'Recv', self.rotate_list, 'B') - self.last_response = gtk.Label('') self.listbox.pack_end(self.last_response, expand = False) @@ -1355,7 +1337,7 @@ class SendSMS(gtk.Window): self.listview.set_book(self.book) e = name_lookup(self.book, n) if e and e[1]: - self.to_label.set_text(e[1] + + self.to_label.set_text(e[1] + ' '+ e[0]) self.number = e[0] @@ -1404,7 +1386,7 @@ class SendSMS(gtk.Window): else: self.cutbuffer = w.get_text() w.set_text('') - + def paste(self, *a): w = self.get_toplevel().get_focus() if w == None: @@ -1450,7 +1432,7 @@ class SendSMS(gtk.Window): for l in p.stdout: if l: line = l - + s = SMSmesg(to = recipient, text = mesg) if rv or line[0:2] != 'OK': @@ -1539,7 +1521,7 @@ class SendSMS(gtk.Window): self.reply.child.set_text('Open') else: self.reply.child.set_text('Reply') - + def open(self, *a): if self.viewing: if len(self.listview.smslist) < 1: @@ -1547,7 +1529,7 @@ class SendSMS(gtk.Window): s = self.listview.smslist[self.listview.selected] if s.state == 'NEW': self.store.setstate(s, None) - + self.numentry.set_text(s.correspondent) self.message.get_buffer().set_text(s.text) self.draft_button.child.set_text('SaveDraft') @@ -1582,7 +1564,7 @@ class SendSMS(gtk.Window): elif target == 'Recv' and e.source != 'LOCAL': l.append(e) return l - + def rotate_list(self, w=None, ev=None, which = None, target=None): # lists are: # All, Recv, New, Sent, Draft @@ -1609,7 +1591,7 @@ class SendSMS(gtk.Window): if target == 'New': self.buttonA.child.set_text('All') self.buttonB.child.set_text('Recv') - + self.display_list = target self.listview.reset_list() @@ -1654,8 +1636,6 @@ def send_number(sel, num): c.set_with_data([(gtk.gdk.SELECTION_TYPE_STRING, 0, 0)], clip_get_data, clip_clear_data, None) - - def main(args): for p in ['/data','/media/card','/var/tmp']: if os.path.exists(p):