comparison frontends/src/jp/base.py @ 2368:3865a772c360

jp (base): fixed CommandAnswering and progress bar
author Goffi <goffi@goffi.org>
date Sun, 01 Oct 2017 12:21:23 +0200
parents 6ff5212997c7
children d2ff5ff3de77
comparison
equal deleted inserted replaced
2367:9878635586f3 2368:3865a772c360
717 except KeyError: 717 except KeyError:
718 self.disp(_(u"file size is not known, we can't show a progress bar"), 1, error=True) 718 self.disp(_(u"file size is not known, we can't show a progress bar"), 1, error=True)
719 return False 719 return False
720 if self.host.pbar is None: 720 if self.host.pbar is None:
721 #first answer, we must construct the bar 721 #first answer, we must construct the bar
722 self.host.pbar = progressbar.ProgressBar(int(size), 722 self.host.pbar = progressbar.ProgressBar(max_value=int(size),
723 [_(u"Progress: "),progressbar.Percentage(), 723 widgets=[_(u"Progress: "),progressbar.Percentage(),
724 " ", 724 " ",
725 progressbar.Bar(), 725 progressbar.Bar(),
726 " ", 726 " ",
727 progressbar.FileTransferSpeed(), 727 progressbar.FileTransferSpeed(),
728 " ", 728 " ",
729 progressbar.ETA()]) 729 progressbar.ETA()])
730 self.host.pbar.start() 730 self.host.pbar.start()
731 731
732 self.host.pbar.update(int(data['position'])) 732 self.host.pbar.update(int(data['position']))
733 733
734 elif self.host.pbar is not None: 734 elif self.host.pbar is not None:
899 899
900 def connected(self): 900 def connected(self):
901 """Auto reply to confirmations requests""" 901 """Auto reply to confirmations requests"""
902 self.need_loop = True 902 self.need_loop = True
903 super(CommandAnswering, self).connected() 903 super(CommandAnswering, self).connected()
904 self.host.bridge.register("actionNew", self.onActionNew) 904 self.host.bridge.register_signal("actionNew", self.onActionNew)
905 actions = self.host.bridge.actionsGet(self.profile) 905 actions = self.host.bridge.actionsGet(self.profile)
906 for action_data, action_id, security_limit in actions: 906 for action_data, action_id, security_limit in actions:
907 self.onActionNew(action_data, action_id, security_limit, self.profile) 907 self.onActionNew(action_data, action_id, security_limit, self.profile)