Merge ~nteodosio/software-properties:comment-flood into software-properties:ubuntu/master

Proposed by Nathan Teodosio
Status: Merged
Merge reported by: Nick Rosbrook
Merged at revision: bd84e85981cea5f8af0dcc72c959ce430d909dbe
Proposed branch: ~nteodosio/software-properties:comment-flood
Merge into: software-properties:ubuntu/master
Diff against target: 18 lines (+5/-2)
1 file modified
softwareproperties/SoftwareProperties.py (+5/-2)
Reviewer Review Type Date Requested Status
Julian Andres Klode Approve
Ubuntu Core Development Team Pending
Review via email: mp+463886@code.launchpad.net

Description of the change

Don't show more than one comment in "other software", otherwise the interface is flooded.

The problem was surfaced by LP:2060915 (see attached screen shot[1]).

[1] https://bugs.launchpad.net/ubuntu/+source/software-properties/+bug/2060915/+attachment/5763610/+files/spimg.png

To post a comment you must log in.
Revision history for this message
Julian Andres Klode (juliank) wrote :

Two things to sort out:

- The first line may be empty
- If we hide stuff should display [...]

I'd wager replacing newlines by spaces and picking a length to display would be easier avoids having to deal with empty lines at least, and can produce more details, something like:

source.comment.replace("\n", " ")[:80] + ("[...]" if len(source.comment) > 80 else "")

review: Needs Fixing
Revision history for this message
Nathan Teodosio (nteodosio) wrote :

Thanks for the review, I agree and implemented your suggestion.

I confirm that for a file with empty and space padded first lines, those are correctly collapsed after the processing so there is no excessive empty space in the display.

Revision history for this message
Julian Andres Klode (juliank) :
review: Approve
Revision history for this message
Jeremy Bícha (jbicha) wrote :

Please use the Unicode ellipsis … instead of three periods/full stops.

Revision history for this message
Nathan Teodosio (nteodosio) wrote :

Done.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/softwareproperties/SoftwareProperties.py b/softwareproperties/SoftwareProperties.py
2index 25f1340..5cf771c 100644
3--- a/softwareproperties/SoftwareProperties.py
4+++ b/softwareproperties/SoftwareProperties.py
5@@ -511,8 +511,11 @@ class SoftwareProperties(object):
6 """Render a nice output to show the source in a treeview"""
7 if source.template == None:
8 if source.comment:
9- contents = "<b>%s</b> %s" % (escape(source.comment).strip(),
10- source.dist)
11+ comment = (
12+ source.comment.replace("\n", " ").strip()[:80]
13+ + "[…]" if len(source.comment) > 80 else ""
14+ )
15+ contents = "<b>%s</b> %s" % (escape(comment), source.dist)
16 # Only show the components if there are more than one
17 if len(source.comps) > 1:
18 for c in source.comps:

Subscribers

People subscribed via source and target branches