122
122
self.icon_cache = {}
124
def _on_image_download_complete(
125
self, downloader, image_file_path, pkgname):
126
LOG.debug("download for '%s' complete" % image_file_path)
128
pb = GdkPixbuf.Pixbuf.new_from_file_at_size(image_file_path,
131
except GObject.GError as e:
132
LOG.warn("Failed to get image file for '%s' (%s)",
135
# replace the icon in the icon_cache now that we've got the real
137
icon_file = split_icon_ext(os.path.basename(image_file_path))
138
self.icon_cache[icon_file] = pb
139
self.emit("needs-refresh", pkgname)
124
141
def _download_icon_and_show_when_ready(self, url, pkgname, icon_file_name):
125
142
LOG.debug("did not find the icon locally, must download %s" %
128
def on_image_download_complete(downloader, image_file_path, pkgname):
129
LOG.debug("download for '%s' complete" % image_file_path)
130
pb = GdkPixbuf.Pixbuf.new_from_file_at_size(icon_file_path,
133
# replace the icon in the icon_cache now that we've got the real
135
icon_file = split_icon_ext(os.path.basename(image_file_path))
136
self.icon_cache[icon_file] = pb
137
self.emit("needs-refresh", pkgname)
139
145
if url is not None:
140
146
icon_file_path = os.path.join(SOFTWARE_CENTER_ICON_CACHE_DIR,
142
148
image_downloader = SimpleFileDownloader()
143
149
image_downloader.connect('file-download-complete',
144
on_image_download_complete, pkgname)
150
self._on_image_download_complete, pkgname)
145
151
image_downloader.download_file(url, icon_file_path)