summaryrefslogtreecommitdiff
path: root/SoftwareProperties
diff options
context:
space:
mode:
authorglatzor@ubuntu.com <>2006-07-27 22:34:11 +0200
committerglatzor@ubuntu.com <>2006-07-27 22:34:11 +0200
commit7403f3888293e0c9ff544a218decaf6b428b2396 (patch)
tree91e1f7fb24c696b7eb409acaf0b6a5f8c43fa0df /SoftwareProperties
parentc2a2f69a9a9ee1f45290b15e76f6098c4b28bd98 (diff)
parent2c1051ac180cfa72705b63c5080771b69dbeaca7 (diff)
downloadpython-apt-7403f3888293e0c9ff544a218decaf6b428b2396.tar.gz
* merge with mvo
* try to find a nice country name for custom mirrors * if available select a custom mirror in the combobox
Diffstat (limited to 'SoftwareProperties')
-rw-r--r--SoftwareProperties/SoftwareProperties.py42
-rw-r--r--SoftwareProperties/aptsources.py55
2 files changed, 41 insertions, 56 deletions
diff --git a/SoftwareProperties/SoftwareProperties.py b/SoftwareProperties/SoftwareProperties.py
index f7a40821..93028206 100644
--- a/SoftwareProperties/SoftwareProperties.py
+++ b/SoftwareProperties/SoftwareProperties.py
@@ -21,7 +21,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
-import pdb
+#import pdb
import sys
import apt
import apt_pkg
@@ -292,6 +292,7 @@ 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])
@@ -299,7 +300,19 @@ class SoftwareProperties(SimpleGladeApp):
for server in self.distro.used_servers:
if not re.match(server, self.distro.main_server) and \
not re.match(server, self.distro.nearest_server):
- server_store.append(["%s" % server, server])
+ #FIXME: an ubuntu hack
+ i = server.find("http://")
+ l = server.find(".archive.ubuntu.com")
+ if i != -1 and l != -1:
+ country = server[i+7:l]
+ if self.distro.countries.has_key(country):
+ # TRANSLATORS: %s is a country
+ server_store.append([_("Server for %s") % \
+ gettext.dgettext("iso-3166",
+ self.distro.countries[country].rstrip()),
+ server])
+ else:
+ server_store.append(["%s" % server, server])
if len(self.distro.used_servers) > 1:
server_store.append([_("Custom servers"), None])
self.combobox_server.set_active(2)
@@ -307,6 +320,9 @@ class SoftwareProperties(SimpleGladeApp):
self.combobox_server.set_active(0)
elif self.distro.used_servers[0] == self.distro.nearest_server:
self.combobox_server.set_active(1)
+ elif len(self.distro.used_servers) == 1:
+ self.combobox_server.set_active(2)
+
else:
self.combobox_server.set_active(0)
@@ -440,6 +456,27 @@ class SoftwareProperties(SimpleGladeApp):
source.file)
self.modified_sourceslist()
+ def on_checkbutton_popcon_toggled(self, widget):
+ """ The user clicked on the popcon paritipcation button """
+ popcon = "/etc/popularity-contest.conf"
+ if widget.get_active():
+ new_value = "yes"
+ else:
+ new_value = "no"
+ if os.path.exists(popcon):
+ # read it
+ lines = open(popcon).read().split("\n")
+ for line in lines:
+ try:
+ (key,value) = line.split("=")
+ if key == "PARTICIPATE":
+ lines[lines.index(line)] = 'PARTICIPATE=\"%s"' % new_value
+ except ValueError:
+ continue
+ # write it
+ open(popcon,"w").write("\n".join(lines))
+
+
def open_file(self, file):
"""Show an confirmation for adding the channels of the specified file"""
dialog = dialog_add_sources_list.AddSourcesList(self.window_main,
@@ -1003,3 +1040,4 @@ class GtkCdromProgress(apt.progress.CdromProgress, SimpleGladeApp):
return True
return False
+
diff --git a/SoftwareProperties/aptsources.py b/SoftwareProperties/aptsources.py
index c111e4ff..40b55dfa 100644
--- a/SoftwareProperties/aptsources.py
+++ b/SoftwareProperties/aptsources.py
@@ -30,7 +30,7 @@ import shutil
import time
import os.path
-import pdb
+#import pdb
from UpdateManager.Common.DistInfo import DistInfo
@@ -416,61 +416,8 @@ class SourceEntryMatcher:
for suite in dist.suites:
if suite.match_uri != None:
self.templates.append(suite)
-
- # FIXME: The specifications should go into the .info files
return
- # DEBIAN
- debian_comps = ["^main$","^contrib$","^non-free$","^non-US$"]
- debian_comps_descr = [_("Officially supported"),
- _("Contributed software"),
- _("Non-free software"),
- _("US export restricted software")
- ]
-
- # dists by name
- self.dist_list.append(self.MatchDist(".*debian.org/debian",
- "^sarge$",
- _("Debian 3.1 \"Sarge\""),
- debian_comps, debian_comps_descr))
- self.dist_list.append(self.MatchDist(".*debian.org/debian",
- "^woody$",
- _("Debian 3.0 \"Woody\""),
- debian_comps, debian_comps_descr))
- # securtiy
- self.dist_list.append(self.MatchDist(".*security.debian.org",
- "^stable.*$",
- _("Debian Stable Security Updates"),
- debian_comps, debian_comps_descr))
- # dists by status
- self.dist_list.append(self.MatchDist(".*debian.org/debian",
- "^stable$",
- _("Debian Stable"),
- debian_comps, debian_comps_descr))
- self.dist_list.append(self.MatchDist(".*debian.org/debian",
- "^testing$",
- _("Debian Testing"),
- debian_comps, debian_comps_descr))
- self.dist_list.append(self.MatchDist(".*debian.org/debian",
- "^unstable$",
- _("Debian Unstable \"Sid\""),
- debian_comps, debian_comps_descr))
-
- # non-us
- self.dist_list.append(self.MatchDist(".*debian.org/debian-non-US",
- "^stable.*$",
- _("Debian Non-US (Stable)"),
- debian_comps, debian_comps_descr))
- self.dist_list.append(self.MatchDist(".*debian.org/debian-non-US",
- "^testing.*$",
- _("Debian Non-US (Testing)"),
- debian_comps, debian_comps_descr))
- self.dist_list.append(self.MatchDist(".*debian.org/debian-non-US",
- "^unstable.*$",
- _("Debian Non-US (Unstable)"),
- debian_comps, debian_comps_descr,
- SOURCE_SYSTEM))
-
def match(self, source):
"""Add a matching template to the source"""
_ = gettext.gettext