def update(self, pbar):
self.n_refresh += <NUM_LIT:1><EOL>if pbar.currval == <NUM_LIT:0>:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>elif pbar.finished:<EOL><INDENT>return '<STR_LIT>' % self.format_time(pbar.seconds_elapsed)<EOL><DEDENT>else:<EOL><INDENT>elapsed = pbar.seconds_elapsed<EOL>try:<EOL><INDENT>speed = pbar.currval / elapsed<EOL>if self.speed_smooth is not None:<EOL><INDENT>self.speed_smooth = (self.speed_smooth * (<NUM_LIT:1> - self.SMOOTHING)) + (speed * self.SMOOTHING)<EOL><DEDENT>else:<EOL><INDENT>self.speed_smooth = speed<EOL><DEDENT>eta = float(pbar.maxval) / self.speed_smooth - elapsed + <NUM_LIT:1> if float(pbar.maxval) / self.speed_smooth - elapsed + <NUM_LIT:1> > <NUM_LIT:0> else <NUM_LIT:0><EOL>if float(pbar.currval) / pbar.maxval > <NUM_LIT> or self.n_refresh > <NUM_LIT:10>:  <EOL><INDENT>return '<STR_LIT>' % self.format_time(eta)<EOL><DEDENT>if self.old_eta is not None and self.old_eta < eta:  <EOL><INDENT>return '<STR_LIT>' % self.format_time(self.old_eta)<EOL><DEDENT>else:<EOL><INDENT>self.old_eta = eta<EOL>return '<STR_LIT>' % self.format_time(eta)<EOL><DEDENT><DEDENT>except ZeroDivisionError:<EOL><INDENT>speed = <NUM_LIT:0><EOL><DEDENT><DEDENT>
Updates the widget to show the ETA or total time when finished.