| 26 | self.new_file(labels, total_size) |
| 27 | |
| 28 | def new_file(self, labels, total_size): |
| 29 | self.labels = labels |
| 30 | self.total_size = total_size |
| 31 | # Set initial_position to something in the |
| 32 | # case we're not counting from 0. For instance |
| 33 | # when appending to a partially downloaded file. |
| 34 | # Setting initial_position will let the speed |
| 35 | # be computed right. |
| 36 | self.initial_position = 0 |
| 37 | self.current_position = self.initial_position |
| 38 | self.time_start = datetime.datetime.now() |
| 39 | self.time_last = self.time_start |
| 40 | self.time_current = self.time_start |
| 41 | |
| 42 | self.display(new_file = True) |
| 43 | |
| 44 | def update(self, current_position = -1, delta_position = -1): |
| 45 | self.time_last = self.time_current |