From 1d5a4113dcf2b87b177cdebda236a0849ea77a5e Mon Sep 17 00:00:00 2001
From: rlx <0x0073@0x2620.org>
Date: Sun, 7 Aug 2011 18:30:14 +0000
Subject: [PATCH] new icon script
---
pandora/scripts/item_icon | 25 +++++++++------
pandora/templates/api.html | 2 +-
pandora/templates/embed.html | 2 +-
pandora/templates/index.html | 15 ++++-----
static/js/pandora/UI.js | 10 ++----
static/js/pandora/ui/menu.js | 41 ++++++++++++-------------
static/png/icon.mask.png | Bin 3581 -> 0 bytes
static/png/{icon.16.png => icon16.png} | Bin
static/png/iconMask.png | Bin 0 -> 6446 bytes
static/png/iconTimeline.png | Bin 0 -> 2997 bytes
static/png/iconTimelineInnerMask.png | Bin 0 -> 1831 bytes
static/png/iconTimelineOuterMask.png | Bin 0 -> 1924 bytes
12 files changed, 47 insertions(+), 48 deletions(-)
delete mode 100644 static/png/icon.mask.png
rename static/png/{icon.16.png => icon16.png} (100%)
create mode 100644 static/png/iconMask.png
create mode 100644 static/png/iconTimeline.png
create mode 100644 static/png/iconTimelineInnerMask.png
create mode 100644 static/png/iconTimelineOuterMask.png
diff --git a/pandora/scripts/item_icon b/pandora/scripts/item_icon
index 94b7b40..16267c1 100755
--- a/pandora/scripts/item_icon
+++ b/pandora/scripts/item_icon
@@ -20,13 +20,13 @@ import sys
static_root = os.path.join(os.path.dirname(__file__), '..', '..', 'static')
def render_icon(frame, timeline, icon):
- icon_width = 512
- icon_height = 512
+ icon_width = 1024
+ icon_height = 1024
icon_image = Image.new('RGBA', (icon_width, icon_height), (0, 0, 0, 0))
frame_width = icon_width
- frame_ratio = 4 / 3
+ frame_ratio = 1
frame_height = int(round(frame_width / frame_ratio))
- frame_image = Image.open(frame) if frame else Image.new('RGB', (512, 384), (0, 0, 0))
+ frame_image = Image.open(frame) if frame else Image.new('RGB', (1024, 768), (0, 0, 0))
frame_image_ratio = frame_image.size[0] / frame_image.size[1]
if frame_ratio < frame_image_ratio:
frame_image = frame_image.resize((int(frame_height * frame_image_ratio), frame_height), Image.ANTIALIAS)
@@ -36,13 +36,20 @@ def render_icon(frame, timeline, icon):
frame_image = frame_image.resize((frame_width, int(frame_width / frame_image_ratio)), Image.ANTIALIAS)
top = int((frame_image.size[1] - frame_height) / 2)
frame_image = frame_image.crop((0, top, frame_width, top + frame_height))
- mask_image = Image.open(os.path.join(static_root, 'png', 'icon.mask.png'))
icon_image.paste(frame_image, (0, 0))
- timeline_image = Image.open(timeline) if timeline else Image.new('RGB', (512, 128), (0, 0, 0))
- timeline_image = timeline_image.resize((icon_width, 128), Image.ANTIALIAS)
- icon_image.paste(timeline_image, (0, icon_height - 128))
+ timeline_left = 64
+ timeline_top = 832
+ timeline_width = 896
+ timeline_height = 128
+ timeline_image = Image.new('RGB', (timeline_width + 8, timeline_height + 8), (255, 255, 255))
+ mask_image = Image.open(os.path.join(static_root, 'png', 'iconTimelineOuterMask.png'))
+ icon_image.paste(timeline_image, (timeline_left - 4, timeline_top - 4), mask=mask_image)
+ timeline_image = Image.open(timeline) if timeline else Image.new('RGB', (timeline_width, timeline_height), (0, 0, 0))
+ timeline_image = timeline_image.resize((timeline_width, timeline_height), Image.ANTIALIAS)
+ mask_image = Image.open(os.path.join(static_root, 'png', 'iconTimelineInnerMask.png'))
+ icon_image.paste(timeline_image, (timeline_left, timeline_top), mask=mask_image)
# we're using jpegs with border-radius
- # mask_image = Image.open(os.path.join(static_root, 'png', 'icon.mask.png'))
+ # mask_image = Image.open(os.path.join(static_root, 'png', 'iconMask.png'))
# icon_image.putalpha(mask_image)
icon_image.save(icon)
diff --git a/pandora/templates/api.html b/pandora/templates/api.html
index 59d3da7..0d64e93 100644
--- a/pandora/templates/api.html
+++ b/pandora/templates/api.html
@@ -4,7 +4,7 @@
{{sitename}} API
-
+
diff --git a/pandora/templates/embed.html b/pandora/templates/embed.html
index c4e2cc0..4bcb82f 100644
--- a/pandora/templates/embed.html
+++ b/pandora/templates/embed.html
@@ -3,7 +3,7 @@
{{settings.SITENAME}}
-
+
+
+
diff --git a/static/js/pandora/UI.js b/static/js/pandora/UI.js
index d7a13ef..8804bb3 100644
--- a/static/js/pandora/UI.js
+++ b/static/js/pandora/UI.js
@@ -1,13 +1,8 @@
// vim: et:ts=4:sw=4:sts=4:ft=javascript
pandora.UI = (function() {
return {
- set: function(obj) {
- if (arguments.length == 2) {
- // translate (key, value) to {key: value}
- var obj_ = {};
- obj_[arguments[0]] = arguments[1];
- obj = obj_;
- }
+ set: function(/*{key: val} or key, val*/) {
+ var obj = Ox.makeObject(arguments);
$.each(obj, function(key, val) {
Ox.print('key', key, 'val', val);
var i = 0,
@@ -24,7 +19,6 @@ pandora.UI = (function() {
}
});
Ox.len(obj) && pandora.api.setUI(obj);
- //alert('set ' + JSON.stringify(obj))
}
}
}());
diff --git a/static/js/pandora/ui/menu.js b/static/js/pandora/ui/menu.js
index 53e3731..47352d9 100644
--- a/static/js/pandora/ui/menu.js
+++ b/static/js/pandora/ui/menu.js
@@ -165,36 +165,33 @@ pandora.ui.mainMenu = function() {
})
.bindEvent({
change: function(event, data) {
+ var value = data.checked[0].id;
if (data.id == 'find') {
- var id = data.checked[0].id;
- pandora.$ui.findSelect.selectItem(id);
- } else if (data.id == 'icons') {
+ pandora.$ui.findSelect.selectItem(value);
+ } else if (data.id == 'movieview') {
+ var id = document.location.pathname.split('/')[1];
+ if (value == 'info')
+ url(id + '/info');
+ else
+ url(id);
+ } else if (data.id == 'ordermovies') {
+ pandora.$ui.list.sortList(pandora.user.ui.lists[pandora.user.ui.list].sort[0].key, value == 'ascending' ? '' : '-');
+ } else if (data.id == 'sortmovies') {
+ var operator = pandora.getSortOperator(value);
+ pandora.$ui.mainMenu.checkItem('sortMenu_ordermovies_' + (operator === '' ? 'ascending' : 'descending'));
+ pandora.$ui.sortSelect.selectItem(value);
+ 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:
});
*/
- } else if (data.id == 'movieview') {
- var view = data.checked[0].id;
- var id = document.location.pathname.split('/')[1];
- if (view == 'info')
- url(id + '/info');
- else
- url(id);
- } else if (data.id == 'ordermovies') {
- var id = data.checked[0].id;
- pandora.$ui.list.sortList(pandora.user.ui.lists[pandora.user.ui.list].sort[0].key, id == 'ascending' ? '' : '-');
- } else if (data.id == 'sortmovies') {
- var id = data.checked[0].id,
- operator = pandora.getSortOperator(id);
- pandora.$ui.mainMenu.checkItem('sortMenu_ordermovies_' + (operator === '' ? 'ascending' : 'descending'));
- pandora.$ui.sortSelect.selectItem(id);
- pandora.$ui.list.sortList(id, operator);
- pandora.URL.set(pandora.Query.toString());
} else if (data.id == 'viewmovies') {
- var view = data.checked[0].id;
- url('#view=' + view);
+ url('#view=' + value);
}
},
click: function(event, data) {
diff --git a/static/png/icon.mask.png b/static/png/icon.mask.png
deleted file mode 100644
index f13365385e59262da27f23f98f2f135aa24d761e..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 3581
zcmeH~`#%$GAICRxCWo<*!en=1n1;BM92R3kSY?ut!!EOf_{NB8Ub6P_RMAFl6peXrN+`sI3kKA-n>Wx2UH$Vsb90{{Ry
zl%u^n03fov6ah%?Rsat~g6=k}L_0e-l%1WHTU2-u@p2#l5DUDB$CuB1o)x@2)Y<9g
z=IJgtC{R^XRIBbxEKj+WQVf(;$|uQah>Bc4S^8xAiD%~Fw17Px(@c1>+TE)*LE8PG
z7eN?toUCUIAoG^HJ1IZq+deH9BO^UP_R$`|TL|hc{u(f|?0}L$Ryo`ckDt{;H3H@X
zBLSV^XVA?g+E%*ufCpwSVIk&^)m1FTCQ2l9Is@_Z|2
z%8QC?@BtOlN)=E*x=#0T`|n!a3TC=@!4#X=nUl(RH@q=E0xyYo45$r0*BMdpUasm`
zmCQxGIq9ARv_IMg4JtA;mO1KRVib_r<=@AD5kG}$3L_(+q&@}U!c&xqS5+a$3od#*`#N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xTo?*#4C!S^-{mQu?{HY1;9j&mklw)leXJSyADF;
zSUQ46vQNt)PRprM=vhww!`r_jP&;LJtiN#&t}BZA@;{Vct46se-DsIGGNkOekP
zPyc^;PRj+uZx!8UUt~F2oXI45@mxvdpDIO+cwE}>#qo_H$ecdfca?~Eer
zl(tjgf6D9x9ogA5QbhClg%u2$W
zqtlG^(Z%(mR!kR*tj=^$zpO?}=W~J`Ne6!64YA8UHxNH?&~O)h)IV5pHCbR2Of=c$
zo;4$#!`VxJ8{Ea>s!pY{>UWC4N{<$DfttJ6qa|6HRPJJLk0Dme?!@N`u?xLX0RyRL
zaGkACvQ2bJQnlDv*T;5F!-*wYuv%h+c0zC^suOO%`_jb>-CS
zdr&_!3~{4ZLOBjx0rublTHp%~@8$75?(-=?T!x&+VPpj5vXw)BMYOlG!sWPn?=Y^(
z?5X}Q$J0($e*CWR&+F-sg1YkwE4aOL2@Q15(1uem+~!+T{bGHCs+8t_ePn4$g5?#<
z-9jQY{0eKg&%Qn|E;}(l}kYZv%nZ5R+!761AV}|jd_1@8#A6JKKRJA
z(c4Tu7t3N@pWC<*T6W_svwF!o-Zswl;H0z97Om-F==AMdAC^_L`+v&I^BqnVw|`##
P^{+!AUF?~*_|*RbuP1MH
diff --git a/static/png/icon.16.png b/static/png/icon16.png
similarity index 100%
rename from static/png/icon.16.png
rename to static/png/icon16.png
diff --git a/static/png/iconMask.png b/static/png/iconMask.png
new file mode 100644
index 0000000000000000000000000000000000000000..df3efd76d8b1fc44cbdc422dfe9bb01093a6da9d
GIT binary patch
literal 6446
zcmeHM_g@oP*S`}2QCe8b0*b`_pcEGY1t|+5QCwM3B%+9dKoB7+3!#NjB!tyno?Q#;
zf`T9rAH;^B(t?yEh?+H2L3&9jp+lsEKtjkf_<8?=_h)~Zx%ZrN=d?R_zUR!JgcHsh
zs@qfn02)VsIqVJq5*{MK2KWlRqNDr(&=DU!eDHM4gPH!zr9OcP+_~huf^8RhyKBo1
zY5Qv-A9*+#|NLs}LA@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