~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/progress.py

  • Committer: Robert Collins
  • Date: 2006-02-16 05:54:02 UTC
  • mto: (1534.1.24 integration)
  • mto: This revision was merged to the branch mainline in revision 1554.
  • Revision ID: robertc@robertcollins.net-20060216055402-bb6afc4d15c715cd
split out converter logic into per-format objects.

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
                 show_spinner=False,
70
70
                 show_eta=True,
71
71
                 show_bar=True,
72
 
                 show_count=True):
 
72
                 show_count=True,
 
73
                 to_messages_file=sys.stdout):
73
74
        object.__init__(self)
74
75
        self.to_file = to_file
75
 
 
 
76
        self.to_messages_file = to_messages_file
76
77
        self.last_msg = None
77
78
        self.last_cnt = None
78
79
        self.last_total = None
82
83
        self.show_bar = show_bar
83
84
        self.show_count = show_count
84
85
 
 
86
    def note(self, fmt_string, *args, **kwargs):
 
87
        """Record a note without disrupting the progress bar."""
 
88
        self.clear()
 
89
        self.to_messages_file.write(fmt_string % args)
 
90
        self.to_messages_file.write('\n')
85
91
 
86
92
 
87
93
class DummyProgress(_BaseProgressBar):
98
104
    def clear(self):
99
105
        pass
100
106
        
 
107
    def note(self, fmt_string, *args, **kwargs):
 
108
        """See _BaseProgressBar.note()."""
101
109
    
102
110
class DotsProgressBar(_BaseProgressBar):
103
111
    def __init__(self, **kwargs):
255
263
        self.to_file.write('\r' + m.ljust(self.width - 1))
256
264
        #self.to_file.flush()
257
265
            
258
 
 
259
266
    def clear(self):        
260
267
        self.to_file.write('\r%s\r' % (' ' * (self.width - 1)))
261
268
        #self.to_file.flush()        
262
 
    
263
269
 
264
270
        
265
271
def str_tdelta(delt):