/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

  • Committer: John Arbash Meinel
  • Date: 2009-10-15 20:04:37 UTC
  • mfrom: (4748 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4752.
  • Revision ID: john@arbash-meinel.com-20091015200437-4wweb0t6uzspvv84
Bring in bzr.dev 4748, resolve conflict, update NEWS.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
Several levels are supported, and you can also register new factories such as
23
23
for a GUI.
24
24
 
25
 
UIFactory
 
25
bzrlib.ui.UIFactory
26
26
    Semi-abstract base class
27
27
 
28
 
SilentUIFactory
 
28
bzrlib.ui.SilentUIFactory
29
29
    Produces no output and cannot take any input; useful for programs using
30
30
    bzrlib in batch mode or for programs such as loggerhead.
31
31
 
32
 
CannedInputUIFactory
 
32
bzrlib.ui.CannedInputUIFactory
33
33
    For use in testing; the input values to be returned are provided 
34
34
    at construction.
35
35
 
36
 
TextUIFactory
 
36
bzrlib.ui.text.TextUIFactory
37
37
    Standard text command-line interface, with stdin, stdout, stderr.
38
38
    May make more or less advanced use of them, eg in drawing progress bars,
39
39
    depending on the detected capabilities of the terminal.
208
208
        """
209
209
        pass
210
210
 
 
211
    def show_error(self, msg):
 
212
        """Show an error message (not an exception) to the user.
 
213
        
 
214
        The message should not have an error prefix or trailing newline.  That
 
215
        will be added by the factory if appropriate. 
 
216
        """
 
217
        raise NotImplementedError(self.show_error)
 
218
 
 
219
    def show_message(self, msg):
 
220
        """Show a message to the user."""
 
221
        raise NotImplementedError(self.show_message)
 
222
 
 
223
    def show_warning(self, msg):
 
224
        """Show a warning to the user."""
 
225
        raise NotImplementedError(self.show_warning)
 
226
 
211
227
 
212
228
 
213
229
class SilentUIFactory(UIFactory):
229
245
    def get_username(self, prompt, **kwargs):
230
246
        return None
231
247
 
 
248
    def show_error(self, msg):
 
249
        pass
 
250
 
 
251
    def show_message(self, msg):
 
252
        pass
 
253
 
 
254
    def show_warning(self, msg):
 
255
        pass
 
256
 
232
257
 
233
258
class CannedInputUIFactory(SilentUIFactory):
234
259
    """A silent UI that return canned input."""