215 delta = pos - initialpos |
215 delta = pos - initialpos |
216 if delta > 0: |
216 if delta > 0: |
217 elapsed = now - self.starttimes[topic] |
217 elapsed = now - self.starttimes[topic] |
218 # experimental config: progress.estimate |
218 # experimental config: progress.estimate |
219 if elapsed > float( |
219 if elapsed > float( |
220 self.ui.config('progress', 'estimate', default=2)): |
220 self.ui.config('progress', 'estimate')): |
221 seconds = (elapsed * (target - delta)) // delta + 1 |
221 seconds = (elapsed * (target - delta)) // delta + 1 |
222 return fmtremaining(seconds) |
222 return fmtremaining(seconds) |
223 return '' |
223 return '' |
224 |
224 |
225 def speed(self, topic, pos, unit, now): |
225 def speed(self, topic, pos, unit, now): |
226 initialpos = self.startvals[topic] |
226 initialpos = self.startvals[topic] |
227 delta = pos - initialpos |
227 delta = pos - initialpos |
228 elapsed = now - self.starttimes[topic] |
228 elapsed = now - self.starttimes[topic] |
229 if elapsed > float( |
229 if elapsed > float( |
230 self.ui.config('progress', 'estimate', default=2)): |
230 self.ui.config('progress', 'estimate')): |
231 return _('%d %s/sec') % (delta / elapsed, unit) |
231 return _('%d %s/sec') % (delta / elapsed, unit) |
232 return '' |
232 return '' |
233 |
233 |
234 def _oktoprint(self, now): |
234 def _oktoprint(self, now): |
235 '''Check if conditions are met to print - e.g. changedelay elapsed''' |
235 '''Check if conditions are met to print - e.g. changedelay elapsed''' |