/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/progress.py

  • Committer: Jelmer Vernooij
  • Date: 2019-03-04 00:16:27 UTC
  • mfrom: (7293 work)
  • mto: This revision was merged to the branch mainline in revision 7318.
  • Revision ID: jelmer@jelmer.uk-20190304001627-v6u7o6pf97tukhek
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
        synchronously.
67
67
 
68
68
    :ivar show_transport_activity: If true (default), transport activity
69
 
        will be shown when this task is drawn.  Disable it if you're sure 
 
69
        will be shown when this task is drawn.  Disable it if you're sure
70
70
        that only irrelevant or uninteresting transport activity can occur
71
71
        during this task.
72
72
    """
78
78
 
79
79
        :param progress_view: ProgressView to display this ProgressTask.
80
80
 
81
 
        :param ui_factory: The UI factory that will display updates; 
 
81
        :param ui_factory: The UI factory that will display updates;
82
82
            deprecated in favor of passing progress_view directly.
83
83
 
84
84
        Normally you should not call this directly but rather through
132
132
 
133
133
    def make_sub_task(self):
134
134
        return ProgressTask(self, ui_factory=self.ui_factory,
135
 
            progress_view=self.progress_view)
 
135
                            progress_view=self.progress_view)
136
136
 
137
137
    def _overall_completion_fraction(self, child_fraction=0.0):
138
138
        """Return fractional completion of this task and its parents
139
139
 
140
140
        Returns None if no completion can be computed."""
141
141
        if self.current_cnt is not None and self.total_cnt:
142
 
            own_fraction = (float(self.current_cnt) + child_fraction) / self.total_cnt
 
142
            own_fraction = (float(self.current_cnt) +
 
143
                            child_fraction) / self.total_cnt
143
144
        else:
144
145
            # if this task has no estimation, it just passes on directly
145
146
            # whatever the child has measured...
201
202
    if delt is None:
202
203
        return "-:--:--"
203
204
    delt = int(round(delt))
204
 
    return '%d:%02d:%02d' % (delt/3600,
205
 
                             (delt/60) % 60,
 
205
    return '%d:%02d:%02d' % (delt / 3600,
 
206
                             (delt / 60) % 60,
206
207
                             delt % 60)
207
208
 
208
209
 
209
 
def get_eta(start_time, current, total, enough_samples=3, last_updates=None, n_recent=10):
 
210
def get_eta(start_time, current, total, enough_samples=3, last_updates=None,
 
211
            n_recent=10):
210
212
    if start_time is None:
211
213
        return None
212
214
 
240
242
 
241
243
class ProgressPhase(object):
242
244
    """Update progress object with the current phase"""
 
245
 
243
246
    def __init__(self, message, total, pb):
244
247
        object.__init__(self)
245
248
        self.pb = pb