allow for switching list icons
This commit is contained in:
parent
1d5a4113dc
commit
a6e08314ac
4 changed files with 18 additions and 14 deletions
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
};
|
||||
},
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue