184
184
self.ui_factory.clear_term()
187
@deprecated_function(deprecated_in((1, 16, 0)))
188
def ProgressBar(to_file=None, **kwargs):
189
"""Construct a progress bar.
191
Deprecated; ask the ui_factory for a progress task instead.
195
requested_bar_type = os.environ.get('BZR_PROGRESS_BAR')
196
# An value of '' or not set reverts to standard processing
197
if requested_bar_type in (None, ''):
198
if _supports_progress(to_file):
199
return TTYProgressBar(to_file=to_file, **kwargs)
201
return DummyProgress(to_file=to_file, **kwargs)
203
# Minor sanitation to prevent spurious errors
204
requested_bar_type = requested_bar_type.lower().strip()
205
# TODO: jam 20060710 Arguably we shouldn't raise an exception
206
# but should instead just disable progress bars if we
207
# don't recognize the type
208
if requested_bar_type not in _progress_bar_types:
209
raise errors.InvalidProgressBarType(requested_bar_type,
210
_progress_bar_types.keys())
211
return _progress_bar_types[requested_bar_type](to_file=to_file, **kwargs)
214
187
# NOTE: This is also deprecated; you should provide a ProgressView instead.
215
188
class _BaseProgressBar(object):