[Pkg-bazaar-commits] ./bzr-gtk/unstable r514: Merge bzr-notify splitout.

Jelmer Vernooij jelmer at samba.org
Fri Apr 10 07:50:36 UTC 2009


------------------------------------------------------------
revno: 514
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Mon 2008-06-30 00:27:57 +0200
message:
  Merge bzr-notify splitout.
added:
  bzr-notify
modified:
  NEWS
  __init__.py
  setup.py
    ------------------------------------------------------------
    revno: 505.1.3
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: trayicon
    timestamp: Fri 2008-06-27 19:10:27 +0200
    message:
      Move notify icon to a separate script so it's easier to add to startup scripts.
    added:
      bzr-notify
    modified:
      __init__.py
    ------------------------------------------------------------
    revno: 505.1.4
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: trayicon
    timestamp: Fri 2008-06-27 19:11:11 +0200
    message:
      Update NEWS.
    modified:
      NEWS
    ------------------------------------------------------------
    revno: 505.1.5
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: trayicon
    timestamp: Fri 2008-06-27 19:32:10 +0200
    message:
      Install bzr-notify.
    modified:
      setup.py
    ------------------------------------------------------------
    revno: 505.1.6
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: trayicon
    timestamp: Sat 2008-06-28 17:33:45 +0200
    message:
      Merge trunk.
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2008-06-29 22:19:23 +0000
+++ b/NEWS	2008-06-29 22:27:57 +0000
@@ -12,6 +12,12 @@
 
   * Fix history mode button. (Jasper Groenewegen, #144962)
 
+  * Fixed handle-patch script. (Jelmer Vernooij)
+
+ CHANGES
+
+  * Moved notify icon code to separate script. (Jelmer Vernooij)
+
  INTERNALS
 
   * All i18n calls should now go through _i18n which must be imported from

=== modified file '__init__.py'
--- a/__init__.py	2008-06-27 16:53:56 +0000
+++ b/__init__.py	2008-06-27 17:10:27 +0000
@@ -15,7 +15,6 @@
 """Graphical support for Bazaar using GTK.
 
 This plugin includes:
-commit-notify     Start the graphical notifier of commits.
 gannotate         GTK+ annotate. 
 gbranch           GTK+ branching. 
 gcheckout         GTK+ checkout. 
@@ -525,77 +524,6 @@
     register_command(cmd)
 
 
-class cmd_commit_notify(GTKCommand):
-    """Run the bzr commit notifier.
-
-    This is a background program which will pop up a notification on the users
-    screen when a commit occurs.
-    """
-
-    def run(self):
-        from notify import NotifyPopupMenu
-        gtk = open_display()
-        menu = NotifyPopupMenu()
-        icon = gtk.status_icon_new_from_file(icon_path("bzr-icon-64.png"))
-        icon.connect('popup-menu', menu.display)
-
-        import cgi
-        import dbus
-        import dbus.service
-        import pynotify
-        from bzrlib.bzrdir import BzrDir
-        from bzrlib import errors
-        from bzrlib.osutils import format_date
-        from bzrlib.transport import get_transport
-        if getattr(dbus, 'version', (0,0,0)) >= (0,41,0):
-            import dbus.glib
-        BROADCAST_INTERFACE = "org.bazaarvcs.plugins.dbus.Broadcast"
-        bus = dbus.SessionBus()
-
-        def catch_branch(revision_id, urls):
-            # TODO: show all the urls, or perhaps choose the 'best'.
-            url = urls[0]
-            try:
-                if isinstance(revision_id, unicode):
-                    revision_id = revision_id.encode('utf8')
-                transport = get_transport(url)
-                a_dir = BzrDir.open_from_transport(transport)
-                branch = a_dir.open_branch()
-                revno = branch.revision_id_to_revno(revision_id)
-                revision = branch.repository.get_revision(revision_id)
-                summary = 'New revision %d in %s' % (revno, url)
-                body  = 'Committer: %s\n' % revision.committer
-                body += 'Date: %s\n' % format_date(revision.timestamp,
-                    revision.timezone)
-                body += '\n'
-                body += revision.message
-                body = cgi.escape(body)
-                nw = pynotify.Notification(summary, body)
-                def start_viz(notification=None, action=None, data=None):
-                    """Start the viz program."""
-                    pp = start_viz_window(branch, revision_id)
-                    pp.show()
-                def start_branch(notification=None, action=None, data=None):
-                    """Start a Branch dialog"""
-                    from bzrlib.plugins.gtk.branch import BranchDialog
-                    bd = BranchDialog(remote_path=url)
-                    bd.run()
-                nw.add_action("inspect", "Inspect", start_viz, None)
-                nw.add_action("branch", "Branch", start_branch, None)
-                nw.set_timeout(5000)
-                nw.show()
-            except Exception, e:
-                print e
-                raise
-        bus.add_signal_receiver(catch_branch,
-                                dbus_interface=BROADCAST_INTERFACE,
-                                signal_name="Revision")
-        pynotify.init("bzr commit-notify")
-        gtk.main()
-
-register_command(cmd_commit_notify)
-
-
 class cmd_gselftest(GTKCommand):
     """Version of selftest that displays a notification at the end"""
 

=== added file 'bzr-notify'
--- a/bzr-notify	1970-01-01 00:00:00 +0000
+++ b/bzr-notify	2008-06-27 17:10:27 +0000
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+
+"""Run the bzr tray icon.
+
+This is a background program which will pop up a notification on the users
+screen when a commit occurs.
+"""
+
+from bzrlib.plugin import load_plugins
+load_plugins()
+
+from bzrlib.plugins.gtk import open_display, icon_path
+
+from notify import NotifyPopupMenu
+gtk = open_display()
+menu = NotifyPopupMenu()
+icon = gtk.status_icon_new_from_file(icon_path("bzr-icon-64.png"))
+icon.connect('popup-menu', menu.display)
+
+import cgi
+import dbus
+import dbus.service
+import pynotify
+from bzrlib.bzrdir import BzrDir
+from bzrlib import errors
+from bzrlib.osutils import format_date
+from bzrlib.transport import get_transport
+if getattr(dbus, 'version', (0,0,0)) >= (0,41,0):
+	import dbus.glib
+BROADCAST_INTERFACE = "org.bazaarvcs.plugins.dbus.Broadcast"
+bus = dbus.SessionBus()
+
+def catch_branch(revision_id, urls):
+	# TODO: show all the urls, or perhaps choose the 'best'.
+	url = urls[0]
+	try:
+		if isinstance(revision_id, unicode):
+			revision_id = revision_id.encode('utf8')
+		transport = get_transport(url)
+		a_dir = BzrDir.open_from_transport(transport)
+		branch = a_dir.open_branch()
+		revno = branch.revision_id_to_revno(revision_id)
+		revision = branch.repository.get_revision(revision_id)
+		summary = 'New revision %d in %s' % (revno, url)
+		body  = 'Committer: %s\n' % revision.committer
+		body += 'Date: %s\n' % format_date(revision.timestamp,
+			revision.timezone)
+		body += '\n'
+		body += revision.message
+		body = cgi.escape(body)
+		nw = pynotify.Notification(summary, body)
+		def start_viz(notification=None, action=None, data=None):
+			"""Start the viz program."""
+			pp = start_viz_window(branch, revision_id)
+			pp.show()
+		def start_branch(notification=None, action=None, data=None):
+			"""Start a Branch dialog"""
+			from bzrlib.plugins.gtk.branch import BranchDialog
+			bd = BranchDialog(remote_path=url)
+			bd.run()
+		nw.add_action("inspect", "Inspect", start_viz, None)
+		nw.add_action("branch", "Branch", start_branch, None)
+		nw.set_timeout(5000)
+		nw.show()
+	except Exception, e:
+		print e
+		raise
+bus.add_signal_receiver(catch_branch,
+						dbus_interface=BROADCAST_INTERFACE,
+						signal_name="Revision")
+pynotify.init("bzr-notify")
+gtk.main()

=== modified file 'setup.py'
--- a/setup.py	2008-06-27 16:53:56 +0000
+++ b/setup.py	2008-06-27 17:32:10 +0000
@@ -96,7 +96,7 @@
     maintainer_email = "jelmer at samba.org",
     description = "GTK+ Frontends for various Bazaar commands",
     license = "GNU GPL v2 or later",
-    scripts=['olive-gtk', 'bzr-handle-patch'],
+    scripts=['olive-gtk', 'bzr-handle-patch', 'bzr-notify'],
     package_dir = {
         "bzrlib.plugins.gtk": ".",
         "bzrlib.plugins.gtk.viz": "viz", 



More information about the Pkg-bazaar-commits mailing list