/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/ui/__init__.py

(gz) Allow use of Python arguments preceding bzr script in Windows command
 lines (Jason Spashett)

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
        return self # This is bound to the 'as' clause in a with statement.
 
136
 
 
137
    def __exit__(self, exc_type, exc_val, exc_tb):
 
138
        """Context manager exit support.
 
139
 
 
140
        Override in a concrete factory class if more cleanup than a simple
 
141
        self.clear_term() is needed when the UIFactory is finished with.
 
142
        """
 
143
        self.clear_term()
 
144
        return False # propogate exceptions.
 
145
 
126
146
    def be_quiet(self, state):
127
147
        """Tell the UI to be more quiet, or not.
128
148
 
352
372
                "without an upgrade path.\n" % (inter.target._format,))
353
373
 
354
374
 
355
 
 
356
375
class SilentUIFactory(UIFactory):
357
376
    """A UI Factory which never prints anything.
358
377