summaryrefslogtreecommitdiff
path: root/SoftwareProperties
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-02-27 12:18:02 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2006-02-27 12:18:02 +0100
commit97a21a72b7ae7e0cd0bba858655ae9110e96644d (patch)
tree58659b1cf98b7e372dc2b779d2445bc68501c48f /SoftwareProperties
parent7da55cd2547325f4bc70d9eed46994bbc23d0d86 (diff)
downloadpython-apt-97a21a72b7ae7e0cd0bba858655ae9110e96644d.tar.gz
* SoftwareProperties/SoftwareProperties.py:
- moved render_source() from aptsources.py here - if a endangered dist is added, show a revert button * channels/Ubuntu.info.in: - added security and updates
Diffstat (limited to 'SoftwareProperties')
-rw-r--r--SoftwareProperties/SoftwareProperties.py35
-rw-r--r--SoftwareProperties/aptsources.py28
-rw-r--r--SoftwareProperties/dialog_sources_list.py6
-rw-r--r--SoftwareProperties/utils.py2
4 files changed, 41 insertions, 30 deletions
diff --git a/SoftwareProperties/SoftwareProperties.py b/SoftwareProperties/SoftwareProperties.py
index f7f7f6f2..d5070240 100644
--- a/SoftwareProperties/SoftwareProperties.py
+++ b/SoftwareProperties/SoftwareProperties.py
@@ -88,10 +88,10 @@ class SoftwareProperties(SimpleGladeApp):
if options and options.toplevel != None:
toplevel = gtk.gdk.window_foreign_new(int(options.toplevel))
self.window_main.window.set_transient_for(toplevel)
-
+
+ self.button_revert.set_sensitive(False)
self.init_sourceslist()
self.reload_sourceslist()
- self.button_revert.set_sensitive(False)
# internet update setings
@@ -203,8 +203,9 @@ class SoftwareProperties(SimpleGladeApp):
def open_file(self, file):
"""Show an confirmation for adding the channels of the specified file"""
- dialog = dialog_sources_list.AddSourcesList(self.window_main,
+ dialog = dialog_sources_list.AddSourcesList(self.window_main,
self.sourceslist,
+ self.render_source,
self.datadir,
file)
res = dialog.run()
@@ -294,13 +295,37 @@ class SoftwareProperties(SimpleGladeApp):
self.save_sourceslist()
self.reload_sourceslist()
+ def render_source(self, source):
+ """Render a nice output to show the source in a treeview"""
+ (nice_type, nice_dist, nice_comps, special) = self.matcher.match(source)
+
+ if special in (aptsources.SOURCE_UPDATES,
+ aptsources.SOURCE_BACKPORTS,
+ aptsources.SOURCE_SECURITY):
+ contents = "<b>%s</b>" % nice_dist
+ elif special == aptsources.SOURCE_SYSTEM:
+ contents = "<b>%s</b>" % nice_dist
+ if source.type in ("deb-src", "rpm-src"):
+ contents += " (%s)" % nice_type
+ for comp in nice_comps:
+ contents += "\n%s" % comp
+ else:
+ contents = "<b>%s</b>" % nice_dist
+ if source.type in ("deb-src", "rpm-src"):
+ contents += " (%s)" % nice_type
+ for comp in nice_comps:
+ contents += "%s" % comp
+ return contents
+
def reload_sourceslist(self):
self.source_store.clear()
- self.sourceslist.check_for_endangered_dists()
+ if self.sourceslist.check_for_endangered_dists():
+ self.button_revert.set_sensitive(True)
+ self.save_sourceslist()
for source in self.sourceslist.list:
if source.invalid:
continue
- contents = self.sourceslist.render_source(source)
+ contents = self.render_source(source)
self.source_store.append([not source.disabled, contents, source])
def reload_keyslist(self):
diff --git a/SoftwareProperties/aptsources.py b/SoftwareProperties/aptsources.py
index 532600fd..0340e211 100644
--- a/SoftwareProperties/aptsources.py
+++ b/SoftwareProperties/aptsources.py
@@ -291,26 +291,6 @@ class SourcesList:
file = self.list[index].file
self.list[index] = SourceEntry(line, file)
- def render_source(self, source):
- """Render a nice output to show the source in a treeview"""
- (nice_type, nice_dist, nice_comps, special) = self.matcher.match(source)
-
- if special in (SOURCE_UPDATES, SOURCE_BACKPORTS, SOURCE_SECURITY):
- contents = "<b>%s</b>" % nice_dist
- elif special == SOURCE_SYSTEM:
- contents = "<b>%s</b>" % nice_dist
- if source.type in ("deb-src", "rpm-src"):
- contents += " (%s)" % nice_type
- for comp in nice_comps:
- contents += "\n%s" % comp
- else:
- contents = "<b>%s</b>" % nice_dist
- if source.type in ("deb-src", "rpm-src"):
- contents += " (%s)" % nice_type
- for comp in nice_comps:
- contents += "%s" % comp
- return contents
-
def remove(self, source_entry):
self.list.remove(source_entry)
@@ -407,9 +387,11 @@ class SourcesList:
# Check if each security source contains all components of
# the same dist
- self.check_updates(self.sources_security)
- self.check_updates(self.sources_updates)
- self.check_updates(self.sources_backports)
+ res = False
+ res |= self.check_updates(self.sources_security)
+ res |= self.check_updates(self.sources_updates)
+ res |= self.check_updates(self.sources_backports)
+ return res
def check_updates(self, updates):
modified = False
diff --git a/SoftwareProperties/dialog_sources_list.py b/SoftwareProperties/dialog_sources_list.py
index a09542c8..d35b9b51 100644
--- a/SoftwareProperties/dialog_sources_list.py
+++ b/SoftwareProperties/dialog_sources_list.py
@@ -9,11 +9,13 @@ from aptsources import SourcesList, SourceEntryMatcher
from gettext import gettext as _
import gettext
import urllib
+from utils import *
class AddSourcesList:
- def __init__(self, parent, sourceslist, datadir, file):
+ def __init__(self, parent, sourceslist, source_renderer, datadir, file):
print file
self.parent = parent
+ self.source_renderer = source_renderer
self.sources_old = sourceslist
self.file = self.format_uri(file)
self.glade = gtk.glade.XML(os.path.join(datadir,
@@ -60,7 +62,7 @@ class AddSourcesList:
if source.invalid or source.disabled:
continue
counter = counter +1
- line = self.sources.render_source(source)
+ line = self.source_renderer(source)
self.store.append([line])
if counter == 0:
self.error()
diff --git a/SoftwareProperties/utils.py b/SoftwareProperties/utils.py
index cf9a3343..2886507f 100644
--- a/SoftwareProperties/utils.py
+++ b/SoftwareProperties/utils.py
@@ -1,5 +1,7 @@
import gtk
+
+
def dialog_error(parent, primary, secondary):
p = "<span weight=\"bold\" size=\"larger\">%s</span>" % primary
dialog = gtk.MessageDialog(parent,gtk.DIALOG_MODAL,