From 2179699f8b08b68be792cb0e5f263931475fc26d Mon Sep 17 00:00:00 2001 From: "glatzor@ubuntu.com" <> Date: Thu, 27 Jul 2006 22:40:09 +0200 Subject: * add an error handler if the locale is not in the iso country list --- SoftwareProperties/SoftwareProperties.py | 12 ++++++++---- SoftwareProperties/aptsources.py | 5 ++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/SoftwareProperties/SoftwareProperties.py b/SoftwareProperties/SoftwareProperties.py index 93028206..9e9071be 100644 --- a/SoftwareProperties/SoftwareProperties.py +++ b/SoftwareProperties/SoftwareProperties.py @@ -292,10 +292,14 @@ class SoftwareProperties(SimpleGladeApp): self.combobox_server.set_model(server_store) server_store.append([_("Main server"), self.distro.main_server]) - # TRANSLATORS: %s is a country - server_store.append([_("Server for %s") % gettext.dgettext("iso-3166", - self.distro.country).rstrip(), - self.distro.nearest_server]) + if self.distro.country != None: + # TRANSLATORS: %s is a country + server_store.append([_("Server for %s") % gettext.dgettext("iso-3166", + self.distro.country).rstrip(), + self.distro.nearest_server]) + else: + server_store.append([_("Nearest server"), + self.distro.nearest_server]) if len(self.distro.used_servers) > 0: for server in self.distro.used_servers: if not re.match(server, self.distro.main_server) and \ diff --git a/SoftwareProperties/aptsources.py b/SoftwareProperties/aptsources.py index 40b55dfa..a4d16fa0 100644 --- a/SoftwareProperties/aptsources.py +++ b/SoftwareProperties/aptsources.py @@ -563,7 +563,10 @@ class Distribution: country_code = locale[a+1:z].lower() self.nearest_server = "http://%s.archive.ubuntu.com/ubuntu/" % \ country_code - self.country = self.countries[country_code] + if self.countries.has_key(country_code): + self.country = self.countries[country_code] + else: + self.country = None # other used servers for medium in self.used_media: -- cgit v1.2.3 From 8b0c51a898bd788ba5f2285daf4f15ab8d78ae67 Mon Sep 17 00:00:00 2001 From: "glatzor@ubuntu.com" <> Date: Thu, 27 Jul 2006 23:37:19 +0200 Subject: * fix the close button in the window decoration --- SoftwareProperties/SoftwareProperties.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SoftwareProperties/SoftwareProperties.py b/SoftwareProperties/SoftwareProperties.py index 9e9071be..768e942a 100644 --- a/SoftwareProperties/SoftwareProperties.py +++ b/SoftwareProperties/SoftwareProperties.py @@ -927,7 +927,7 @@ class SoftwareProperties(SimpleGladeApp): self.reload_keyslist() def on_delete_event(self, widget, args): - self.on_close_button(self, widget) + self.on_close_button(widget) def on_close_button(self, widget): # show a dialog that a reload of the channel information is required -- cgit v1.2.3 From 18ebb5a4446010824b05b92820689e795498cd87 Mon Sep 17 00:00:00 2001 From: "glatzor@ubuntu.com" <> Date: Fri, 28 Jul 2006 00:22:49 +0200 Subject: * add a revert and add cdrom button --- SoftwareProperties/SoftwareProperties.py | 21 +++-- data/glade/SoftwareProperties.glade | 135 ++++++++++++++++++++++++++----- 2 files changed, 131 insertions(+), 25 deletions(-) diff --git a/SoftwareProperties/SoftwareProperties.py b/SoftwareProperties/SoftwareProperties.py index 768e942a..35793151 100644 --- a/SoftwareProperties/SoftwareProperties.py +++ b/SoftwareProperties/SoftwareProperties.py @@ -118,6 +118,7 @@ class SoftwareProperties(SimpleGladeApp): self.init_sourceslist() self.reload_sourceslist() + self.backup_sourceslist() self.window_main.show() @@ -572,6 +573,15 @@ class SoftwareProperties(SimpleGladeApp): self.sourceslist = aptsources.SourcesList() + def backup_sourceslist(self): + """ + Duplicate the list of sources + """ + self.sourceslist_backup = [] + for source in self.sourceslist.list: + source_bkp = aptsources.SourceEntry(line=source.line,file=source.file) + self.sourceslist_backup.append(source_bkp) + def on_channel_activate(self, treeview, path, column): """Open the edit dialog if a channel was double clicked""" self.on_edit_clicked(treeview) @@ -607,10 +617,11 @@ class SoftwareProperties(SimpleGladeApp): def on_button_revert_clicked(self, button): """Restore the source list from the startup of the dialog""" - self.sourceslist.restoreBackup(".save") - self.sourceslist.clearBackup(".save") - self.sourceslist.backup(".save") - self.sourceslist.refresh() + self.sourceslist.list = [] + for source in self.sourceslist_backup: + source_reset = aptsources.SourceEntry(line=source.line,file=source.file) + self.sourceslist.list.append(source_reset) + self.save_sourceslist() self.reload_sourceslist() self.button_revert.set_sensitive(False) self.modified = False @@ -619,7 +630,7 @@ class SoftwareProperties(SimpleGladeApp): """The sources list was changed and now needs to be saved and reloaded""" self.massive_debug_output() self.modified = True - #self.button_revert.set_sensitive(True) + self.button_revert.set_sensitive(True) self.save_sourceslist() self.reload_sourceslist() diff --git a/data/glade/SoftwareProperties.glade b/data/glade/SoftwareProperties.glade index 98bf65bc..d262980d 100644 --- a/data/glade/SoftwareProperties.glade +++ b/data/glade/SoftwareProperties.glade @@ -737,7 +737,7 @@ True - False + True 6 @@ -758,6 +758,85 @@ + + + True + True + GTK_RELIEF_NORMAL + True + + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-add + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + Add Cdrom + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + + + + 0 + False + False + + + True @@ -794,25 +873,10 @@ - - 0 - True - True - - - - - - True - gtk-revert-to-saved - True - GTK_RELIEF_NORMAL - True - 0 False - False + True @@ -1138,11 +1202,11 @@ The results are used to improve the support for popular applications and to rank - + 6 True - GTK_BUTTONBOX_EDGE - 0 + False + 6 @@ -1155,6 +1219,11 @@ The results are used to improve the support for popular applications and to rank True + + 0 + False + False + @@ -1168,6 +1237,32 @@ The results are used to improve the support for popular applications and to rank True + + 0 + False + False + GTK_PACK_END + + + + + + True + False + True + True + gtk-revert-to-saved + True + GTK_RELIEF_NORMAL + True + + + + 0 + False + False + GTK_PACK_END + -- cgit v1.2.3