diff frontends/src/primitivus/primitivus @ 1636:e00f450c25fc

primitivus: fixed progress panel
author Goffi <goffi@goffi.org>
date Fri, 20 Nov 2015 01:57:18 +0100
parents 4f9fa67758eb
children ab88e85fc29f
line wrap: on
line diff
--- a/frontends/src/primitivus/primitivus	Fri Nov 20 01:57:18 2015 +0100
+++ b/frontends/src/primitivus/primitivus	Fri Nov 20 01:57:18 2015 +0100
@@ -563,11 +563,13 @@
         self.center_part.focus_position = 0
         self.redraw()
 
-    def addProgress (self, id, message):
-        """Follow a SàT progress bar
-        @param id: SàT id of the progression
-        @param message: message to show to identify the progression"""
-        self.progress_wid.addProgress(id, message)
+    def addProgress(self, pid, message, profile):
+        """Follow a SàT progression
+
+        @param pid: progression id
+        @param message: message to show to identify the progression
+        """
+        self.progress_wid.add(pid, message, profile)
 
     def setProgress(self, percentage):
         """Set the progression shown in notification bar"""
@@ -631,6 +633,7 @@
                 self.main_widget.hide('notif_bar')
         else:
             self.main_widget.show('notif_bar')
+            self.redraw() # FIXME: invalidate cache in a more efficient way
 
     def _actionManagerUnknownError(self):
         self.alert(_("Error"), _(u"Unmanaged action"))
@@ -707,11 +710,21 @@
             log.error (_("FIXME FIXME FIXME: type [%s] not implemented") % type_)
             raise NotImplementedError
 
-
     def roomJoinedHandler(self, room_jid_s, room_nicks, user_nick, profile):
         super(PrimitivusApp, self).roomJoinedHandler(room_jid_s, room_nicks, user_nick, profile)
         self.contact_lists[profile].setFocus(jid.JID(room_jid_s), True)
 
+    def progressStartedHandler(self, pid, metadata, profile):
+        super(PrimitivusApp, self).progressStartedHandler(pid, metadata, profile)
+        self.addProgress(pid, metadata.get('name', _(u'unkown')), profile)
+
+    def progressFinishedHandler(self, pid, metadata, profile):
+        log.info(u"Progress {} finished".format(pid))
+        super(PrimitivusApp, self).progressFinishedHandler(pid, metadata, profile)
+
+    def progressErrorHandler(self, pid, err_msg, profile):
+        log.warning(u"Progress {pid} error: {err_msg}".format(pid=pid, err_msg=err_msg))
+        super(PrimitivusApp, self).progressErrorHandler(pid, err_msg, profile)
 
 
     ##DIALOGS CALLBACKS##