diff options
| author | glatzor@ubuntu.com <> | 2006-09-02 11:51:49 +0200 |
|---|---|---|
| committer | glatzor@ubuntu.com <> | 2006-09-02 11:51:49 +0200 |
| commit | b139b31fd1adc363d59338b45b7c82dcec51d44b (patch) | |
| tree | 688ce53f51c39e34c496763b4392b92dbaa393fa /UpdateManager | |
| parent | a53e49c46faae31eccd7e65b8ffbcb91fbcaf18a (diff) | |
| parent | 650cb474d23914be801af09d5f9c31cfc9765b07 (diff) | |
| download | python-apt-b139b31fd1adc363d59338b45b7c82dcec51d44b.tar.gz | |
* merge with mvo
Diffstat (limited to 'UpdateManager')
| -rw-r--r-- | UpdateManager/Common/aptsources.py | 14 | ||||
| -rw-r--r-- | UpdateManager/UpdateManager.py | 39 |
2 files changed, 41 insertions, 12 deletions
diff --git a/UpdateManager/Common/aptsources.py b/UpdateManager/Common/aptsources.py index fd77fe63..80781cb0 100644 --- a/UpdateManager/Common/aptsources.py +++ b/UpdateManager/Common/aptsources.py @@ -209,10 +209,11 @@ class NullMatcher(object): return True class SourcesList: - def __init__(self, withMatcher=True): + def __init__(self, withMatcher=True, + matcherPath="/usr/share/update-manager/channels/"): self.list = [] # of Type SourceEntries if withMatcher: - self.matcher = SourceEntryMatcher() + self.matcher = SourceEntryMatcher(matcherPath) else: self.matcher = NullMatcher() self.refresh() @@ -378,6 +379,7 @@ class SourceCompTemplate: self.on_by_default = on_by_default class SourceEntryTemplates: + def __init__(self,datadir): _ = gettext.gettext self.templates = [] @@ -411,10 +413,10 @@ class SourceEntryMatcher: self.comps = l_comps self.comps_descriptions = l_comps_descr - def __init__(self): + def __init__(self, matcherPath): self.templates = [] # Get the human readable channel and comp names from the channel .infos - spec_files = glob.glob("/usr/share/update-manager/channels/*.info") + spec_files = glob.glob("%s/*.info" % matcherPath) for f in spec_files: f = os.path.basename(f) i = f.find(".info") @@ -440,9 +442,7 @@ class SourceEntryMatcher: class Distribution: def __init__(self): - """" - Container for distribution specific informations - """ + """ Container for distribution specific informations """ # LSB information self.id = "" self.codename = "" diff --git a/UpdateManager/UpdateManager.py b/UpdateManager/UpdateManager.py index 78348e60..3e958db0 100644 --- a/UpdateManager/UpdateManager.py +++ b/UpdateManager/UpdateManager.py @@ -219,8 +219,9 @@ class UpdateList: " of Ubuntu"), 10), ("%s-updates" % dist, "Ubuntu", _("Recommended updates of " "Ubuntu"), 9), - ("%s-backports" % dist, "Ubuntu", _("Backports of Ubuntu"), 8), - (dist, "Ubuntu", _("Updates of Ubuntu"), 7)] + ("%s-proposed" % dist, "Ubuntu", _("Proposed updates for Ubuntu"), 8), + ("%s-backports" % dist, "Ubuntu", _("Backports of Ubuntu"), 7), + (dist, "Ubuntu", _("Updates of Ubuntu"), 6)] self.pkgs = {} self.matcher = {} @@ -671,7 +672,6 @@ class UpdateManager(SimpleGladeApp): apt_pkg.PkgSystemUnLock() except SystemError: pass -# cmd = ["gksu","--", cmd = ["gksu", "--desktop", "/usr/share/applications/synaptic.desktop", "--", "/usr/sbin/synaptic", "--hide-main-window", "--non-interactive", "--parent-window-id", "%s" % (id) ] @@ -713,6 +713,9 @@ class UpdateManager(SimpleGladeApp): # don't display apt-listchanges, we already showed the changelog os.environ["APT_LISTCHANGES_FRONTEND"]="none" + # Do not suspend during the update process + (dev, cookie) = self.inhibit_sleep() + # set window to insensitive self.window_main.set_sensitive(False) self.window_main.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) @@ -727,18 +730,44 @@ class UpdateManager(SimpleGladeApp): while gtk.events_pending(): gtk.main_iteration() self.fillstore() + + # Allow suspend after synaptic is finished + if cookie != False: + self.allow_sleep(dev, cookie) self.window_main.set_sensitive(True) self.window_main.window.set_cursor(None) + def inhibit_sleep(self): + """Send a dbus signal to gnome-power-manager to not suspend + the system""" + try: + bus = dbus.Bus(dbus.Bus.TYPE_SESSION) + devobj = bus.get_object('org.gnome.PowerManager', + '/org/gnome/PowerManager') + dev = dbus.Interface(devobj, "org.gnome.PowerManager") + cookie = dev.Inhibit('UpdateManager', 'Updating system') + return (dev, cookie) + except Exception, e: + print "could not send the dbus Inhibit signal: %s" % e + return (False, False) + + def allow_sleep(self, dev, cookie): + """Send a dbus signal to gnome-power-manager to allow a suspending + the system""" + dev.UnInhibit(cookie) + def toggled(self, renderer, path): """ a toggle button in the listview was toggled """ iter = self.store.get_iter(path) + pkg = self.store.get_value(iter, LIST_PKG) + if pkg is None: + return if self.store.get_value(iter, LIST_INSTALL): self.store.set_value(iter, LIST_INSTALL, False) - self.remove_update(self.store.get_value(iter, LIST_PKG)) + self.remove_update(pkg) else: self.store.set_value(iter, LIST_INSTALL, True) - self.add_update(self.store.get_value(iter, LIST_PKG)) + self.add_update(pkg) def on_treeview_update_row_activated(self, treeview, path, column, *args): """ |
