From a6e08314ac8dcfd70f1ceadbd44800522506c74c Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Sun, 7 Aug 2011 20:25:33 +0000 Subject: [PATCH] allow for switching list icons --- pandora/scripts/item_icon | 2 -- static/js/pandora/ui/browser.js | 11 +++++++---- static/js/pandora/ui/list.js | 2 +- static/js/pandora/ui/menu.js | 17 ++++++++++------- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/pandora/scripts/item_icon b/pandora/scripts/item_icon index 16267c1..f01a07d 100755 --- a/pandora/scripts/item_icon +++ b/pandora/scripts/item_icon @@ -11,9 +11,7 @@ activate_this = os.path.join(root_dir, 'bin', 'activate_this.py') execfile(activate_this, dict(__file__=activate_this)) import Image -import ImageDraw from optparse import OptionParser -from ox.image import drawText, wrapText import sys diff --git a/static/js/pandora/ui/browser.js b/static/js/pandora/ui/browser.js index 8573316..3066df9 100644 --- a/static/js/pandora/ui/browser.js +++ b/static/js/pandora/ui/browser.js @@ -38,17 +38,20 @@ pandora.ui.browser = function() { } else { var that = Ox.IconList({ centered: true, - defaultRatio: 5/8, + defaultRatio: pandora.user.ui.icons == 'posters' ? 5/8 : 1, id: 'list', item: function(data, sort, size) { - var ratio = data.poster.width / data.poster.height; + var icons = pandora.user.ui.icons, + ratio = icons == 'posters' ? data.poster.width / data.poster.height : 1; size = size || 64; return { height: ratio <= 1 ? size : size / ratio, - id: data['id'], + id: data.id, info: data[['title', 'director'].indexOf(sort[0].key) > -1 ? 'year' : sort[0].key], title: data.title + (data.director ? ' (' + data.director + ')' : ''), - url: '/' + data['id'] + '/poster' + size + '.jpg', + url: icons == 'posters' + ? '/' + data.id + '/poster' + size + '.jpg' + : '/' + data.id + '/icon' + size + '.jpg', width: ratio >= 1 ? size : size * ratio }; }, diff --git a/static/js/pandora/ui/list.js b/static/js/pandora/ui/list.js index 789fea7..ef1b674 100644 --- a/static/js/pandora/ui/list.js +++ b/static/js/pandora/ui/list.js @@ -72,7 +72,7 @@ pandora.ui.list = function(view) { // fixme: remove view argument }); } else if (view == 'icons') { that = Ox.IconList({ - defaultRatio: 5/8, + defaultRatio: pandora.user.ui.icons == 'posters' ? 5/8 : 1, id: 'list', item: function(data, sort, size) { var icons = pandora.user.ui.icons, diff --git a/static/js/pandora/ui/menu.js b/static/js/pandora/ui/menu.js index 47352d9..5f514de 100644 --- a/static/js/pandora/ui/menu.js +++ b/static/js/pandora/ui/menu.js @@ -183,13 +183,16 @@ pandora.ui.mainMenu = function() { pandora.$ui.list.sortList(value, operator); pandora.URL.set(pandora.Query.toString()); } else if (data.id == 'viewicons') { - pandora.UI.set({icons: value}) - var $list = !pandora.user.ui.item ? pandora.$ui.list : pandora.$ui.browser; - /* - list.options({ - item: - }); - */ + var $list; + pandora.UI.set({icons: value}); + if (pandora.user.ui.item) { + $list = pandora.$ui.browser; + } else if (pandora.user.ui.lists[pandora.user.ui.list].listView == 'icons') { + $list = pandora.$ui.list + } + $list && $list.options({ + defaultRatio: value == 'posters' ? 5/8 : 1 + }).reloadList(); } else if (data.id == 'viewmovies') { url('#view=' + value); }