Merge lp:~mvo/software-center/support-size-from-agent into lp:software-center

Proposed by Michael Vogt
Status: Merged
Merged at revision: 3276
Proposed branch: lp:~mvo/software-center/support-size-from-agent
Merge into: lp:software-center
Diff against target: 133 lines (+37/-1)
5 files modified
softwarecenter/db/application.py (+6/-0)
softwarecenter/db/update.py (+9/-0)
softwarecenter/enums.py (+3/-0)
softwarecenter/ui/gtk3/views/appdetailsview.py (+11/-0)
tests/test_reinstall_purchased.py (+8/-1)
To merge this branch: bzr merge lp:~mvo/software-center/support-size-from-agent
Reviewer Review Type Date Requested Status
dobey Approve
software-store-developers Pending
Review via email: mp+139475@code.launchpad.net

Description of the change

Support showing the download size if the software-center-agent provides it.

To post a comment you must log in.
Revision history for this message
dobey (dobey) wrote :

Looks ok to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'softwarecenter/db/application.py'
--- softwarecenter/db/application.py 2012-11-28 17:36:38 +0000
+++ softwarecenter/db/application.py 2012-12-12 14:43:27 +0000
@@ -23,6 +23,7 @@
23import logging23import logging
24import os24import os
25import re25import re
26import xapian
2627
27import softwarecenter.distro28import softwarecenter.distro
2829
@@ -696,6 +697,11 @@
696 return self._pkg.candidate.size697 return self._pkg.candidate.size
697 else:698 else:
698 return self._pkg.installed.size699 return self._pkg.installed.size
700 elif self._doc:
701 size = self._doc.get_value(XapianValues.DOWNLOAD_SIZE)
702 if size:
703 return xapian.sortable_unserialise(
704 self._doc.get_value(XapianValues.DOWNLOAD_SIZE))
699705
700 @property706 @property
701 def tags(self):707 def tags(self):
702708
=== modified file 'softwarecenter/db/update.py'
--- softwarecenter/db/update.py 2012-12-06 16:16:49 +0000
+++ softwarecenter/db/update.py 2012-12-12 14:43:27 +0000
@@ -148,6 +148,7 @@
148 AppInfoFields.CHANNEL: XapianValues.ARCHIVE_CHANNEL,148 AppInfoFields.CHANNEL: XapianValues.ARCHIVE_CHANNEL,
149 AppInfoFields.DEB_LINE: XapianValues.ARCHIVE_DEB_LINE,149 AppInfoFields.DEB_LINE: XapianValues.ARCHIVE_DEB_LINE,
150 AppInfoFields.DESCRIPTION: XapianValues.SC_DESCRIPTION,150 AppInfoFields.DESCRIPTION: XapianValues.SC_DESCRIPTION,
151 AppInfoFields.DOWNLOAD_SIZE: XapianValues.DOWNLOAD_SIZE,
151 AppInfoFields.CATEGORIES: XapianValues.CATEGORIES,152 AppInfoFields.CATEGORIES: XapianValues.CATEGORIES,
152 AppInfoFields.CURRENCY: XapianValues.CURRENCY,153 AppInfoFields.CURRENCY: XapianValues.CURRENCY,
153 AppInfoFields.DATE_PUBLISHED: XapianValues.DATE_PUBLISHED,154 AppInfoFields.DATE_PUBLISHED: XapianValues.DATE_PUBLISHED,
@@ -383,6 +384,12 @@
383 # ever changes we can update384 # ever changes we can update
384 doc.add_value(XapianValues.CURRENCY, "US$")385 doc.add_value(XapianValues.CURRENCY, "US$")
385386
387 # add donwload size as string (its send as int)
388 download_size = self.get_value(AppInfoFields.DOWNLOAD_SIZE)
389 if download_size is not None:
390 doc.add_value(XapianValues.DOWNLOAD_SIZE,
391 xapian.sortable_serialise((download_size)))
392
386 # write out categories393 # write out categories
387 for cat in self.get_categories():394 for cat in self.get_categories():
388 doc.add_term("AC" + cat.lower())395 doc.add_term("AC" + cat.lower())
@@ -534,6 +541,7 @@
534 AppInfoFields.PACKAGE: 'package_name',541 AppInfoFields.PACKAGE: 'package_name',
535 AppInfoFields.PRICE: 'price',542 AppInfoFields.PRICE: 'price',
536 AppInfoFields.DESCRIPTION: 'description',543 AppInfoFields.DESCRIPTION: 'description',
544 AppInfoFields.DOWNLOAD_SIZE: 'binary_filesize',
537 AppInfoFields.SUPPORTED_DISTROS: 'series',545 AppInfoFields.SUPPORTED_DISTROS: 'series',
538 AppInfoFields.SCREENSHOT_URLS: 'screenshot_url',546 AppInfoFields.SCREENSHOT_URLS: 'screenshot_url',
539 AppInfoFields.SUMMARY: 'comment',547 AppInfoFields.SUMMARY: 'comment',
@@ -792,6 +800,7 @@
792 AppInfoFields.DATE_PUBLISHED: 'X-AppInstall-Date-Published',800 AppInfoFields.DATE_PUBLISHED: 'X-AppInstall-Date-Published',
793 AppInfoFields.DEB_LINE: 'X-AppInstall-Deb-Line',801 AppInfoFields.DEB_LINE: 'X-AppInstall-Deb-Line',
794 AppInfoFields.DESCRIPTION: 'X-AppInstall-Description',802 AppInfoFields.DESCRIPTION: 'X-AppInstall-Description',
803 AppInfoFields.DOWNLOAD_SIZE: 'X-AppInstall-DownloadSize',
795 AppInfoFields.GENERIC_NAME: 'GenericName',804 AppInfoFields.GENERIC_NAME: 'GenericName',
796 AppInfoFields.GETTEXT_DOMAIN: 'X-Ubuntu-Gettext-Domain',805 AppInfoFields.GETTEXT_DOMAIN: 'X-Ubuntu-Gettext-Domain',
797 AppInfoFields.ICON: 'Icon',806 AppInfoFields.ICON: 'Icon',
798807
=== modified file 'softwarecenter/enums.py'
--- softwarecenter/enums.py 2012-11-28 16:58:59 +0000
+++ softwarecenter/enums.py 2012-12-12 14:43:27 +0000
@@ -169,6 +169,8 @@
169 # this is used to provide a cataloged time if there is no a-x-i in use169 # this is used to provide a cataloged time if there is no a-x-i in use
170 # or if a-x-i is not available yet170 # or if a-x-i is not available yet
171 DB_CATALOGED_TIME = 202171 DB_CATALOGED_TIME = 202
172 # download size as the agent provides it
173 DOWNLOAD_SIZE = 203
172174
173175
174class AppInfoFields:176class AppInfoFields:
@@ -176,6 +178,7 @@
176 CHANNEL = 'CHANNEL'178 CHANNEL = 'CHANNEL'
177 DEB_LINE = 'DEB_LINE'179 DEB_LINE = 'DEB_LINE'
178 DEB_LINE_ORIG = 'DEB_LINE_ORIG'180 DEB_LINE_ORIG = 'DEB_LINE_ORIG'
181 DOWNLOAD_SIZE = 'DOWNLOAD_SIZE'
179 CATEGORIES = 'CATEGORIES'182 CATEGORIES = 'CATEGORIES'
180 DATE_PUBLISHED = 'DATE_PUBLISHED'183 DATE_PUBLISHED = 'DATE_PUBLISHED'
181 DESCRIPTION = 'DESCRIPTION'184 DESCRIPTION = 'DESCRIPTION'
182185
=== modified file 'softwarecenter/ui/gtk3/views/appdetailsview.py'
--- softwarecenter/ui/gtk3/views/appdetailsview.py 2012-12-06 16:16:49 +0000
+++ softwarecenter/ui/gtk3/views/appdetailsview.py 2012-12-12 14:43:27 +0000
@@ -2004,6 +2004,17 @@
2004 if not self.totalsize_info.get_property('visible'):2004 if not self.totalsize_info.get_property('visible'):
2005 return False2005 return False
20062006
2007 # if we need to purchase/enable the report use the agent info
2008 if self.app_details.pkg_state in (
2009 PkgStates.NEEDS_SOURCE,
2010 PkgStates.NEEDS_PURCHASE,
2011 PkgStates.PURCHASED_BUT_REPO_MUST_BE_ENABLED,
2012 ):
2013 if self.app_details.size:
2014 self.totalsize_info.set_value(
2015 GLib.format_size(self.app_details.size))
2016 return
2017
2007 self.totalsize_info.set_value(_("Calculating..."))2018 self.totalsize_info.set_value(_("Calculating..."))
20082019
2009 while Gtk.events_pending():2020 while Gtk.events_pending():
20102021
=== modified file 'tests/test_reinstall_purchased.py'
--- tests/test_reinstall_purchased.py 2012-11-28 15:52:31 +0000
+++ tests/test_reinstall_purchased.py 2012-12-12 14:43:27 +0000
@@ -96,7 +96,8 @@
96 "categories": "AudioVideo",96 "categories": "AudioVideo",
97 "description": "Play DVD-Videos\\r\\n\\r\\nFluendo DVD Player is a software application specially designed to\\r\\nreproduce DVD on Linux/Unix platforms, which provides end users with\\r\\nhigh quality standards.\\r\\n\\r\\nThe following features are provided:\\r\\n* Full DVD Playback\\r\\n* DVD Menu support\\r\\n* Fullscreen support\\r\\n* Dolby Digital pass-through\\r\\n* Dolby Digital 5.1 output and stereo downmixing support\\r\\n* Resume from last position support\\r\\n* Subtitle support\\r\\n* Audio selection support\\r\\n* Multiple Angles support\\r\\n* Support for encrypted discs\\r\\n* Multiregion, works in all regions\\r\\n* Multiple video deinterlacing algorithms",97 "description": "Play DVD-Videos\\r\\n\\r\\nFluendo DVD Player is a software application specially designed to\\r\\nreproduce DVD on Linux/Unix platforms, which provides end users with\\r\\nhigh quality standards.\\r\\n\\r\\nThe following features are provided:\\r\\n* Full DVD Playback\\r\\n* DVD Menu support\\r\\n* Fullscreen support\\r\\n* Dolby Digital pass-through\\r\\n* Dolby Digital 5.1 output and stereo downmixing support\\r\\n* Resume from last position support\\r\\n* Subtitle support\\r\\n* Audio selection support\\r\\n* Multiple Angles support\\r\\n* Support for encrypted discs\\r\\n* Multiregion, works in all regions\\r\\n* Multiple video deinterlacing algorithms",
98 "website": null,98 "website": null,
99 "version": "1.2.1"99 "version": "1.2.1",
100 "binary_filesize": 12345
100 },101 },
101 {102 {
102 "website": "",103 "website": "",
@@ -163,6 +164,12 @@
163 self.assertEqual('Fluendo DVD Player',164 self.assertEqual('Fluendo DVD Player',
164 parser.get_value(AppInfoFields.NAME))165 parser.get_value(AppInfoFields.NAME))
165166
167 def test_binary_filesize(self):
168 parser = self._make_application_parser()
169
170 self.assertEqual(12345,
171 parser.get_value(AppInfoFields.DOWNLOAD_SIZE))
172
166 def test_keys_not_provided_by_api(self):173 def test_keys_not_provided_by_api(self):
167 parser = self._make_application_parser()174 parser = self._make_application_parser()
168175

Subscribers

People subscribed via source and target branches