Merge lp:~evfool/software-center/867588 into lp:software-center/5.2

Proposed by Robert Roth
Status: Merged
Merged at revision: 3003
Proposed branch: lp:~evfool/software-center/867588
Merge into: lp:software-center/5.2
Diff against target: 89 lines (+14/-6)
4 files modified
AUTHORS (+1/-0)
softwarecenter/db/application.py (+4/-4)
softwarecenter/ui/gtk3/models/appstore2.py (+3/-2)
softwarecenter/utils.py (+6/-0)
To merge this branch: bzr merge lp:~evfool/software-center/867588
Reviewer Review Type Date Requested Status
Gary Lasker (community) Approve
Review via email: mp+105490@code.launchpad.net

Description of the change

This branch capitalizes the first letter of the package summary, as requested in the specification and in bug #867588.
 I have also added myself in the AUTHORS list.

To post a comment you must log in.
Revision history for this message
Gary Lasker (gary-lasker) wrote :

Very nice, Robert, thank you! Please note that I added a very small unit test for the new method you added in utils.py.

And indeed, your entry is long overdue in the AUTHORS list. :)

Thanks again for your good work, it's very much appreciated!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'AUTHORS'
2--- AUTHORS 2011-09-13 10:25:29 +0000
3+++ AUTHORS 2012-05-11 14:16:18 +0000
4@@ -26,3 +26,4 @@
5 Zygmunt Krynicki - Code
6 Aaron Peachey - Code
7 Konstantin Datz - Icon
8+Robert Roth - Code
9
10=== modified file 'softwarecenter/db/application.py'
11--- softwarecenter/db/application.py 2012-05-04 01:13:54 +0000
12+++ softwarecenter/db/application.py 2012-05-11 14:16:18 +0000
13@@ -32,7 +32,7 @@
14 from softwarecenter.paths import (APP_INSTALL_CHANNELS_PATH,
15 SOFTWARE_CENTER_ICON_CACHE_DIR,
16 )
17-from softwarecenter.utils import utf8, split_icon_ext
18+from softwarecenter.utils import utf8, split_icon_ext, capitalize_first_word
19 from softwarecenter.region import get_region_cached, REGIONTAG
20
21 LOG = logging.getLogger(__name__)
22@@ -111,7 +111,7 @@
23 appname = "%s (%s)" % (appname, db.get_pkgname(doc))
24 return appname
25 else:
26- return db.get_summary(doc)
27+ return capitalize_first_word(db.get_summary(doc))
28
29 @staticmethod
30 def get_display_summary(db, doc):
31@@ -121,7 +121,7 @@
32 """
33 if doc:
34 if db.get_appname(doc):
35- return db.get_summary(doc)
36+ return capitalize_first_word(db.get_summary(doc))
37 else:
38 return db.get_pkgname(doc)
39
40@@ -700,7 +700,7 @@
41 return ver.summary
42 # normal case
43 if self._doc:
44- return self._db.get_summary(self._doc)
45+ return capitalize_first_word(self._db.get_summary(self._doc))
46 elif self._pkg:
47 return self._pkg.candidate.summary
48
49
50=== modified file 'softwarecenter/ui/gtk3/models/appstore2.py'
51--- softwarecenter/ui/gtk3/models/appstore2.py 2012-05-01 00:18:23 +0000
52+++ softwarecenter/ui/gtk3/models/appstore2.py 2012-05-11 14:16:18 +0000
53@@ -32,6 +32,7 @@
54 ExecutionTime,
55 SimpleFileDownloader,
56 split_icon_ext,
57+ capitalize_first_word,
58 utf8,
59 )
60 from softwarecenter.backend import get_install_backend
61@@ -188,9 +189,9 @@
62 # but "packages" are displayed with their summary as name
63 if app.appname:
64 appname = self.get_appname(doc)
65- summary = self.db.get_summary(doc)
66+ summary = capitalize_first_word(self.db.get_summary(doc))
67 else:
68- appname = self.db.get_summary(doc)
69+ appname = capitalize_first_word(self.db.get_summary(doc))
70 summary = self.get_pkgname(doc)
71
72 return "%s\n<small>%s</small>" % (
73
74=== modified file 'softwarecenter/utils.py'
75--- softwarecenter/utils.py 2012-05-11 09:13:51 +0000
76+++ softwarecenter/utils.py 2012-05-11 14:16:18 +0000
77@@ -120,6 +120,12 @@
78 return wrapper
79
80
81+def capitalize_first_word(string):
82+ """ this takes a package synopsis and uppercases the first word's first letter"""
83+ if string[0].isalpha() and not string[0].isupper():
84+ return string[0].capitalize() + string[1:]
85+ return string
86+
87 def normalize_package_description(desc):
88 """ this takes a package description and normalizes it
89 so that all uneeded \n are stripped away and all

Subscribers

People subscribed via source and target branches