Bug fixes and adding of user notifications
authorepage <eopage@byu.net>
Thu, 24 Sep 2009 01:29:49 +0000 (01:29 +0000)
committerepage <eopage@byu.net>
Thu, 24 Sep 2009 01:29:49 +0000 (01:29 +0000)
git-svn-id: file:///svnroot/gc-dialer/trunk@469 c39d3808-3fe2-4d86-a59f-b7f623ee9f21

src/dc_glade.py
src/gtk_toolbox.py
src/gv_views.py
src/hildonize.py
support/builddeb.py

index c271252..d4c721c 100755 (executable)
@@ -150,7 +150,7 @@ class Dialcentral(object):
 
                self._loginSink = gtk_toolbox.threaded_stage(
                        gtk_toolbox.comap(
-                               self.attempt_login,
+                               self._attempt_login,
                                gtk_toolbox.null_sink(),
                        )
                )
@@ -329,7 +329,10 @@ class Dialcentral(object):
                finally:
                        self._spawn_attempt_login(2)
 
-       def attempt_login(self, numOfAttempts = 10, force = False):
+       def _spawn_attempt_login(self, *args):
+               self._loginSink.send(args)
+
+       def _attempt_login(self, numOfAttempts = 10, force = False):
                """
                @todo Handle user notification better like attempting to login and failed login
 
@@ -354,13 +357,12 @@ class Dialcentral(object):
 
                        with gtk_toolbox.gtk_lock():
                                self._change_loggedin_status(serviceId)
+                               if loggedIn:
+                                       hildonize.show_information_banner(self._window, "Logged In")
                except Exception, e:
                        with gtk_toolbox.gtk_lock():
                                self._errorDisplay.push_exception()
 
-       def _spawn_attempt_login(self, *args):
-               self._loginSink.send(args)
-
        def refresh_session(self):
                """
                @note Thread agnostic
@@ -744,6 +746,7 @@ class Dialcentral(object):
                        dialed = False
                        try:
                                self._phoneBackends[self._selectedBackendId].send_sms(number, message)
+                               hildonize.show_information_banner(self._window, "Sending to %s" % number)
                                dialed = True
                        except Exception, e:
                                self._errorDisplay.push_exception()
@@ -773,6 +776,7 @@ class Dialcentral(object):
                        try:
                                assert self._phoneBackends[self._selectedBackendId].get_callback_number() != "", "No callback number specified"
                                self._phoneBackends[self._selectedBackendId].dial(number)
+                               hildonize.show_information_banner(self._window, "Calling %s" % number)
                                dialed = True
                        except Exception, e:
                                self._errorDisplay.push_exception()
index 39ca4ff..26803d7 100644 (file)
@@ -215,7 +215,8 @@ def comap(function, target):
                        mappedItem = function(*item)
                        target.send(mappedItem)
                except Exception, e:
-                       target.throw(e.__class__, e.message)
+                       logging.exception("Forwarding exception!")
+                       target.throw(e.__class__, str(e))
 
 
 def _flush_queue(queue):
@@ -420,7 +421,7 @@ class ErrorDisplay(object):
                        self.push_exception()
 
        def push_exception(self):
-               userMessage = str(sys.exc_value)
+               userMessage = str(sys.exc_info()[1])
                self.push_message(userMessage)
                logging.exception(userMessage)
 
@@ -544,7 +545,7 @@ class PopupCalendar(object):
                        self._calendar.select_month(self._displayDate.month, self._displayDate.year)
                        self._calendar.select_day(self._displayDate.day)
                except Exception, e:
-                       logging.exception(e.message)
+                       logging.exception(e)
 
 
 class QuickAddView(object):
index 2d2c3a6..cc60df5 100644 (file)
@@ -1031,6 +1031,8 @@ class RecentCallsView(object):
                pass
 
        def _idly_populate_recentview(self):
+               with gtk_toolbox.gtk_lock():
+                       banner = hildonize.show_busy_banner_start(self._window, "Loading Recent History")
                try:
                        self._recentmodel.clear()
                        self._isPopulated = True
@@ -1053,6 +1055,9 @@ class RecentCallsView(object):
                                        self._recentmodel.append(item)
                except Exception, e:
                        self._errorDisplay.push_exception_with_lock()
+               finally:
+                       with gtk_toolbox.gtk_lock():
+                               hildonize.show_busy_banner_end(banner)
 
                return False
 
@@ -1172,6 +1177,8 @@ class MessagesView(object):
                pass
 
        def _idly_populate_messageview(self):
+               with gtk_toolbox.gtk_lock():
+                       banner = hildonize.show_busy_banner_start(self._window, "Loading Messages")
                try:
                        self._messagemodel.clear()
                        self._isPopulated = True
@@ -1198,6 +1205,9 @@ class MessagesView(object):
                                        self._messagemodel.append(row)
                except Exception, e:
                        self._errorDisplay.push_exception_with_lock()
+               finally:
+                       with gtk_toolbox.gtk_lock():
+                               hildonize.show_busy_banner_end(banner)
 
                return False
 
@@ -1370,6 +1380,8 @@ class ContactsView(object):
                config.set(sectionName, "selectedAddressbook", str(self._selectedComboIndex))
 
        def _idly_populate_contactsview(self):
+               with gtk_toolbox.gtk_lock():
+                       banner = hildonize.show_busy_banner_start(self._window, "Loading Contacts")
                try:
                        addressBook = None
                        while addressBook is not self._addressBook:
@@ -1394,6 +1406,9 @@ class ContactsView(object):
                        self._isPopulated = True
                except Exception, e:
                        self._errorDisplay.push_exception_with_lock()
+               finally:
+                       with gtk_toolbox.gtk_lock():
+                               hildonize.show_busy_banner_end(banner)
                return False
 
        def _on_addressbook_button_changed(self, *args, **kwds):
index f467998..65803cc 100644 (file)
@@ -134,6 +134,60 @@ else:
        set_cell_thumb_selectable = _null_set_cell_thumb_selectable
 
 
+def _hildon_show_information_banner(parent, message):
+       hildon.hildon_banner_show_information(parent, "", message)
+
+
+def _null_show_information_banner(parent, message):
+       pass
+
+
+try:
+       hildon.hildon_banner_show_information
+       show_information_banner = _hildon_show_information_banner
+except AttributeError:
+       show_information_banner = _null_show_information_banner
+
+
+def _fremantle_show_busy_banner_start(parent, message):
+       hildon.hildon_gtk_window_set_progress_indicator(parent, True)
+       return parent
+
+
+def _fremantle_show_busy_banner_end(parent):
+       hildon.hildon_gtk_window_set_progress_indicator(parent, False)
+
+
+def _hildon_show_busy_banner_start(parent, message):
+       return hildon.hildon_banner_show_animation(parent, "", message)
+
+
+def _hildon_show_busy_banner_end(banner):
+       banner.destroy()
+
+
+def _null_show_busy_banner_start(parent, message):
+       return None
+
+
+def _null_show_busy_banner_end(banner):
+       return None
+
+
+try:
+       hildon.hildon_gtk_window_set_progress_indicator
+       show_busy_banner_start = _fremantle_show_busy_banner_start
+       show_busy_banner_end = _fremantle_show_busy_banner_end
+except AttributeError:
+       try:
+               hildon.hildon_banner_show_animation
+               show_busy_banner_start = _hildon_show_busy_banner_start
+               show_busy_banner_end = _hildon_show_busy_banner_end
+       except AttributeError:
+               show_busy_banner_start = _null_show_busy_banner_start
+               show_busy_banner_end = _null_show_busy_banner_end
+
+
 def _hildon_hildonize_text_entry(textEntry):
        textEntry.set_property('hildon-input-mode', 7)
 
index f322165..c3619d8 100755 (executable)
@@ -29,6 +29,7 @@ __changelog__ = """
 * Simplified menus
 * Fremantle: Making various areas pannable
 * Phone selection and SMS Message dialogs now use a tree view for the top part.  This gives highlighting of the last message, easier scrolling, easier code, etc
+* Added notifcations for various things like login and dialing
 * UI Tweak: Switch to accounts tab when logging in and callback is blank as a sublte hint to configure it
 * UI Tweak: Switch to accounts tab on failed login to remind the user they are not logged in
 * Bug Fix: some dependencies for Diablo