~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/ui/text.py

  • Committer: Jonathan Riddell
  • Date: 2011-05-16 10:05:25 UTC
  • mto: This revision was merged to the branch mainline in revision 5869.
  • Revision ID: jriddell@canonical.com-20110516100525-7q23m5opdnl4qg41
start adding licences

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
18
18
"""Text UI, write output to the console.
19
19
"""
20
20
 
21
 
import codecs
22
 
import getpass
23
21
import os
24
22
import sys
25
23
import time
26
 
import warnings
27
24
 
28
25
from bzrlib.lazy_import import lazy_import
29
26
lazy_import(globals(), """
 
27
import codecs
 
28
import getpass
 
29
import warnings
 
30
 
30
31
from bzrlib import (
31
32
    debug,
32
33
    progress,
33
34
    osutils,
34
 
    symbol_versioning,
35
35
    trace,
36
36
    )
37
37
 
304
304
        # we need one extra space for terminals that wrap on last char
305
305
        w = osutils.terminal_width() 
306
306
        if w is None:
307
 
            return w
 
307
            return None
308
308
        else:
309
309
            return w - 1
310
310
 
311
311
    def _show_line(self, s):
 
312
        # sys.stderr.write("progress %r\n" % s)
 
313
        width = self._avail_width()
 
314
        if width is not None:
 
315
            s = '%-*.*s' % (width, width, s)
312
316
        self._term_file.write('\r' + s + '\r')
313
317
 
314
318
    def clear(self):