bigboard r7327 - trunk/bigboard/stocks/apps
- From: otaylor svn gnome org
- To: svn-commits-list gnome org
- Subject: bigboard r7327 - trunk/bigboard/stocks/apps
- Date: Tue, 6 May 2008 21:57:28 +0100 (BST)
Author: otaylor
Date: Tue May 6 20:57:27 2008
New Revision: 7327
URL: http://svn.gnome.org/viewvc/bigboard?rev=7327&view=rev
Log:
- Sort global apps on usage, not on name (was supposed to be
that way with the last set of changes, but didn't end up
that way)
- Fix problem where apps retrieved via HTTP had string usageCount
causing 4000 to sort less than 432
- Limit length of list based on number of apps we have added,
not number of apps we have seen (and possibly skipped)
Modified:
trunk/bigboard/stocks/apps/AppsStock.py
trunk/bigboard/stocks/apps/apps.py
Modified: trunk/bigboard/stocks/apps/AppsStock.py
==============================================================================
--- trunk/bigboard/stocks/apps/AppsStock.py (original)
+++ trunk/bigboard/stocks/apps/AppsStock.py Tue May 6 20:57:27 2008
@@ -183,7 +183,7 @@
my_top_apps = []
global_top_apps = self.__repo.get_global_top_apps()
- global_top_apps.sort(self.__cmp_application_name)
+ global_top_apps.sort(self.__cmp_application_usage)
for app in (pinned_apps + my_top_apps + global_top_apps):
if app not in apps_in_set:
@@ -195,9 +195,10 @@
if global_top_apps and not my_top_apps and not pinned_apps:
self.__set_subtitle("Popular Applications")
- size = gconf.client_get_default().get_int(GCONF_KEY_APP_SIZE) or 7
- for i, app in enumerate(apps_in_set):
- if i >= size:
+ size = gconf.client_get_default().get_int(GCONF_KEY_APP_SIZE) or 7
+ count = 0
+ for app in apps_in_set:
+ if count >= size:
break
# don't display apps that are not installed if the user is not logged in
@@ -208,6 +209,8 @@
display.connect("button-press-event", lambda display, event: display.launch())
#_logger.debug("setting static set app: %s", app)
self.__applications.append(display)
+
+ count += 1
@defer_idle_func(logger=_logger)
def __sync(self):
Modified: trunk/bigboard/stocks/apps/apps.py
==============================================================================
--- trunk/bigboard/stocks/apps/apps.py (original)
+++ trunk/bigboard/stocks/apps/apps.py Tue May 6 20:57:27 2008
@@ -183,12 +183,16 @@
#id = node.getAttribute("id")
#_logger.debug("parsing application id=%s", id)
attrs = xml_get_attrs(node, ['id', 'rank', 'usageCount',
- 'iconUrl',
+ 'iconUrl',
'category',
'name', 'desktopNames', 'packageNames',
('tooltip', True),
('genericName', True)
])
+ # If we leave rank and usageCount as strings, then in the
+ # future, cmp() will return bogus results
+ attrs['rank'] = int(attrs['rank'])
+ attrs['usageCount'] = int(attrs['usageCount'])
description = xml_query(node, 'description#')
if description:
attrs['description'] = description
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]