def __init__(self, db, title, info_starting, info): AcquireProgress.__init__(self) self.db = db self.title = title self.info_starting = info_starting self.info = info self.old_capb = None self.eta = 0.0
def pulse(self,owner=None): AcquireProgress.pulse(self,owner) self.percent = (((self.current_bytes + self.current_items) * 100.0) / float(self.total_bytes + self.total_items)) if self.current_cps > 0: self.eta = ((self.total_bytes - self.current_bytes) / float(self.current_cps)) try: if os.environ['UBIQUITY_FRONTEND'] != 'debconf_ui': self.db.progress('SET', int(self.percent)) except debconf.DebconfError: return False if self.eta != 0.0: time_str = "%d:%02d" % divmod(int(self.eta), 60) self.db.subst(self.info, 'TIME', time_str) try: self.db.progress('INFO', self.info) except debconf.DebconfError: return False return True
def pulse(self, owner=None): AcquireProgress.pulse(self, owner) self.percent = (((self.current_bytes + self.current_items) * 100.0) / float(self.total_bytes + self.total_items)) if self.current_cps > 0: self.eta = ((self.total_bytes - self.current_bytes) / float(self.current_cps)) try: if os.environ['UBIQUITY_FRONTEND'] != 'debconf_ui': self.db.progress('SET', int(self.percent)) except debconf.DebconfError: return False if self.eta != 0.0: time_str = "%d:%02d" % divmod(int(self.eta), 60) self.db.subst(self.info, 'TIME', time_str) try: self.db.progress('INFO', self.info) except debconf.DebconfError: return False return True