From 22e9bd763f392088942d7295299bd25cbc5130d4 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Fri, 13 Dec 2013 09:15:13 +1100 Subject: [PATCH] Make sms search function work. --- sms/sendsms.py | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/sms/sendsms.py b/sms/sendsms.py index bdacecd..1aaaed3 100755 --- a/sms/sendsms.py +++ b/sms/sendsms.py @@ -1251,15 +1251,22 @@ class SendSMS(gtk.Window): self.view_button = self.add_button(h, 'View', self.view) self.reply = self.add_button(h, 'New', self.open) + + fd = pango.FontDescription("sans 8") + fd.set_absolute_size(25*pango.SCALE) h = gtk.HBox() ; h.show() v.pack_start(h, expand=False) - b = gtk.Button("clr") ; b.show() + b = gtk.Button(" clear ") + b.child.modify_font(fd) + b.show() b.connect('clicked', self.clear_search) h.pack_end(b, expand=False) - l = gtk.Label('search:') ; l.show() + l = gtk.Label('Search:') ; l.show() + l.modify_font(fd) h.pack_start(l, expand=False) e = gtk.Entry() ; e.show() + e.modify_font(fd) self.search_entry = e h.pack_start(e) @@ -1555,14 +1562,19 @@ class SendSMS(gtk.Window): while now and len(l) < lines: (now, l2) = self.store.lookup(now) for e in l2: - if patn and patn not in e.correspondent: + if target == 'Sent' and e.source != 'LOCAL': continue - if target == 'All': - l.append(e) - elif target == 'Sent' and e.source == 'LOCAL': - l.append(e) - elif target == 'Recv' and e.source != 'LOCAL': - l.append(e) + if target == 'Recv' and e.source == 'LOCAL': + continue + if patn and patn not in e.correspondent: + if not self.book: + continue + n = book_name(self.book, e.correspondent) + if not n or not n[0]: + continue + if patn.lower() not in n[0].lower(): + continue + l.append(e) return l def rotate_list(self, w=None, ev=None, which = None, target=None): @@ -1596,7 +1608,7 @@ class SendSMS(gtk.Window): self.listview.reset_list() def clear_search(self, *a): - pass + self.search_entry.set_text('') def got_new(self): self.rotate_list(self, target = 'New') -- 2.39.5