248
# draw the info vbox bg
249
if self.toprated_carousel:
250
a = self.toprated_carousel.allocation
251
rounded_rect(cr, a.x, a.y, a.width, a.height, 5)
252
cr.set_source_rgba(*color_floats("#F7F7F7")+(0.75,))
255
# draw the info header bg
256
a = self.toprated_carousel.header.allocation
257
rounded_rect2(cr, a.x, a.y, a.width, a.height, (5, 5, 0, 0))
258
cr.set_source_rgb(*color_floats("#DAD7D3"))
261
a = self.toprated_carousel.allocation
263
rounded_rect(cr, a.x+0.5, a.y+0.5, a.width-1, a.height-1, 5)
264
cr.set_source_rgba(*color_floats("#DAD7D3")+(0.3,))
246
269
if self.featured_carousel:
247
270
self.featured_carousel.draw(cr, self.featured_carousel.allocation, event.area)
248
271
if self.whatsnew_carousel:
249
272
self.whatsnew_carousel.draw(cr, self.whatsnew_carousel.allocation, event.area)
273
if self.toprated_carousel:
274
self.toprated_carousel.draw(cr, self.toprated_carousel.allocation, event.area)
252
277
self.start_carousels()
268
293
if self.whatsnew_carousel:
269
294
for poster in self.whatsnew_carousel.posters:
270
295
self._poster_sigs.append(poster.connect('clicked', self._on_app_clicked))
296
if self.toprated_carousel:
297
for poster in self.toprated_carousel.posters:
298
self._poster_sigs.append(poster.connect('clicked', self._on_app_clicked))
272
300
# print self._poster_sigs
345
375
return True # mutter..
347
377
@wait_for_apt_cache_ready # be consistent with new apps
378
def _append_toprated(self):
382
padding.set_size_request(-1, 6)
383
self.vbox.pack_start(padding, False)
385
toprated_cat = get_category_by_name(self.categories,
386
'Top Rated') # untranslated name
388
# the spec says the carousel icons should be 4em
389
# however, by not using a stock icon size, icons sometimes dont
392
# so based on the value of 4*em we try to choose a sane stock
394
best_stock_size = 64#mkit.get_nearest_stock_size(64)
395
toprated_apps = AppStore(self.cache,
399
toprated_cat.item_limit,
400
toprated_cat.sortmode,
401
filter=self.apps_filter,
402
icon_size=best_stock_size,
403
global_icon_cache=False,
404
nonapps_visible=AppStore.NONAPPS_ALWAYS_VISIBLE,
405
nonblocking_load=False)
407
self.toprated_carousel = CarouselView(self,
412
self.toprated_carousel.more_btn.connect('clicked',
413
self._on_category_clicked,
415
# pack featured carousel into hbox
416
self.vbox.pack_start(self.toprated_carousel, False)
419
@wait_for_apt_cache_ready # be consistent with new apps
348
420
def _append_featured(self):
350
422
# add some filler...
418
490
self.whatsnew_carousel.more_btn.connect('clicked',
419
491
self._on_category_clicked,
421
494
# pack whatsnew carousel into hbox
422
495
self.vbox.pack_start(self.whatsnew_carousel, False)
461
534
self.featured_carousel.start()
462
535
if self.whatsnew_carousel:
463
536
self.whatsnew_carousel.start(offset=5000)
537
if self.toprated_carousel:
538
self.toprated_carousel.start(offset=10000)
466
541
def stop_carousels(self):
468
543
self.featured_carousel.stop()
469
544
if self.whatsnew_carousel:
470
545
self.whatsnew_carousel.stop()
546
if self.toprated_carousel:
547
self.toprated_carousel.stop()
473
550
def build(self, desktopdir):