~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/ui/text.py

  • Committer: Martin Pool
  • Date: 2009-03-10 06:55:49 UTC
  • mto: This revision was merged to the branch mainline in revision 4123.
  • Revision ID: mbp@sourcefrog.net-20090310065549-kwkxp2fcui3p8qy8
Show the progress bar part when showing activity by default

Show diffs side-by-side

added added

removed removed

Lines of Context:
146
146
 
147
147
    def _render_bar(self):
148
148
        # return a string for the progress bar itself
149
 
        if (self._last_task is not None) and self._last_task.show_bar:
 
149
        if (self._last_task is None) or self._last_task.show_bar:
 
150
            # If there's no task object, we show space for the bar anyhow.
 
151
            # That's because most invocations of bzr will end showing progress
 
152
            # at some point, though perhaps only after doing some initial IO.
 
153
            # It looks better to draw the progress bar initially rather than
 
154
            # to have what looks like an incomplete progress bar.
150
155
            spin_str =  r'/-\|'[self._spin_pos % 4]
151
156
            self._spin_pos += 1
152
157
            f = self._task_fraction or 0
155
160
            markers = int(round(float(cols) * f)) - 1
156
161
            bar_str = '[' + ('#' * markers + spin_str).ljust(cols) + '] '
157
162
            return bar_str
158
 
        elif (self._last_task is None) or self._last_task.show_spinner:
 
163
        elif self._last_task.show_spinner:
 
164
            # The last task wanted just a spinner, no bar
159
165
            spin_str =  r'/-\|'[self._spin_pos % 4]
160
166
            self._spin_pos += 1
161
167
            return spin_str + ' '