/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: 2018-06-14 17:59:16 UTC
  • mto: This revision was merged to the branch mainline in revision 7065.
  • Revision ID: jelmer@jelmer.uk-20180614175916-a2e2xh5k533guq1x
Move breezy.plugins.git to breezy.git.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
will manage a conceptual stack of nested activities.
21
21
"""
22
22
 
 
23
from __future__ import absolute_import
 
24
 
23
25
import time
24
26
import os
25
27
 
64
66
        synchronously.
65
67
 
66
68
    :ivar show_transport_activity: If true (default), transport activity
67
 
        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 
68
70
        that only irrelevant or uninteresting transport activity can occur
69
71
        during this task.
70
72
    """
76
78
 
77
79
        :param progress_view: ProgressView to display this ProgressTask.
78
80
 
79
 
        :param ui_factory: The UI factory that will display updates;
 
81
        :param ui_factory: The UI factory that will display updates; 
80
82
            deprecated in favor of passing progress_view directly.
81
83
 
82
84
        Normally you should not call this directly but rather through
130
132
 
131
133
    def make_sub_task(self):
132
134
        return ProgressTask(self, ui_factory=self.ui_factory,
133
 
                            progress_view=self.progress_view)
 
135
            progress_view=self.progress_view)
134
136
 
135
137
    def _overall_completion_fraction(self, child_fraction=0.0):
136
138
        """Return fractional completion of this task and its parents
137
139
 
138
140
        Returns None if no completion can be computed."""
139
141
        if self.current_cnt is not None and self.total_cnt:
140
 
            own_fraction = (float(self.current_cnt) +
141
 
                            child_fraction) / self.total_cnt
 
142
            own_fraction = (float(self.current_cnt) + child_fraction) / self.total_cnt
142
143
        else:
143
144
            # if this task has no estimation, it just passes on directly
144
145
            # whatever the child has measured...
200
201
    if delt is None:
201
202
        return "-:--:--"
202
203
    delt = int(round(delt))
203
 
    return '%d:%02d:%02d' % (delt / 3600,
204
 
                             (delt / 60) % 60,
 
204
    return '%d:%02d:%02d' % (delt/3600,
 
205
                             (delt/60) % 60,
205
206
                             delt % 60)
206
207
 
207
208
 
208
 
def get_eta(start_time, current, total, enough_samples=3, last_updates=None,
209
 
            n_recent=10):
 
209
def get_eta(start_time, current, total, enough_samples=3, last_updates=None, n_recent=10):
210
210
    if start_time is None:
211
211
        return None
212
212
 
240
240
 
241
241
class ProgressPhase(object):
242
242
    """Update progress object with the current phase"""
243
 
 
244
243
    def __init__(self, message, total, pb):
245
244
        object.__init__(self)
246
245
        self.pb = pb