/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to commands.py

  • Committer: Jelmer Vernooij
  • Date: 2010-12-20 12:57:39 UTC
  • Revision ID: jelmer@samba.org-20101220125739-dbmivdcd030q0uzq
Kill gselftest (it's broken, and there are better subunit-based alternatives).

Show diffs side-by-side

added added

removed removed

Lines of Context:
462
462
        window = TagsWindow(br)
463
463
        window.show()
464
464
        gtk.main()
465
 
 
466
 
 
467
 
class cmd_gselftest(GTKCommand):
468
 
    """Version of selftest that displays a notification at the end"""
469
 
 
470
 
    takes_args = builtins.cmd_selftest.takes_args
471
 
    takes_options = builtins.cmd_selftest.takes_options
472
 
    _see_also = ['selftest']
473
 
 
474
 
    def run(self, *args, **kwargs):
475
 
        import cgi
476
 
        import sys
477
 
        default_encoding = sys.getdefaultencoding()
478
 
        # prevent gtk from blowing up later
479
 
        gtk = import_pygtk()
480
 
        # prevent gtk from messing with default encoding
481
 
        import pynotify
482
 
        if sys.getdefaultencoding() != default_encoding:
483
 
            reload(sys)
484
 
            sys.setdefaultencoding(default_encoding)
485
 
        result = builtins.cmd_selftest().run(*args, **kwargs)
486
 
        if result == 0:
487
 
            summary = 'Success'
488
 
            body = 'Selftest succeeded in "%s"' % os.getcwd()
489
 
        if result == 1:
490
 
            summary = 'Failure'
491
 
            body = 'Selftest failed in "%s"' % os.getcwd()
492
 
        pynotify.init("bzr gselftest")
493
 
        note = pynotify.Notification(cgi.escape(summary), cgi.escape(body))
494
 
        note.set_timeout(pynotify.EXPIRES_NEVER)
495
 
        note.show()