allow for switching list icons
This commit is contained in:
parent
59273eba79
commit
881ce6513d
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))
|
execfile(activate_this, dict(__file__=activate_this))
|
||||||
|
|
||||||
import Image
|
import Image
|
||||||
import ImageDraw
|
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
from ox.image import drawText, wrapText
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -38,17 +38,20 @@ pandora.ui.browser = function() {
|
||||||
} else {
|
} else {
|
||||||
var that = Ox.IconList({
|
var that = Ox.IconList({
|
||||||
centered: true,
|
centered: true,
|
||||||
defaultRatio: 5/8,
|
defaultRatio: pandora.user.ui.icons == 'posters' ? 5/8 : 1,
|
||||||
id: 'list',
|
id: 'list',
|
||||||
item: function(data, sort, size) {
|
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;
|
size = size || 64;
|
||||||
return {
|
return {
|
||||||
height: ratio <= 1 ? size : size / ratio,
|
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],
|
info: data[['title', 'director'].indexOf(sort[0].key) > -1 ? 'year' : sort[0].key],
|
||||||
title: data.title + (data.director ? ' (' + data.director + ')' : ''),
|
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
|
width: ratio >= 1 ? size : size * ratio
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
|
@ -72,7 +72,7 @@ pandora.ui.list = function(view) { // fixme: remove view argument
|
||||||
});
|
});
|
||||||
} else if (view == 'icons') {
|
} else if (view == 'icons') {
|
||||||
that = Ox.IconList({
|
that = Ox.IconList({
|
||||||
defaultRatio: 5/8,
|
defaultRatio: pandora.user.ui.icons == 'posters' ? 5/8 : 1,
|
||||||
id: 'list',
|
id: 'list',
|
||||||
item: function(data, sort, size) {
|
item: function(data, sort, size) {
|
||||||
var icons = pandora.user.ui.icons,
|
var icons = pandora.user.ui.icons,
|
||||||
|
|
|
@ -183,13 +183,16 @@ pandora.ui.mainMenu = function() {
|
||||||
pandora.$ui.list.sortList(value, operator);
|
pandora.$ui.list.sortList(value, operator);
|
||||||
pandora.URL.set(pandora.Query.toString());
|
pandora.URL.set(pandora.Query.toString());
|
||||||
} else if (data.id == 'viewicons') {
|
} else if (data.id == 'viewicons') {
|
||||||
pandora.UI.set({icons: value})
|
var $list;
|
||||||
var $list = !pandora.user.ui.item ? pandora.$ui.list : pandora.$ui.browser;
|
pandora.UI.set({icons: value});
|
||||||
/*
|
if (pandora.user.ui.item) {
|
||||||
list.options({
|
$list = pandora.$ui.browser;
|
||||||
item:
|
} 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') {
|
} else if (data.id == 'viewmovies') {
|
||||||
url('#view=' + value);
|
url('#view=' + value);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue