summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Heinlein <sebastian.heinlein@web.de>2006-03-20 08:24:53 +0100
committerSebastian Heinlein <sebastian.heinlein@web.de>2006-03-20 08:24:53 +0100
commit8cfb54ced335aa488ca3cfad00dad434617fb62a (patch)
tree4b8e86d2acd9168b28691d26b548038b7ea847ba
parentef3fb1ccfd79f94b0849703ae85f1a6c2c663dcb (diff)
downloadpython-apt-8cfb54ced335aa488ca3cfad00dad434617fb62a.tar.gz
* Improve the rendering of the description in the update-manager
-rw-r--r--UpdateManager/UpdateManager.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/UpdateManager/UpdateManager.py b/UpdateManager/UpdateManager.py
index 6a52a296..27e6b7bb 100644
--- a/UpdateManager/UpdateManager.py
+++ b/UpdateManager/UpdateManager.py
@@ -346,14 +346,28 @@ class UpdateManager(SimpleGladeApp):
iter = model.get_iter(path)
# set descr
- long_desc = model.get_value(iter, 5)
+ long_desc = model.get_value(iter, LIST_LONG_DESCR)
if long_desc == None:
return
+ # Skip the first line - it's a duplicate of the summary
+ i = long_desc.find("\n")
+ long_desc = long_desc[i+1:]
+ # do some regular expression magic on the description
+ # Add a newline before each bullet
+ p = re.compile(r'^(\s|\t)*(\*|0|-)',re.MULTILINE)
+ long_desc = p.sub('\n*', long_desc)
+ # replace all newlines by spaces
+ p = re.compile(r'\n', re.MULTILINE)
+ long_desc = p.sub(" ", long_desc)
+ # replace all multiple spaces by newlines
+ p = re.compile(r'\s\s+', re.MULTILINE)
+ long_desc = p.sub("\n", long_desc)
+
desc_buffer = self.textview_descr.get_buffer()
desc_buffer.set_text(utf8(long_desc))
# now do the changelog
- name = model.get_value(iter, 2)
+ name = model.get_value(iter, LIST_NAME)
if name == None:
return
@@ -609,7 +623,8 @@ class UpdateManager(SimpleGladeApp):
contents = "<big><b>%s</b></big>\n<small>%s\n\n" % (name, summary)
contents = contents + _("New version: %s (Size: %s)") % (pkg.candidateVersion,apt.SizeToStr(pkg.packageSize)) + "</small>"
- iter = self.store.append([True, contents, pkg.name, pkg.summary, pkg.candidateVersion, pkg.description, pkg])
+ iter = self.store.append([True, contents, pkg.name, pkg.summary,
+ pkg.candidateVersion, pkg.description, pkg])
self.add_update(pkg)
i = i + 1