Some lint stuff and fixing a cosmetic bug
authorepage <eopage@byu.net>
Thu, 31 Jul 2008 22:56:33 +0000 (22:56 +0000)
committerepage <eopage@byu.net>
Thu, 31 Jul 2008 22:56:33 +0000 (22:56 +0000)
git-svn-id: file:///svnroot/gc-dialer/trunk@112 c39d3808-3fe2-4d86-a59f-b7f623ee9f21

src/browser_emu.py
src/gc_dialer.py
src/gcbackend.py
support/pylint.rc

index ac23ae7..26dabe2 100644 (file)
@@ -61,8 +61,8 @@ class MozillaEmulator(object):
                        extraheaders = {}
 
                txheaders = {
-                       'Accept':'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png',
-                       'Accept-Language':'en,en-us;q=0.5',
+                       'Accept': 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png',
+                       'Accept-Language': 'en,en-us;q=0.5',
                        'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
                }
                for key, value in extraheaders.iteritems():
@@ -77,8 +77,16 @@ class MozillaEmulator(object):
                http_handler = urllib2.HTTPHandler(debuglevel=self.debug)
                https_handler = urllib2.HTTPSHandler(debuglevel=self.debug)
 
-               u = urllib2.build_opener(http_handler, https_handler, urllib2.HTTPCookieProcessor(self.cookies), redirector)
-               u.addheaders = [('User-Agent','Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4')]
+               u = urllib2.build_opener(
+                       http_handler,
+                       https_handler,
+                       urllib2.HTTPCookieProcessor(self.cookies),
+                       redirector
+               )
+               u.addheaders = [(
+                       'User-Agent',
+                       'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4'
+               )]
                if not postdata is None:
                        req.add_data(postdata)
                return (req, u)
index ea1b59d..27ce60f 100755 (executable)
@@ -219,7 +219,13 @@ class Dialpad(object):
                self._recentviewselection = None
 
                self._contactstime = 0.0
-               self._contactsmodel = gtk.ListStore(gtk.gdk.Pixbuf, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING)
+               self._contactsmodel = gtk.ListStore(
+                       gtk.gdk.Pixbuf,
+                       gobject.TYPE_STRING,
+                       gobject.TYPE_STRING,
+                       gobject.TYPE_STRING,
+                       gobject.TYPE_STRING
+               )
                self._contactsviewselection = None
 
                for path in Dialpad._glade_files:
@@ -320,6 +326,8 @@ class Dialpad(object):
 
                if not self._gcBackend.is_authed():
                        self.attempt_login(2)
+               else:
+                       self.set_account_number()
                gobject.idle_add(self._idly_init_recent_view)
                gobject.idle_add(self._idly_init_contacts_view)
 
@@ -401,7 +409,8 @@ class Dialpad(object):
                self._recentmodel.clear()
 
                for personsName, phoneNumber, date, action in self._gcBackend.get_recent():
-                       item = (phoneNumber, "%s on %s from/to %s - %s" % (action.capitalize(), date, personsName, phoneNumber))
+                       description = "%s on %s from/to %s - %s" % (action.capitalize(), date, personsName, phoneNumber)
+                       item = (phoneNumber, description)
                        self._recentmodel.append(item)
 
                self._recenttime = time.time()
@@ -591,7 +600,8 @@ class Dialpad(object):
                        gobject.idle_add(self._idly_setup_callback_combo)
 
                if hildon:
-                       self._window.set_title(self._notebook.get_tab_label(self._notebook.get_nth_page(page_num)).get_text())
+                       hildonTitle = self._notebook.get_tab_label(self._notebook.get_nth_page(page_num)).get_text()
+                       self._window.set_title(hildonTitle)
 
        def _on_dial_clicked(self, widget):
                """
index 2341f91..c9dac34 100644 (file)
@@ -23,7 +23,7 @@ class GCDialer(object):
        the functions include login, setting up a callback number, and initalting a callback
        """
 
-       _gcDialingStrRe = re.compile("This may take a few seconds", re.M) # string from Grandcentral.com on successful dial
+       _gcDialingStrRe = re.compile("This may take a few seconds", re.M)
        _accessTokenRe = re.compile(r"""<input type="hidden" name="a_t" [^>]*value="(.*)"/>""")
        _isLoginPageRe = re.compile(r"""<form method="post" action="https://www.grandcentral.com/mobile/account/login">""")
        _callbackRe = re.compile(r"""name="default_number" value="(\d+)" />\s+(.*)\s$""", re.M)
@@ -204,7 +204,10 @@ class GCDialer(object):
                Set the number that grandcental calls
                @param callbacknumber should be a proper 10 digit number
                """
-               callbackPostData = urllib.urlencode({'a_t' : self._accessToken, 'default_number' : callbacknumber })
+               callbackPostData = urllib.urlencode({
+                       'a_t': self._accessToken,
+                       'default_number': callbacknumber
+               })
                try:
                        callbackSetPage = self._browser.download(GCDialer._setforwardURL, callbackPostData)
                except urllib2.URLError, e:
index ba26a80..5103d11 100644 (file)
@@ -296,7 +296,8 @@ notes=FIXME,XXX,TODO
 [FORMAT]
 
 # Maximum number of characters on a single line.
-max-line-length=80
+# @note Limiting this to the most extreme cases
+max-line-length=100
 
 # Maximum number of lines in a module
 max-module-lines=1000