Fixing some rendering bugs
authorepage <eopage@byu.net>
Sat, 28 Mar 2009 02:28:31 +0000 (02:28 +0000)
committerepage <eopage@byu.net>
Sat, 28 Mar 2009 02:28:31 +0000 (02:28 +0000)
git-svn-id: file:///svnroot/gc-dialer/trunk@266 c39d3808-3fe2-4d86-a59f-b7f623ee9f21

src/gc_backend.py
src/gc_views.py
src/gv_backend.py

index ef851e7..5628d95 100644 (file)
@@ -29,8 +29,9 @@ import urllib2
 import time
 import warnings
 import traceback
+from xml.sax import saxutils
 
-from browser_emu import MozillaEmulator
+import browser_emu
 
 
 class GCDialer(object):
@@ -61,7 +62,7 @@ class GCDialer(object):
 
        def __init__(self, cookieFile = None):
                # Important items in this function are the setup of the browser emulation and cookie file
-               self._browser = MozillaEmulator(None, 0)
+               self._browser = browser_emu.MozillaEmulator(None, 0)
                if cookieFile is None:
                        cookieFile = os.path.join(os.path.expanduser("~"), ".gc_cookies.txt")
                self._browser.cookies.filename = cookieFile
@@ -250,9 +251,9 @@ class GCDialer(object):
 
                for match in self._inboxRe.finditer(recentCallsPage):
                        phoneNumber = match.group(4)
-                       action = match.group(1)
-                       date = match.group(2)
-                       personsName = match.group(3)
+                       action = saxutils.unescape(match.group(1))
+                       date = saxutils.unescape(match.group(2))
+                       personsName = saxutils.unescape(match.group(3))
                        yield personsName, phoneNumber, date, action
 
        def get_addressbooks(self):
@@ -289,7 +290,7 @@ class GCDialer(object):
                                for contact_match in self._contactsRe.finditer(contactsPage):
                                        contactId = contact_match.group(1)
                                        contactName = contact_match.group(2)
-                                       contact = contactId, contactName
+                                       contact = contactId, saxutils.unescape(contactName)
                                        self.__contacts.append(contact)
                                        yield contact
 
@@ -312,7 +313,7 @@ class GCDialer(object):
                        raise RuntimeError("%s is not accesible" % self._contactDetailURL)
 
                for detail_match in self._contactDetailPhoneRe.finditer(detailPage):
-                       phoneType = detail_match.group(1)
+                       phoneType = saxutils.unescape(detail_match.group(1))
                        phoneNumber = detail_match.group(2)
                        yield (phoneType, phoneNumber)
 
index b6cd02c..12345f6 100644 (file)
@@ -525,7 +525,9 @@ class RecentCallsView(object):
                self._onRecentviewRowActivatedId = 0
 
                textrenderer = gtk.CellRendererText()
-               self._recentviewColumn = gtk.TreeViewColumn("Calls", textrenderer, text=1)
+               self._recentviewColumn = gtk.TreeViewColumn("Calls")
+               self._recentviewColumn.pack_start(textrenderer, expand=True)
+               self._recentviewColumn.add_attribute(textrenderer, "markup", 1)
                self._recentviewColumn.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
 
        def enable(self):
@@ -614,17 +616,17 @@ class ContactsView(object):
                self._contactsview = widgetTree.get_widget("contactsview")
 
                self._contactColumn = gtk.TreeViewColumn("Contact")
-               displayContactSource = True
+               displayContactSource = False
                if displayContactSource:
                        textrenderer = gtk.CellRendererText()
                        self._contactColumn.pack_start(textrenderer, expand=False)
-                       self._contactColumn.add_attribute(textrenderer, 'text', 0)
+                       self._contactColumn.add_attribute(textrenderer, 'markup', 0)
                textrenderer = gtk.CellRendererText()
                self._contactColumn.pack_start(textrenderer, expand=True)
-               self._contactColumn.add_attribute(textrenderer, 'text', 1)
+               self._contactColumn.add_attribute(textrenderer, 'markup', 1)
                textrenderer = gtk.CellRendererText()
                self._contactColumn.pack_start(textrenderer, expand=True)
-               self._contactColumn.add_attribute(textrenderer, 'text', 4)
+               self._contactColumn.add_attribute(textrenderer, 'markup', 4)
                self._contactColumn.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
                self._contactColumn.set_sort_column_id(1)
                self._contactColumn.set_visible(True)
@@ -736,8 +738,7 @@ class ContactsView(object):
                        finally:
                                gtk.gdk.threads_leave()
                for contactId, contactName in contacts:
-                       # contactType = (addressBook.contact_source_short_name(contactId), )
-                       contactType = ("", ) # Due to popular demand
+                       contactType = (addressBook.contact_source_short_name(contactId), )
                        self._contactsmodel.append(contactType + (contactName, "", contactId) + ("", ))
 
                # restart the treeview data rendering
index 870a4b8..3cb5c3c 100644 (file)
@@ -33,10 +33,11 @@ import urllib2
 import time
 import warnings
 import traceback
+from xml.sax import saxutils
 
 from xml.etree import ElementTree
 
-from browser_emu import MozillaEmulator
+import browser_emu
 
 try:
        import simplejson
@@ -94,7 +95,7 @@ class GVDialer(object):
 
        def __init__(self, cookieFile = None):
                # Important items in this function are the setup of the browser emulation and cookie file
-               self._browser = MozillaEmulator(None, 0)
+               self._browser = browser_emu.MozillaEmulator(None, 0)
                if cookieFile is None:
                        cookieFile = os.path.join(os.path.expanduser("~"), ".gv_cookies.txt")
                self._browser.cookies.filename = cookieFile
@@ -295,6 +296,9 @@ class GVDialer(object):
                                        for label in recentCallData["labels"]
                                                if label.lower() != "all" and label.lower() != "inbox"
                                ))
+                               number = saxutils.unescape(number)
+                               date = saxutils.unescape(date)
+                               action = saxutils.unescape(action)
                                yield "", number, date, action
 
        def get_addressbooks(self):
@@ -330,7 +334,7 @@ class GVDialer(object):
                                        raise RuntimeError("%s is not accesible" % self._clicktocallURL)
                                for contact_match in self._contactsRe.finditer(contactsPage):
                                        contactId = contact_match.group(1)
-                                       contactName = contact_match.group(2)
+                                       contactName = saxutils.unescape(contact_match.group(2))
                                        contact = contactId, contactName
                                        self.__contacts.append(contact)
                                        yield contact
@@ -355,7 +359,7 @@ class GVDialer(object):
 
                for detail_match in self._contactDetailPhoneRe.finditer(detailPage):
                        phoneNumber = detail_match.group(1)
-                       phoneType = detail_match.group(2)
+                       phoneType = saxutils.unescape(detail_match.group(2))
                        yield (phoneType, phoneNumber)
 
        def _grab_json(self, url):