Mercurial > libervia-backend
comparison 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 |
comparison
equal
deleted
inserted
replaced
1635:591e04f0103c | 1636:e00f450c25fc |
---|---|
561 wid_idx = len(self.center_part.widget_list)-1 | 561 wid_idx = len(self.center_part.widget_list)-1 |
562 self.center_part.widget_list[wid_idx] = urwid.Filler(urwid.Text('')) | 562 self.center_part.widget_list[wid_idx] = urwid.Filler(urwid.Text('')) |
563 self.center_part.focus_position = 0 | 563 self.center_part.focus_position = 0 |
564 self.redraw() | 564 self.redraw() |
565 | 565 |
566 def addProgress (self, id, message): | 566 def addProgress(self, pid, message, profile): |
567 """Follow a SàT progress bar | 567 """Follow a SàT progression |
568 @param id: SàT id of the progression | 568 |
569 @param message: message to show to identify the progression""" | 569 @param pid: progression id |
570 self.progress_wid.addProgress(id, message) | 570 @param message: message to show to identify the progression |
571 """ | |
572 self.progress_wid.add(pid, message, profile) | |
571 | 573 |
572 def setProgress(self, percentage): | 574 def setProgress(self, percentage): |
573 """Set the progression shown in notification bar""" | 575 """Set the progression shown in notification bar""" |
574 self.notif_bar.setProgress(percentage) | 576 self.notif_bar.setProgress(percentage) |
575 | 577 |
629 if self.notif_bar.canHide(): | 631 if self.notif_bar.canHide(): |
630 #No notification left, we can hide the bar | 632 #No notification left, we can hide the bar |
631 self.main_widget.hide('notif_bar') | 633 self.main_widget.hide('notif_bar') |
632 else: | 634 else: |
633 self.main_widget.show('notif_bar') | 635 self.main_widget.show('notif_bar') |
636 self.redraw() # FIXME: invalidate cache in a more efficient way | |
634 | 637 |
635 def _actionManagerUnknownError(self): | 638 def _actionManagerUnknownError(self): |
636 self.alert(_("Error"), _(u"Unmanaged action")) | 639 self.alert(_("Error"), _(u"Unmanaged action")) |
637 | 640 |
638 def askConfirmationHandler(self, confirmation_id, confirmation_type, data, profile): | 641 def askConfirmationHandler(self, confirmation_id, confirmation_type, data, profile): |
705 callback(data) | 708 callback(data) |
706 else: | 709 else: |
707 log.error (_("FIXME FIXME FIXME: type [%s] not implemented") % type_) | 710 log.error (_("FIXME FIXME FIXME: type [%s] not implemented") % type_) |
708 raise NotImplementedError | 711 raise NotImplementedError |
709 | 712 |
710 | |
711 def roomJoinedHandler(self, room_jid_s, room_nicks, user_nick, profile): | 713 def roomJoinedHandler(self, room_jid_s, room_nicks, user_nick, profile): |
712 super(PrimitivusApp, self).roomJoinedHandler(room_jid_s, room_nicks, user_nick, profile) | 714 super(PrimitivusApp, self).roomJoinedHandler(room_jid_s, room_nicks, user_nick, profile) |
713 self.contact_lists[profile].setFocus(jid.JID(room_jid_s), True) | 715 self.contact_lists[profile].setFocus(jid.JID(room_jid_s), True) |
714 | 716 |
717 def progressStartedHandler(self, pid, metadata, profile): | |
718 super(PrimitivusApp, self).progressStartedHandler(pid, metadata, profile) | |
719 self.addProgress(pid, metadata.get('name', _(u'unkown')), profile) | |
720 | |
721 def progressFinishedHandler(self, pid, metadata, profile): | |
722 log.info(u"Progress {} finished".format(pid)) | |
723 super(PrimitivusApp, self).progressFinishedHandler(pid, metadata, profile) | |
724 | |
725 def progressErrorHandler(self, pid, err_msg, profile): | |
726 log.warning(u"Progress {pid} error: {err_msg}".format(pid=pid, err_msg=err_msg)) | |
727 super(PrimitivusApp, self).progressErrorHandler(pid, err_msg, profile) | |
715 | 728 |
716 | 729 |
717 ##DIALOGS CALLBACKS## | 730 ##DIALOGS CALLBACKS## |
718 def onJoinRoom(self, button, edit): | 731 def onJoinRoom(self, button, edit): |
719 self.removePopUp() | 732 self.removePopUp() |