~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/ui/text.py

  • Committer: Martin Pool
  • Date: 2010-01-15 03:15:27 UTC
  • mto: This revision was merged to the branch mainline in revision 4967.
  • Revision ID: mbp@sourcefrog.net-20100115031527-067m8b886zuuiax2
quietness-state is now tracked on UIFactory

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2008, 2009 Canonical Ltd
 
1
# Copyright (C) 2005, 2008, 2009, 2010 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
61
61
        # paints progress, network activity, etc
62
62
        self._progress_view = self.make_progress_view()
63
63
        
 
64
    def be_quiet(self, state):
 
65
        if state and not self._quiet:
 
66
            self.clear_term()
 
67
        # make a new one, possibly a silent one
 
68
        self._progress_view = self.make_progress_view()
 
69
        UIFactory.be_quiet(self, state)
 
70
 
64
71
    def clear_term(self):
65
72
        """Prepare the terminal for output.
66
73
 
146
153
    def make_progress_view(self):
147
154
        """Construct and return a new ProgressView subclass for this UI.
148
155
        """
149
 
        # if the user specifically requests either text or no progress bars,
150
 
        # always do that.  otherwise, guess based on $TERM and tty presence.
151
 
        if os.environ.get('BZR_PROGRESS_BAR') == 'text':
 
156
        # with --quiet, never any progress view
 
157
        # <https://bugs.edge.launchpad.net/bzr/+bug/320035>.  Otherwise if the
 
158
        # user specifically requests either text or no progress bars, always
 
159
        # do that.  otherwise, guess based on $TERM and tty presence.
 
160
        if self.is_quiet():
 
161
            return NullProgressView()
 
162
        elif os.environ.get('BZR_PROGRESS_BAR') == 'text':
152
163
            return TextProgressView(self.stderr)
153
164
        elif os.environ.get('BZR_PROGRESS_BAR') == 'none':
154
165
            return NullProgressView()