Notifying the user on dnd
authorEd Page <eopage@byu.net>
Tue, 15 Mar 2011 23:17:07 +0000 (18:17 -0500)
committerEd Page <eopage@byu.net>
Tue, 19 Apr 2011 23:49:27 +0000 (18:49 -0500)
src/session.py

index 11de538..f113ae8 100644 (file)
@@ -674,20 +674,21 @@ class Session(QtCore.QObject):
                self.historyUpdated.emit()
 
        def _update_dnd(self):
-               oldDnd = self._dnd
-               try:
-                       assert self.state == self.LOGGEDIN_STATE, "DND requires being logged in (currently %s" % self.state
-                       self._dnd = yield (
-                               self._backend[0].is_dnd,
-                               (),
-                               {},
-                       )
-               except Exception, e:
-                       _moduleLogger.exception("Reporting error to user")
-                       self.error.emit(str(e))
-                       return
-               if oldDnd != self._dnd:
-                       self.dndStateChange(self._dnd)
+               with qui_utils.notify_busy(self._errorLog, "Updating Do-Not-Disturb Status"):
+                       oldDnd = self._dnd
+                       try:
+                               assert self.state == self.LOGGEDIN_STATE, "DND requires being logged in (currently %s" % self.state
+                               self._dnd = yield (
+                                       self._backend[0].is_dnd,
+                                       (),
+                                       {},
+                               )
+                       except Exception, e:
+                               _moduleLogger.exception("Reporting error to user")
+                               self.error.emit(str(e))
+                               return
+                       if oldDnd != self._dnd:
+                               self.dndStateChange(self._dnd)
 
        def _download_voicemail(self, messageId):
                actualPath = os.path.join(self._voicemailCachePath, "%s.mp3" % messageId)