Merge lp:~gary-lasker/software-center/icon-data-for-4.0 into lp:software-center/4.0

Proposed by Gary Lasker
Status: Merged
Merged at revision: 1790
Proposed branch: lp:~gary-lasker/software-center/icon-data-for-4.0
Merge into: lp:software-center/4.0
Diff against target: 193 lines (+55/-19)
8 files modified
README (+1/-0)
debian/changelog (+8/-0)
softwarecenter/db/application.py (+4/-0)
softwarecenter/db/database.py (+5/-0)
softwarecenter/db/update.py (+10/-15)
softwarecenter/enums.py (+1/-0)
softwarecenter/models/appstore.py (+22/-4)
softwarecenter/view/softwarepane.py (+4/-0)
To merge this branch: bzr merge lp:~gary-lasker/software-center/icon-data-for-4.0
Reviewer Review Type Date Requested Status
software-store-developers Pending
Review via email: mp+88289@code.launchpad.net

Description of the change

This branch for a Natty SRU removes the need for the inline icon data from the software-center-agent, and instead downloads the icon directly using the provided url from the agent.

We currently already have this functionality for Oneiric and Precise.

Thanks!

To post a comment you must log in.
1795. By Gary Lasker

d'oh, fix typo in README

Revision history for this message
Gary Lasker (gary-lasker) wrote :

Just a note that I've tested this branch in a Natty VM using both staging and production servers as per my comment for the Maverick merge proposal. Thanks again!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'README'
--- README 2011-03-20 19:19:58 +0000
+++ README 2012-01-12 00:32:23 +0000
@@ -86,4 +86,5 @@
86XAPIAN_VALUE_SCREENSHOT_URL - a (optional) screenshot url that overrides the default86XAPIAN_VALUE_SCREENSHOT_URL - a (optional) screenshot url that overrides the default
87XAPIAN_VALUE_ICON_NEEDS_DOWNLOAD - icon needs to be fetched87XAPIAN_VALUE_ICON_NEEDS_DOWNLOAD - icon needs to be fetched
88XAPIAN_VALUE_THUMBNAIL_URL - thumbnail url 88XAPIAN_VALUE_THUMBNAIL_URL - thumbnail url
89XAPIAN_VALUE_ICON_URL - the icon url for an application that has been provided by the agent (only available after the software-center-agent server was queried)
8990
9091
=== modified file 'debian/changelog'
--- debian/changelog 2011-11-24 09:05:02 +0000
+++ debian/changelog 2012-01-12 00:32:23 +0000
@@ -1,3 +1,11 @@
1software-center (4.0.7) UNRELEASED; urgency=low
2
3 * lp:~gary-lasker/software-center/icon-data-for-4.0:
4 - remove the need for inline icon data from the agent, instead
5 download icons directly using the provided URL (LP: #914054)
6
7 -- Gary Lasker <gary.lasker@canonical.com> Wed, 11 Jan 2012 18:25:49 -0500
8
1software-center (4.0.6) natty-proposed; urgency=low9software-center (4.0.6) natty-proposed; urgency=low
210
3 * cherry pick fix to allow webkit to create additional windows11 * cherry pick fix to allow webkit to create additional windows
412
=== modified file 'softwarecenter/db/application.py'
--- softwarecenter/db/application.py 2011-04-12 13:19:00 +0000
+++ softwarecenter/db/application.py 2012-01-12 00:32:23 +0000
@@ -335,6 +335,10 @@
335 335
336 @property336 @property
337 def icon_url(self):337 def icon_url(self):
338 if self._doc:
339 icon_url = self._db.get_icon_url(self._doc)
340 if icon_url:
341 return icon_url
338 return self._distro.get_downloadable_icon_url(self._cache, self.pkgname, self.icon_file_name)342 return self._distro.get_downloadable_icon_url(self._cache, self.pkgname, self.icon_file_name)
339343
340 @property344 @property
341345
=== modified file 'softwarecenter/db/database.py'
--- softwarecenter/db/database.py 2011-04-11 16:12:10 +0000
+++ softwarecenter/db/database.py 2012-01-12 00:32:23 +0000
@@ -331,6 +331,11 @@
331 """ Return the iconname from the xapian document """331 """ Return the iconname from the xapian document """
332 iconname = doc.get_value(XAPIAN_VALUE_ICON)332 iconname = doc.get_value(XAPIAN_VALUE_ICON)
333 return iconname333 return iconname
334
335 def get_icon_url(self, doc):
336 """ Return the icon_url from the xapian document """
337 icon_url = doc.get_value(XAPIAN_VALUE_ICON_URL)
338 return icon_url
334339
335 def pkg_in_category(self, pkgname, cat_query):340 def pkg_in_category(self, pkgname, cat_query):
336 """ Return True if the given pkg is in the given category """341 """ Return True if the given pkg is in the given category """
337342
=== modified file 'softwarecenter/db/update.py'
--- softwarecenter/db/update.py 2011-04-14 02:25:14 +0000
+++ softwarecenter/db/update.py 2012-01-12 00:32:23 +0000
@@ -122,6 +122,7 @@
122 'Purchased-Date' : 'purchase_date',122 'Purchased-Date' : 'purchase_date',
123 'PPA' : 'archive_id',123 'PPA' : 'archive_id',
124 'Icon' : 'icon',124 'Icon' : 'icon',
125 'Icon-Url' : 'icon_url',
125 'Screenshot-Url' : 'screenshot_url',126 'Screenshot-Url' : 'screenshot_url',
126 'Thumbnail-Url' : 'thumbnail_url',127 'Thumbnail-Url' : 'thumbnail_url',
127 }128 }
@@ -472,21 +473,6 @@
472 try:473 try:
473 # magic channel474 # magic channel
474 entry.channel = AVAILABLE_FOR_PURCHASE_MAGIC_CHANNEL_NAME475 entry.channel = AVAILABLE_FOR_PURCHASE_MAGIC_CHANNEL_NAME
475 # icon is transmited inline
476 if hasattr(entry, "icon_data") and entry.icon_data:
477 icondata = base64.b64decode(entry.icon_data)
478 elif hasattr(entry, "icon_64_data") and entry.icon_64_data:
479 # workaround for scagent bug #740112
480 icondata = base64.b64decode(entry.icon_64_data)
481 else:
482 icondata = ""
483 # write it if we have data
484 if icondata:
485 # the iconcache gets mightly confused if there is a "." in the name
486 iconname = "sc-agent-%s" % entry.package_name.replace(".", "__")
487 open(os.path.join(SOFTWARE_CENTER_ICON_CACHE_DIR,
488 "%s.png" % iconname),"w").write(icondata)
489 entry.icon = iconname
490 # now the normal parser476 # now the normal parser
491 parser = SoftwareCenterAgentParser(entry)477 parser = SoftwareCenterAgentParser(entry)
492 index_app_info_from_parser(parser, db, cache)478 index_app_info_from_parser(parser, db, cache)
@@ -586,6 +572,15 @@
586 # add archive origin data here so that its available even if572 # add archive origin data here so that its available even if
587 # the PPA is not (yet) enabled573 # the PPA is not (yet) enabled
588 doc.add_term("XOO"+"lp-ppa-%s" % archive_ppa.replace("/", "-"))574 doc.add_term("XOO"+"lp-ppa-%s" % archive_ppa.replace("/", "-"))
575 # icon (for third party)
576 if parser.has_option_desktop("X-AppInstall-Icon-Url"):
577 doc.add_value(XAPIAN_VALUE_ICON_NEEDS_DOWNLOAD, "1")
578 url = parser.get_desktop("X-AppInstall-Icon-Url")
579 doc.add_value(XAPIAN_VALUE_ICON_URL, url)
580 if not parser.has_option_desktop("X-AppInstall-Icon"):
581 # prefix pkgname to avoid name clashes
582 doc.add_value(XAPIAN_VALUE_ICON, "%s-icon-%s" % (
583 pkgname, os.path.basename(url)))
589 # screenshot (for third party)584 # screenshot (for third party)
590 if parser.has_option_desktop("X-AppInstall-Screenshot-Url"):585 if parser.has_option_desktop("X-AppInstall-Screenshot-Url"):
591 url = parser.get_desktop("X-AppInstall-Screenshot-Url")586 url = parser.get_desktop("X-AppInstall-Screenshot-Url")
592587
=== modified file 'softwarecenter/enums.py'
--- softwarecenter/enums.py 2011-05-10 14:50:15 +0000
+++ softwarecenter/enums.py 2012-01-12 00:32:23 +0000
@@ -101,6 +101,7 @@
101XAPIAN_VALUE_THUMBNAIL_URL = 187101XAPIAN_VALUE_THUMBNAIL_URL = 187
102XAPIAN_VALUE_SC_DESCRIPTION = 188102XAPIAN_VALUE_SC_DESCRIPTION = 188
103XAPIAN_VALUE_APPNAME_UNTRANSLATED = 189103XAPIAN_VALUE_APPNAME_UNTRANSLATED = 189
104XAPIAN_VALUE_ICON_URL = 190
104105
105# fake channels106# fake channels
106PURCHASED_NEEDS_REINSTALL_MAGIC_CHANNEL_NAME = "for-pay-needs-reinstall"107PURCHASED_NEEDS_REINSTALL_MAGIC_CHANNEL_NAME = "for-pay-needs-reinstall"
107108
=== modified file 'softwarecenter/models/appstore.py'
--- softwarecenter/models/appstore.py 2011-04-12 13:54:58 +0000
+++ softwarecenter/models/appstore.py 2012-01-12 00:32:23 +0000
@@ -85,6 +85,13 @@
85 (NONAPPS_ALWAYS_VISIBLE,85 (NONAPPS_ALWAYS_VISIBLE,
86 NONAPPS_MAYBE_VISIBLE,86 NONAPPS_MAYBE_VISIBLE,
87 NONAPPS_NEVER_VISIBLE) = range (3)87 NONAPPS_NEVER_VISIBLE) = range (3)
88
89 __gsignals__ = {
90 "needs-refresh" : (gobject.SIGNAL_RUN_LAST,
91 None,
92 (str, ),
93 ),
94 }
8895
89 def __init__(self, cache, db, icons, search_query=None, 96 def __init__(self, cache, db, icons, search_query=None,
90 limit=DEFAULT_SEARCH_LIMIT,97 limit=DEFAULT_SEARCH_LIMIT,
@@ -381,7 +388,7 @@
381 if result.pkgname in self.transaction_index_map:388 if result.pkgname in self.transaction_index_map:
382 del self.transaction_index_map[result.pkgname]389 del self.transaction_index_map[result.pkgname]
383390
384 def _download_icon_and_show_when_ready(self, cache, pkgname, icon_file_name):391 def _download_icon_and_show_when_ready(self, cache, pkgname, icon_file_name, icon_url):
385 self._logger.debug("did not find the icon locally, must download %s" % icon_file_name)392 self._logger.debug("did not find the icon locally, must download %s" % icon_file_name)
386 def on_image_download_complete(downloader, image_file_path):393 def on_image_download_complete(downloader, image_file_path):
387 pb = gtk.gdk.pixbuf_new_from_file_at_size(icon_file_path,394 pb = gtk.gdk.pixbuf_new_from_file_at_size(icon_file_path,
@@ -390,8 +397,15 @@
390 # replace the icon in the icon_cache now that we've got the real one397 # replace the icon in the icon_cache now that we've got the real one
391 icon_file = os.path.splitext(os.path.basename(image_file_path))[0]398 icon_file = os.path.splitext(os.path.basename(image_file_path))[0]
392 self.icon_cache[icon_file] = pb399 self.icon_cache[icon_file] = pb
393 400 self.emit("needs-refresh", pkgname)
394 url = get_distro().get_downloadable_icon_url(cache, pkgname, icon_file_name)401
402 if icon_url:
403 url = icon_url
404 else:
405 # if the icon url has not been provided by the agent, then this
406 # downloadable icon is from the extras repository and so we must
407 # generate the download url
408 url = get_distro().get_downloadable_icon_url(cache, pkgname, icon_file_name)
395 if url is not None:409 if url is not None:
396 icon_file_path = os.path.join(SOFTWARE_CENTER_ICON_CACHE_DIR, icon_file_name)410 icon_file_path = os.path.join(SOFTWARE_CENTER_ICON_CACHE_DIR, icon_file_name)
397 image_downloader = SimpleFileDownloader()411 image_downloader = SimpleFileDownloader()
@@ -514,9 +528,13 @@
514 self.icon_cache[icon_name] = icon528 self.icon_cache[icon_name] = icon
515 return icon529 return icon
516 elif self.db.get_icon_needs_download(doc):530 elif self.db.get_icon_needs_download(doc):
531 # check if this is a downloadable icon for an
532 # application provided by the agent
533 icon_url = self.db.get_icon_url(doc)
517 self._download_icon_and_show_when_ready(self.cache, 534 self._download_icon_and_show_when_ready(self.cache,
518 app.pkgname,535 app.pkgname,
519 icon_file_name)536 icon_file_name,
537 icon_url)
520 # display the missing icon while the real one downloads538 # display the missing icon while the real one downloads
521 self.icon_cache[icon_name] = self._appicon_missing_icon539 self.icon_cache[icon_name] = self._appicon_missing_icon
522 except glib.GError, e:540 except glib.GError, e:
523541
=== modified file 'softwarecenter/view/softwarepane.py'
--- softwarecenter/view/softwarepane.py 2011-06-02 19:13:33 +0000
+++ softwarecenter/view/softwarepane.py 2012-01-12 00:32:23 +0000
@@ -719,6 +719,10 @@
719 # set model719 # set model
720 self.app_view.set_model(new_model)720 self.app_view.set_model(new_model)
721 self.app_view.get_model().active = True721 self.app_view.get_model().active = True
722
723 # connect the refresh signal from the model
724 new_model.connect(
725 "needs-refresh", lambda helper, pkgname: self.app_view.queue_draw())
722726
723 self.hide_appview_spinner()727 self.hide_appview_spinner()
724 # we can not use "new_model" here, because set_model may actually728 # we can not use "new_model" here, because set_model may actually

Subscribers

People subscribed via source and target branches