From 70bf03a91044f338aed8acd819c15dc8d5968103 Mon Sep 17 00:00:00 2001 From: "glatzor@ubuntu.com" <> Date: Wed, 2 Aug 2006 18:10:58 +0200 Subject: * Use a close button instead of an ok one in an error dialog --- software-properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/software-properties b/software-properties index f21a5b52..d447ebbc 100644 --- a/software-properties +++ b/software-properties @@ -56,9 +56,9 @@ if __name__ == "__main__": (options, args) = parser.parse_args() # Check for root permissions if os.geteuid() != 0: - dialog = gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, + dialog = gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE, _("You need to be root to run this program") ) - dialog.set_default_response(gtk.RESPONSE_OK) + dialog.set_default_response(gtk.RESPONSE_CLOSE) dialog.run() dialog.destroy() sys.exit(1) -- cgit v1.2.3 From c0e73bb5c6213aa0bc9e0609f9f1d7da254ea2b1 Mon Sep 17 00:00:00 2001 From: "glatzor@ubuntu.com" <> Date: Wed, 2 Aug 2006 20:21:34 +0200 Subject: * replace tabs by spaces * use the insensitive state instead of yellow for the headers to be theming neutral * set the details notebook to insensitive if a header is selected * wording changes for the headers --- UpdateManager/UpdateManager.py | 76 ++++++++++++++++++++++++------------------ 1 file changed, 43 insertions(+), 33 deletions(-) diff --git a/UpdateManager/UpdateManager.py b/UpdateManager/UpdateManager.py index 2e2433a8..be9434ae 100644 --- a/UpdateManager/UpdateManager.py +++ b/UpdateManager/UpdateManager.py @@ -29,9 +29,9 @@ import gtk import gtk.gdk import gtk.glade try: - import gconf + import gconf except: - import fakegconf as gconf + import fakegconf as gconf import gobject import apt import apt_pkg @@ -200,12 +200,14 @@ class MyCache(apt.Cache): lock.release() class UpdateList: - ORIGIN_MAPPING = { ("edgy-security","Ubuntu"): _("Ubuntu security updates"), - ("edgy-updates","Ubuntu"): _("Ubuntu important updates"), - ("edgy-backports","Ubuntu"): _("Ubuntu backports"), - ("edgy","Ubuntu"): _("Ubuntu updates") - } - + ORIGIN_MAPPING = { ("edgy-security","Ubuntu"): _("Important security " + "updates of Ubuntu"), + ("edgy-updates","Ubuntu"): _("Recommended updates " + "of Ubuntu"), + ("edgy-backports","Ubuntu"): _("Backports of Ubuntu"), + ("edgy","Ubuntu"): _("Updates of Ubuntu") + } + def __init__(self, parent_window): # a map of packages under their origin self.pkgs = {} @@ -222,14 +224,15 @@ class UpdateList: # sort by origin for pkg in cache: if pkg.markedUpgrade or pkg.markedInstall: - originstr = _("Unknown") - for aorigin in pkg.candidateOrigin: - archive = aorigin.archive - origin = aorigin.origin - if self.ORIGIN_MAPPING.has_key((archive,origin)) and aorigin.trusted: - originstr = self.ORIGIN_MAPPING[(archive,origin)] + # TRANSLATORS: updates from an 'unknown' origin + originstr = _("Other updates") + for aorigin in pkg.candidateOrigin: + archive = aorigin.archive + origin = aorigin.origin + if self.ORIGIN_MAPPING.has_key((archive,origin)) and aorigin.trusted: + originstr = self.ORIGIN_MAPPING[(archive,origin)] if not self.pkgs.has_key(originstr): - self.pkgs[originstr] = [] + self.pkgs[originstr] = [] self.pkgs[originstr].append(pkg) self.num_updates = self.num_updates + 1 elif pkg.isUpgradable: @@ -320,11 +323,11 @@ class UpdateManager(SimpleGladeApp): self.treeview_update.set_headers_clickable(True); tr = gtk.CellRendererText() - tr.set_property("xpad", 10) - tr.set_property("ypad", 10) + tr.set_property("xpad", 6) + tr.set_property("ypad", 6) cr = gtk.CellRendererToggle() cr.set_property("activatable", True) - cr.set_property("xpad", 10) + cr.set_property("xpad", 6) cr.connect("toggled", self.toggled) column_install = gtk.TreeViewColumn("Install", cr) @@ -378,13 +381,13 @@ class UpdateManager(SimpleGladeApp): self.restore_state() self.window_main.show() - def header_column_func(self, cell_layot, renderer, model, iter): + def header_column_func(self, cell_layout, renderer, model, iter): pkg = model.get_value(iter, LIST_PKG) if pkg == None: - renderer.set_property("cell-background","yellow") + renderer.set_property("sensitive", False) else: - renderer.set_property("cell-background", None) - + renderer.set_property("sensitive", True) + def install_column_view_func(self, cell_layout, renderer, model, iter): self.header_column_func(cell_layout, renderer, model, iter) pkg = model.get_value(iter, LIST_PKG) @@ -463,11 +466,15 @@ class UpdateManager(SimpleGladeApp): # set descr pkg = model.get_value(iter, LIST_PKG) - if pkg == None: + if pkg == None or pkg.description == None: + changes_buffer = self.textview_changes.get_buffer() + changes_buffer.set_text("") + desc_buffer = self.textview_descr.get_buffer() + desc_buffer.set_text("") + self.notebook_details.set_sensitive(False) return long_desc = pkg.description - if long_desc == None: - return + self.notebook_details.set_sensitive(True) # Skip the first line - it's a duplicate of the summary i = long_desc.find("\n") long_desc = long_desc[i+1:] @@ -694,15 +701,18 @@ class UpdateManager(SimpleGladeApp): if self.list.num_updates > 0: i=0 for origin in self.list.pkgs.keys(): - self.store.append([False, '%s' % origin, origin, None]) + self.store.append([False,'%s' % origin, origin, None]) for pkg in self.list.pkgs[origin]: - name = xml.sax.saxutils.escape(pkg.name) - summary = xml.sax.saxutils.escape(pkg.summary) - contents = "%s\n%s\n\n" % (name, summary) - contents = contents + _("New version: %s (Size: %s)") % (pkg.candidateVersion,apt.SizeToStr(pkg.packageSize)) + "" - iter = self.store.append([True, contents, pkg.name, pkg]) - self.add_update(pkg) - i = i + 1 + name = xml.sax.saxutils.escape(pkg.name) + summary = xml.sax.saxutils.escape(pkg.summary) + contents = "%s\n%s\n" % (name, summary) + contents = contents + _("From version %s to %s (Size: %s)") % \ + (pkg.installedVersion, + pkg.candidateVersion, + apt.SizeToStr(pkg.packageSize)) + "" + iter = self.store.append([True, contents, pkg.name, pkg]) + self.add_update(pkg) + i = i + 1 self.update_count() # use the normal cursor -- cgit v1.2.3 From 1b2f3650122a3c7d1997287b8d915f9f54402549 Mon Sep 17 00:00:00 2001 From: "glatzor@ubuntu.com" <> Date: Wed, 2 Aug 2006 21:41:27 +0200 Subject: * use -s option instead of the pipe to cut to get lsb information * make the origin matcher distribution neutral * introduce a UpdateOrigin class to make the origins sortable (by importance) --- UpdateManager/Common/DistInfo.py | 2 +- UpdateManager/Common/aptsources.py | 2 +- UpdateManager/UpdateManager.py | 43 +++++++++++++++++++++++++------------- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/UpdateManager/Common/DistInfo.py b/UpdateManager/Common/DistInfo.py index 7d2d37ad..79d5356c 100644 --- a/UpdateManager/Common/DistInfo.py +++ b/UpdateManager/Common/DistInfo.py @@ -56,7 +56,7 @@ class DistInfo: self.suites = [] if not dist: - pipe = os.popen("lsb_release -i | cut -d : -f 2-") + pipe = os.popen("lsb_release -i -s") dist = pipe.read().strip() pipe.close() del pipe diff --git a/UpdateManager/Common/aptsources.py b/UpdateManager/Common/aptsources.py index 3d317b15..fd77fe63 100644 --- a/UpdateManager/Common/aptsources.py +++ b/UpdateManager/Common/aptsources.py @@ -452,7 +452,7 @@ class Distribution: # get the LSB information lsb_info = [] for lsb_option in ["-i", "-c", "-d", "-r"]: - pipe = os.popen("lsb_release %s | cut -d : -f 2-" % lsb_option) + pipe = os.popen("lsb_release %s -s" % lsb_option) lsb_info.append(pipe.read().strip()) del pipe (self.id, self.codename, self.description, self.release) = lsb_info diff --git a/UpdateManager/UpdateManager.py b/UpdateManager/UpdateManager.py index be9434ae..0d50a0cc 100644 --- a/UpdateManager/UpdateManager.py +++ b/UpdateManager/UpdateManager.py @@ -200,19 +200,31 @@ class MyCache(apt.Cache): lock.release() class UpdateList: - ORIGIN_MAPPING = { ("edgy-security","Ubuntu"): _("Important security " - "updates of Ubuntu"), - ("edgy-updates","Ubuntu"): _("Recommended updates " - "of Ubuntu"), - ("edgy-backports","Ubuntu"): _("Backports of Ubuntu"), - ("edgy","Ubuntu"): _("Updates of Ubuntu") - } + class UpdateOrigin: + def __init__(self, desc, importance): + self.packages = [] + self.importance = importance + self.description = desc def __init__(self, parent_window): # a map of packages under their origin + pipe = os.popen("lsb_release -c -s") + dist = pipe.read().strip() + del pipe + + templates = [("%s-security" % dist,"Ubuntu", _("Important security updates " + "of Ubuntu"), 0), + ("%s-updates" % dist,"Ubuntu", _("Recommended updates of " + "Ubuntu"), 1), + ("%s-backports" % dist,"Ubuntu", _("Backports of Ubuntu"), 2), + (dist,"Ubuntu", _("Updates of Ubuntu"), 3)] + self.pkgs = {} + self.matcher = {} self.num_updates = 0 self.parent_window = parent_window + for (origin, archive, desc, importance) in templates: + self.matcher[(origin, archive)] = self.UpdateOrigin(desc, importance) def update(self, cache): held_back = [] @@ -229,11 +241,11 @@ class UpdateList: for aorigin in pkg.candidateOrigin: archive = aorigin.archive origin = aorigin.origin - if self.ORIGIN_MAPPING.has_key((archive,origin)) and aorigin.trusted: - originstr = self.ORIGIN_MAPPING[(archive,origin)] - if not self.pkgs.has_key(originstr): - self.pkgs[originstr] = [] - self.pkgs[originstr].append(pkg) + if self.matcher.has_key((archive,origin)) and aorigin.trusted: + origin_node = self.matcher[(archive,origin)] + if not self.pkgs.has_key(origin_node): + self.pkgs[origin_node] = [] + self.pkgs[origin_node].append(pkg) self.num_updates = self.num_updates + 1 elif pkg.isUpgradable: held_back.append(pkg.name) @@ -700,8 +712,11 @@ class UpdateManager(SimpleGladeApp): self.list.update(self.cache) if self.list.num_updates > 0: i=0 - for origin in self.list.pkgs.keys(): - self.store.append([False,'%s' % origin, origin, None]) + origin_list = self.list.pkgs.keys() + origin_list.sort(lambda x,y: cmp(x.importance,y.importance)) + for origin in origin_list: + self.store.append([False,'%s' % origin.description, + origin.description, None]) for pkg in self.list.pkgs[origin]: name = xml.sax.saxutils.escape(pkg.name) summary = xml.sax.saxutils.escape(pkg.summary) -- cgit v1.2.3 From 56982bdf99d01d3d1a449afec5e9d1277179f6c7 Mon Sep 17 00:00:00 2001 From: "glatzor@ubuntu.com" <> Date: Wed, 2 Aug 2006 22:24:11 +0200 Subject: * support unkown origins with the UpdateOrigin class * don't use the length of the store as number of updates since it now also includes the headers * fix an indention bug that was introduced by the tab replacing in the previous commit --- UpdateManager/UpdateManager.py | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/UpdateManager/UpdateManager.py b/UpdateManager/UpdateManager.py index 0d50a0cc..54b892a1 100644 --- a/UpdateManager/UpdateManager.py +++ b/UpdateManager/UpdateManager.py @@ -65,6 +65,8 @@ import GtkProgress from MetaRelease import Dist, MetaRelease +#import pdb + # FIXME: # - kill "all_changes" and move the changes into the "Update" class @@ -212,12 +214,12 @@ class UpdateList: dist = pipe.read().strip() del pipe - templates = [("%s-security" % dist,"Ubuntu", _("Important security updates " - "of Ubuntu"), 0), - ("%s-updates" % dist,"Ubuntu", _("Recommended updates of " - "Ubuntu"), 1), - ("%s-backports" % dist,"Ubuntu", _("Backports of Ubuntu"), 2), - (dist,"Ubuntu", _("Updates of Ubuntu"), 3)] + templates = [("%s-security" % dist, "Ubuntu", _("Important security updates" + " 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)] self.pkgs = {} self.matcher = {} @@ -225,6 +227,7 @@ class UpdateList: self.parent_window = parent_window for (origin, archive, desc, importance) in templates: self.matcher[(origin, archive)] = self.UpdateOrigin(desc, importance) + self.unknown_origin = self.UpdateOrigin(_("Other updates"), -1) def update(self, cache): held_back = [] @@ -238,11 +241,13 @@ class UpdateList: if pkg.markedUpgrade or pkg.markedInstall: # TRANSLATORS: updates from an 'unknown' origin originstr = _("Other updates") - for aorigin in pkg.candidateOrigin: - archive = aorigin.archive - origin = aorigin.origin - if self.matcher.has_key((archive,origin)) and aorigin.trusted: - origin_node = self.matcher[(archive,origin)] + for aorigin in pkg.candidateOrigin: + archive = aorigin.archive + origin = aorigin.origin + if self.matcher.has_key((archive,origin)) and aorigin.trusted: + origin_node = self.matcher[(archive,origin)] + else: + origin_node = self.unknown_origin if not self.pkgs.has_key(origin_node): self.pkgs[origin_node] = [] self.pkgs[origin_node].append(pkg) @@ -575,8 +580,8 @@ class UpdateManager(SimpleGladeApp): text_header = "" + \ gettext.ngettext("You can install %s update", "You can install %s updates", - len(self.store)) % \ - len(self.store) + "" + self.list.num_updates) % \ + self.list.num_updates + "" text_download = _("Download size: %s") % apt_pkg.SizeToStr(self.dl_size) self.notebook_details.set_sensitive(True) self.treeview_update.set_sensitive(True) @@ -725,9 +730,9 @@ class UpdateManager(SimpleGladeApp): (pkg.installedVersion, pkg.candidateVersion, apt.SizeToStr(pkg.packageSize)) + "" - iter = self.store.append([True, contents, pkg.name, pkg]) - self.add_update(pkg) - i = i + 1 + iter = self.store.append([True, contents, pkg.name, pkg]) + self.add_update(pkg) + i = i + 1 self.update_count() # use the normal cursor -- cgit v1.2.3 From bf5a9a34dd327e858e741be1e8925584c8c88cb6 Mon Sep 17 00:00:00 2001 From: "glatzor@ubuntu.com" <> Date: Wed, 2 Aug 2006 23:34:19 +0200 Subject: * Handle to be newly installed "updates" in the version string information * Add a unit b for Bytes to the download size --- UpdateManager/UpdateManager.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/UpdateManager/UpdateManager.py b/UpdateManager/UpdateManager.py index 54b892a1..4da00664 100644 --- a/UpdateManager/UpdateManager.py +++ b/UpdateManager/UpdateManager.py @@ -726,10 +726,16 @@ class UpdateManager(SimpleGladeApp): name = xml.sax.saxutils.escape(pkg.name) summary = xml.sax.saxutils.escape(pkg.summary) contents = "%s\n%s\n" % (name, summary) - contents = contents + _("From version %s to %s (Size: %s)") % \ - (pkg.installedVersion, - pkg.candidateVersion, - apt.SizeToStr(pkg.packageSize)) + "" + if pkg.installedVersion != None: + contents += _("From version %s to %s") % \ + (pkg.installedVersion, + pkg.candidateVersion) + else: + contents += _("Version %s") % pkg.candidateVersion + #TRANSLATORS: the b stands for Bytes + contents += " " + _("(Size: %sb)") % apt.SizeToStr(pkg.packageSize) + contents += "" + iter = self.store.append([True, contents, pkg.name, pkg]) self.add_update(pkg) i = i + 1 -- cgit v1.2.3 From fd77ff614878cce61d9b051efa1b8912f4f8a16f Mon Sep 17 00:00:00 2001 From: "glatzor@ubuntu.com" <> Date: Wed, 2 Aug 2006 23:35:07 +0200 Subject: * Also add the bytes unit to the total download size --- UpdateManager/UpdateManager.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/UpdateManager/UpdateManager.py b/UpdateManager/UpdateManager.py index 4da00664..e16c2901 100644 --- a/UpdateManager/UpdateManager.py +++ b/UpdateManager/UpdateManager.py @@ -548,7 +548,8 @@ class UpdateManager(SimpleGladeApp): if name in self.packages: self.packages.remove(name) self.dl_size -= pkg.packageSize - self.label_downsize.set_markup(_("Download size: %s" % \ + # TRANSLATORS: b stands for Bytes + self.label_downsize.set_markup(_("Download size: %sb" % \ apt_pkg.SizeToStr(self.dl_size))) if len(self.packages) == 0: self.button_install.set_sensitive(False) -- cgit v1.2.3 From e1563be06f8e49bc974c3d35874e8464c21b1911 Mon Sep 17 00:00:00 2001 From: "glatzor@ubuntu.com" <> Date: Thu, 3 Aug 2006 01:46:29 +0200 Subject: * wording: "Downloadable software" -> "Internet" (awkward... really awkward...) --- data/glade/SoftwareProperties.glade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/glade/SoftwareProperties.glade b/data/glade/SoftwareProperties.glade index d262980d..f280f8a3 100644 --- a/data/glade/SoftwareProperties.glade +++ b/data/glade/SoftwareProperties.glade @@ -189,7 +189,7 @@ True - <b>Downloadable software</b> + <b>Internet</b> False True GTK_JUSTIFY_LEFT -- cgit v1.2.3 From 4a5e26b3793e366c0dcdd0b3017bff421673a5f4 Mon Sep 17 00:00:00 2001 From: "glatzor@ubuntu.com" <> Date: Thu, 3 Aug 2006 13:24:16 +0200 Subject: * reverse the ording of the importance --- UpdateManager/UpdateManager.py | 1 + 1 file changed, 1 insertion(+) diff --git a/UpdateManager/UpdateManager.py b/UpdateManager/UpdateManager.py index e16c2901..126bfa8f 100644 --- a/UpdateManager/UpdateManager.py +++ b/UpdateManager/UpdateManager.py @@ -720,6 +720,7 @@ class UpdateManager(SimpleGladeApp): i=0 origin_list = self.list.pkgs.keys() origin_list.sort(lambda x,y: cmp(x.importance,y.importance)) + origin_list.reverse() for origin in origin_list: self.store.append([False,'%s' % origin.description, origin.description, None]) -- cgit v1.2.3