~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/ui/__init__.py

  • Committer: Martin Pool
  • Date: 2009-09-23 06:25:16 UTC
  • mto: This revision was merged to the branch mainline in revision 4745.
  • Revision ID: mbp@sourcefrog.net-20090923062516-3fi9kj18c0yuhd5w
Add UIFactory.show_error, show_warning, show_message

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 CLIUIFactory(UIFactory):
318
334
    def get_username(self, prompt, **kwargs):
319
335
        return None
320
336
 
 
337
    def show_error(self, msg):
 
338
        pass
 
339
 
321
340
 
322
341
class CannedInputUIFactory(SilentUIFactory):
323
342
    """A silent UI that return canned input."""