/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-02-18 21:42:57 UTC
  • mto: This revision was merged to the branch mainline in revision 6859.
  • Revision ID: jelmer@jelmer.uk-20180218214257-jpevutp1wa30tz3v
Update TODO to reference Breezy, not Bazaar.

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...
163
164
        else:
164
165
            self.ui_factory.clear_term()
165
166
 
166
 
    def __enter__(self):
167
 
        return self
168
 
 
169
 
    def __exit__(self, exc_type, exc_val, exc_tb):
170
 
        self.finished()
171
 
        return False
172
 
 
173
167
 
174
168
class DummyProgress(object):
175
169
    """Progress-bar standin that does nothing.
200
194
    if delt is None:
201
195
        return "-:--:--"
202
196
    delt = int(round(delt))
203
 
    return '%d:%02d:%02d' % (delt / 3600,
204
 
                             (delt / 60) % 60,
 
197
    return '%d:%02d:%02d' % (delt/3600,
 
198
                             (delt/60) % 60,
205
199
                             delt % 60)
206
200
 
207
201
 
208
 
def get_eta(start_time, current, total, enough_samples=3, last_updates=None,
209
 
            n_recent=10):
 
202
def get_eta(start_time, current, total, enough_samples=3, last_updates=None, n_recent=10):
210
203
    if start_time is None:
211
204
        return None
212
205
 
240
233
 
241
234
class ProgressPhase(object):
242
235
    """Update progress object with the current phase"""
243
 
 
244
236
    def __init__(self, message, total, pb):
245
237
        object.__init__(self)
246
238
        self.pb = pb