From 61a31cd6ae420f9f7b7da5384196c7e8cb8ae485 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Sun, 8 Jul 2012 07:19:55 +0100 Subject: [PATCH] Tell the user when a background update completes, not when it starts The systray icon still shows when a download is happening, but there's no need to bother the user with a full notification box. For applications, notify the user if the selections change (even if we didn't download anything new). --- zeroinstall/apps.py | 2 +- zeroinstall/injector/background.py | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/zeroinstall/apps.py b/zeroinstall/apps.py index 9ff913f..f500e13 100644 --- a/zeroinstall/apps.py +++ b/zeroinstall/apps.py @@ -138,7 +138,7 @@ class App: self.set_last_check_attempt() from zeroinstall.injector import background r = self.get_requirements() - background.spawn_background_update2(r, True, self) + background.spawn_background_update2(r, False, self) def set_requirements(self, requirements): import json diff --git a/zeroinstall/injector/background.py b/zeroinstall/injector/background.py index ff917e1..c55f494 100644 --- a/zeroinstall/injector/background.py +++ b/zeroinstall/injector/background.py @@ -217,9 +217,10 @@ def _check_for_updates(requirements, verbose, app): tasks.wait_for_blocker(refresh) if background_handler.need_gui or driver.get_uncached_implementations(): - background_handler.notify("Zero Install", - _("Updates ready to download for '%s'.") % root_iface, - timeout = 1) + if verbose: + background_handler.notify("Zero Install", + _("Updates ready to download for '%s'.") % root_iface, + timeout = 1) if os.environ.get('DISPLAY', None): # Run the GUI... @@ -231,6 +232,11 @@ def _check_for_updates(requirements, verbose, app): else: tasks.wait_for_blocker(driver.download_uncached_implementations()) new_sels = driver.solver.selections + + if app is None: + background_handler.notify("Zero Install", + _("{name} updated.").format(name = root_iface), + timeout = 1) else: if verbose: background_handler.notify("Zero Install", _("No updates to download."), timeout = 1) @@ -241,6 +247,9 @@ def _check_for_updates(requirements, verbose, app): from zeroinstall.support import xmltools if not xmltools.nodes_equal(new_sels.toDOM(), old_sels.toDOM()): app.set_selections(new_sels) + background_handler.notify("Zero Install", + _("{app} updated.").format(app = app.get_name()), + timeout = 1) app.set_last_checked() sys.exit(0) -- 2.11.4.GIT