[Pkg-bazaar-commits] ./bzr-gtk/unstable r249: Add gselftest command
Aaron Bentley
abentley at panoramicfeedback.com
Fri Apr 10 07:49:27 UTC 2009
------------------------------------------------------------
revno: 249
committer: Aaron Bentley <abentley at panoramicfeedback.com>
branch nick: gtk
timestamp: Mon 2007-07-23 13:17:12 -0400
message:
Add gselftest command
modified:
__init__.py
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py 2007-07-23 14:38:44 +0000
+++ b/__init__.py 2007-07-23 17:17:12 +0000
@@ -76,6 +76,7 @@
lazy_import(globals(), """
from bzrlib import (
branch,
+ builtins,
errors,
workingtree,
)
@@ -361,7 +362,7 @@
-class cmd_gstatus(GTKCommand):
+class cmd_gstatus(Command):
"""GTK+ status dialog
Graphical user interface for showing status
@@ -556,6 +557,35 @@
register_command(cmd_commit_notify)
+class cmd_gselftest(GTKCommand):
+ """Version of selftest that displays a notification at the end"""
+
+ takes_args = builtins.cmd_selftest.takes_args
+ takes_options = builtins.cmd_selftest.takes_options
+ _see_also = ['selftest']
+
+ def run(self, *args, **kwargs):
+ import cgi
+ # prevent gtk from blowing up later
+ gtk = import_pygtk()
+ import pynotify
+ import pkg_resources
+ result = builtins.cmd_selftest().run(*args, **kwargs)
+ if result == 0:
+ summary = 'Success'
+ body = 'Selftest succeeded in "%s"' % os.getcwd()
+ if result == 1:
+ summary = 'Failure'
+ body = 'Selftest failed in "%s"' % os.getcwd()
+ pynotify.init("bzr gselftest")
+ note = pynotify.Notification(cgi.escape(summary), cgi.escape(body))
+ note.set_timeout(pynotify.EXPIRES_NEVER)
+ note.show()
+
+
+register_command(cmd_gselftest)
+
+
import gettext
gettext.install('olive-gtk')
More information about the Pkg-bazaar-commits
mailing list