~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/ui/__init__.py

  • Committer: Robert Collins
  • Date: 2010-06-21 01:30:45 UTC
  • mfrom: (5309 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5310.
  • Revision ID: robertc@robertcollins.net-20100621013045-s59nfjps3rkcn53j
Merge trunk to fix NEWS sections.

Show diffs side-by-side

added added

removed removed

Lines of Context:
106
106
    This tells the library how to display things to the user.  Through this
107
107
    layer different applications can choose the style of UI.
108
108
 
 
109
    UI Factories are also context managers, for some syntactic sugar some users
 
110
    need.
 
111
 
109
112
    :ivar suppressed_warnings: Identifiers for user warnings that should 
110
113
        no be emitted.
111
114
    """
123
126
        self.suppressed_warnings = set()
124
127
        self._quiet = False
125
128
 
 
129
    def __enter__(self):
 
130
        """Context manager entry support.
 
131
 
 
132
        Override in a concrete factory class if initialisation before use is
 
133
        needed.
 
134
        """
 
135
 
 
136
    def __exit__(self, exc_type, exc_val, exc_tb):
 
137
        """Context manager exit support.
 
138
 
 
139
        Override in a concrete factory class if more cleanup than a simple
 
140
        self.clear_term() is needed when the UIFactory is finished with.
 
141
        """
 
142
        self.clear_term()
 
143
 
126
144
    def be_quiet(self, state):
127
145
        """Tell the UI to be more quiet, or not.
128
146
 
352
370
                "without an upgrade path.\n" % (inter.target._format,))
353
371
 
354
372
 
355
 
 
356
373
class SilentUIFactory(UIFactory):
357
374
    """A UI Factory which never prints anything.
358
375