コード例 #1
0
ファイル: test_utils.py プロジェクト: pombredanne/shop
 def test_capitalize_first_word(self):
     test_synopsis = "feature-rich console based todo list manager"
     capitalized = capitalize_first_word(test_synopsis)
     self.assertTrue(capitalized == "Feature-rich console based todo list manager")
     test_synopsis = "MPlayer's Movie Encoder"
     capitalized = capitalize_first_word(test_synopsis)
     self.assertTrue(capitalized == "MPlayer's Movie Encoder")
     # ensure it does not crash for empty strings, LP: #1002271
     self.assertEqual(capitalize_first_word(""), "")
コード例 #2
0
ファイル: test_utils.py プロジェクト: sti-lyneos/shop
 def test_capitalize_first_word(self):
     test_synopsis = "feature-rich console based todo list manager"
     capitalized = capitalize_first_word(test_synopsis)
     self.assertTrue(
         capitalized == "Feature-rich console based todo list manager")
     test_synopsis = "MPlayer's Movie Encoder"
     capitalized = capitalize_first_word(test_synopsis)
     self.assertTrue(capitalized == "MPlayer's Movie Encoder")
     # ensure it does not crash for empty strings, LP: #1002271
     self.assertEqual(capitalize_first_word(""), "")
コード例 #3
0
 def test_capitalize_first_word(self):
     from softwarecenter.utils import capitalize_first_word
     test_synopsis = "feature-rich console based todo list manager"
     capitalized = capitalize_first_word(test_synopsis)
     self.assertTrue(
         capitalized == "Feature-rich console based todo list manager")
     test_synopsis = "MPlayer's Movie Encoder"
     capitalized = capitalize_first_word(test_synopsis)
     self.assertTrue(
         capitalized == "MPlayer's Movie Encoder")
コード例 #4
0
    def get_markup(self, doc):
        app = self.db.get_application(doc)

        # the logic is that "apps" are displayed normally
        # but "packages" are displayed with their summary as name
        if app.appname:
            appname = self.get_appname(doc)
            summary = capitalize_first_word(self.db.get_summary(doc))
        else:
            appname = capitalize_first_word(self.db.get_summary(doc))
            summary = self.get_pkgname(doc)

        return "%s\n<small>%s</small>" % (GObject.markup_escape_text(appname),
                                          GObject.markup_escape_text(summary))
コード例 #5
0
ファイル: appstore2.py プロジェクト: fossasia/x-mario-center
    def get_markup(self, doc):
        app = self.db.get_application(doc)

        # the logic is that "apps" are displayed normally
        # but "packages" are displayed with their summary as name
        if app.appname:
            appname = self.get_appname(doc)
            summary = capitalize_first_word(self.db.get_summary(doc))
        else:
            appname = capitalize_first_word(self.db.get_summary(doc))
            summary = self.get_pkgname(doc)

        return "%s\n<small>%s</small>" % (
                 GObject.markup_escape_text(appname),
                 GObject.markup_escape_text(summary))
コード例 #6
0
 def get_display_summary(db, doc):
     """ Return the application summary as it should be displayed in the UI
         If the appname is defined, return the application summary, else
         return the application's pkgname (per the spec)
     """
     if doc:
         if db.get_appname(doc):
             return capitalize_first_word(db.get_summary(doc))
         else:
             return db.get_pkgname(doc)
コード例 #7
0
ファイル: application.py プロジェクト: pombredanne/shop
 def summary(self):
     # not-automatic
     if self._pkg and self._app.archive_suite:
         ver = self._get_version_for_archive_suite(self._pkg, self._app.archive_suite)
         return ver.summary
     # normal case
     if self._doc:
         return capitalize_first_word(self._db.get_summary(self._doc))
     elif self._pkg:
         return self._pkg.candidate.summary
コード例 #8
0
 def summary(self):
     # not-automatic
     if self._pkg and self._app.archive_suite:
         ver = self._get_version_for_archive_suite(
             self._pkg, self._app.archive_suite)
         return ver.summary
     # normal case
     if self._doc:
         return capitalize_first_word(self._db.get_summary(self._doc))
     elif self._pkg:
         return self._pkg.candidate.summary
コード例 #9
0
 def get_display_name(db, doc):
     """ Return the application name as it should be displayed in the UI
         If the appname is defined, just return it, else return
         the summary (per the spec)
     """
     if doc:
         appname = db.get_appname(doc)
         if appname:
             if db.is_appname_duplicated(appname):
                 appname = "%s (%s)" % (appname, db.get_pkgname(doc))
             return appname
         else:
             return capitalize_first_word(db.get_summary(doc))