diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2006-02-27 16:02:35 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2006-02-27 16:02:35 +0100 |
| commit | 77b2f46a4079c35ca7a5fc4ff2bb80d57e3ba024 (patch) | |
| tree | d629f88f6319a2d6cbf2339ef205988043443aef | |
| parent | 979d4cafb3d30920b95dfaf26e204bda408d4591 (diff) | |
| download | python-apt-77b2f46a4079c35ca7a5fc4ff2bb80d57e3ba024.tar.gz | |
* show the already enabled components for a given dist if "add" is clicked
| -rw-r--r-- | SoftwareProperties/aptsources.py | 2 | ||||
| -rw-r--r-- | SoftwareProperties/dialog_add.py | 19 |
2 files changed, 18 insertions, 3 deletions
diff --git a/SoftwareProperties/aptsources.py b/SoftwareProperties/aptsources.py index 0340e211..0546ef0a 100644 --- a/SoftwareProperties/aptsources.py +++ b/SoftwareProperties/aptsources.py @@ -448,7 +448,7 @@ class SourceCompTemplate: self.on_by_default = on_by_default class SourceEntryTemplates: - def __init__(self,datadir): + def __init__(self, datadir): _ = gettext.gettext self.templates = [] diff --git a/SoftwareProperties/dialog_add.py b/SoftwareProperties/dialog_add.py index a1ac713b..05737769 100644 --- a/SoftwareProperties/dialog_add.py +++ b/SoftwareProperties/dialog_add.py @@ -120,11 +120,26 @@ class dialog_add: a_iter = liststore.iter_nth_child(None, combobox.get_active()) (name, template) = liststore.get(a_iter, 0,1) self.selected = template + + # figure what is currently active in the sources.list + already_enabled_comps = [] + for entry in self.sourceslist: + if entry.disabled or entry.invalid or entry.type != "deb": + continue + if template.dist == entry.dist and \ + self.sourceslist.is_mirror(template.uri, entry.uri): + already_enabled_comps = entry.comps + comps = template.comps self.comps=[] for c in comps: checkbox = gtk.CheckButton(c.description) - checkbox.set_active(c.on_by_default) + # show what should be enabled by default if the source was not found + # else show the already enabled ones + if len(already_enabled_comps) == 0: + checkbox.set_active(c.on_by_default) + else: + checkbox.set_active(c.name in already_enabled_comps) checkbox.set_data("name",c.name) checkbox.connect("toggled", self.count_comps) self.vbox.pack_start(checkbox) @@ -150,7 +165,7 @@ class dialog_add: if res == gtk.RESPONSE_OK: # add repository if self.official == True: - self.selected_comps = [] + #self.selected_comps = [] self.sourceslist.add(self.selected.type, self.selected.uri, self.selected.dist, |
