Log In
New Account
  
Home My Page Project Cloud Code Snippets Project Openings Hermes
Summary Lists News SCM
authorAndrew Flegg <andrew@bleb.org>
Tue, 13 Oct 2009 19:57:43 +0000 (20:57 +0100)
committerAndrew Flegg <andrew@bleb.org>
Tue, 13 Oct 2009 19:57:43 +0000 (20:57 +0100)
package/src/gui.py

index 64fa675..b82a71c 100755 (executable)
@@ -7,6 +7,7 @@ import traceback
 import time
 import thread
 import contactview
+import urllib2 
 from hermes import Hermes
 
 gobject.threads_init()
@@ -43,6 +44,18 @@ class HermesGUI:
         fb2c.load_friends()
         fb2c.sync_contacts(resync = force)
         gobject.idle_add(self.open_summary, fb2c)
+
+      except urllib2.HTTPError, e:
+        traceback.print_exc()
+        if e.code == 401:
+          gobject.idle_add(self.report_error, 'Authentication problem. Check credentials.', True)
+        else:
+          gobject.idle_add(self.report_error, 'Network connection error. Check connectivity.')
+
+      except urllib2.URLError, e:
+        traceback.print_exc()
+        gobject.idle_add(self.report_error, 'Network connection error. Check connectivity.')
+      
       except Exception, e:
         traceback.print_exc()
         gobject.idle_add(self.report_error, 'Something went wrong: ' + e.message)
@@ -114,7 +127,7 @@ class HermesGUI:
     tw_indent = gtk.HBox()
     tw_user = hildon.Entry(gtk.HILDON_SIZE_FINGER_HEIGHT)
     tw_user.set_property('hildon-input-mode', gtk.HILDON_GTK_INPUT_MODE_FULL)
-    tw_user.set_placeholder("Username")
+    tw_user.set_placeholder("Twitter username")
     tw_user.set_property('is-focus', False)
     tw_user.set_text(self.get_twitter_credentials()[0])
     self.sync_edit(use_twitter, tw_user)
@@ -124,7 +137,7 @@ class HermesGUI:
 
     tw_indent = gtk.HBox()
     tw_pass = hildon.Entry(gtk.HILDON_SIZE_FINGER_HEIGHT)
-    tw_pass.set_placeholder("Password")
+    tw_pass.set_placeholder("Twitter password")
     tw_pass.set_property('hildon-input-mode', gtk.HILDON_GTK_INPUT_MODE_FULL |
                                               gtk.HILDON_GTK_INPUT_MODE_INVISIBLE)
     tw_pass.set_text(self.get_twitter_credentials()[1])
@@ -204,8 +217,14 @@ class HermesGUI:
 
 
   # -----------------------------------------------------------------------
-  def report_error(self, e):
+  def report_error(self, e, prefs = False):
+    if self.progressnote:
+      self.window.set_property('sensitive', True)
+      self.progressnote.destroy()
+
     hildon.hildon_banner_show_information(self.window, '', e)
+    if prefs:
+      self.open_prefs()
 
 
   # -----------------------------------------------------------------------

Terms of Use    Privacy Policy    Contribution Guidelines    Feedback

Powered By GForge Collaborative Development Environment