summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2010-04-07 19:38:37 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2010-04-07 19:38:37 +0200
commit0973e4f3616f4e41f15bac9c0aa9e5c8f27939a1 (patch)
treee69cd16dd6b16f3438371ce7e2265b8437aedebd
parentc797564725ea320429cd555607b0af10df1ad4e6 (diff)
downloadweb-0973e4f3616f4e41f15bac9c0aa9e5c8f27939a1.tar.gz
web-0973e4f3616f4e41f15bac9c0aa9e5c8f27939a1.tar.bz2
web-0973e4f3616f4e41f15bac9c0aa9e5c8f27939a1.zip
Screenshots
-rw-r--r--helper.py36
-rw-r--r--static/images/screens/masked.pngbin0 -> 69485 bytes
-rw-r--r--static/images/screens/masked.png.desc1
-rw-r--r--static/images/screens/preferences.pngbin0 -> 93128 bytes
-rw-r--r--templates/pages/screenshots.mako30
5 files changed, 66 insertions, 1 deletions
diff --git a/helper.py b/helper.py
index ec7950b..552c526 100644
--- a/helper.py
+++ b/helper.py
@@ -1,5 +1,8 @@
import web
import os
+import Image
+
+opj = os.path.join
APPDIR = os.path.dirname(os.path.abspath(__file__))
def appdir (*args):
@@ -11,3 +14,36 @@ def url (path):
def toJS (ls):
ls = ("'%s':'%s'" % x for x in ls)
return "{ %s }" % ", ".join(ls)
+
+def getImages (path, tmpPath, size):
+ if path[0] != '/': path = '/' + path
+ if tmpPath[0] != '/': tmpPath = '/' + tmpPath
+
+
+ appPath = appdir(path[1:])
+ appTPath = appdir(tmpPath[1:])
+
+ for f in sorted(os.listdir(appPath)):
+ if not f.endswith(".png"): continue
+
+ thumbName = "thumb-" + f
+ imgUrl = url(opj(path, f))
+ thumbUrl = url(opj(tmpPath, thumbName))
+
+ imgPath = opj(appPath, f)
+ thumbPath = opj(appTPath, thumbName)
+
+ if (not os.path.exists(thumbPath)) or \
+ os.stat(imgPath).st_mtime > os.stat(thumbPath).st_mtime:
+ im = Image.open(imgPath)
+ im.thumbnail(size, Image.ANTIALIAS)
+ im.save(thumbPath)
+
+ descName = f + ".desc"
+ desc = None
+
+ if os.path.exists(opj(appPath, descName)):
+ with open(opj(appPath, descName)) as d:
+ desc = d.read().strip()
+
+ yield (imgUrl, thumbUrl, desc)
diff --git a/static/images/screens/masked.png b/static/images/screens/masked.png
new file mode 100644
index 0000000..bd7c51d
--- /dev/null
+++ b/static/images/screens/masked.png
Binary files differ
diff --git a/static/images/screens/masked.png.desc b/static/images/screens/masked.png.desc
new file mode 100644
index 0000000..554260b
--- /dev/null
+++ b/static/images/screens/masked.png.desc
@@ -0,0 +1 @@
+Main screen
diff --git a/static/images/screens/preferences.png b/static/images/screens/preferences.png
new file mode 100644
index 0000000..0c53bed
--- /dev/null
+++ b/static/images/screens/preferences.png
Binary files differ
diff --git a/templates/pages/screenshots.mako b/templates/pages/screenshots.mako
index 539184d..6e85b2a 100644
--- a/templates/pages/screenshots.mako
+++ b/templates/pages/screenshots.mako
@@ -3,4 +3,32 @@
%>
<%inherit file="/page.mako" />
-<p>Nothing here yet!</p>
+<%def name="style()">
+ ${parent.style()}
+
+ <!-- highslide stuff -->
+ <script src=${"/static/js/highslide.js" | url} type="text/javascript"></script>
+ <script type="text/javascript">
+ hs.graphicsDir = ${"/static/images/highslide/" | url};
+ hs.align = 'center';
+ hs.showCredits = false;
+ hs.captionEval = 'this.thumb.alt';
+ hs.outlineType = 'outer-glow';
+ hs.wrapperClassName = 'outer-glow';
+ hs.fullExpandOpacity = 0.5;
+
+ </script>
+
+ <link href=${"/static/css/highslide.css" | url} rel="stylesheet" type="text/css" />
+</%def>
+
+<p>
+ % for f,t,d in h.getImages("static/images/screens/", "static/images/tmp/", (150,150)):
+ <a href=${f} class="highslide" rel="highslide">
+ <img src=${t} alt="${d if d else 'Portato screenie'}" title="Click to enlarge" />
+ </a>
+ ## % if d is not None:
+ ## <div class="highslide-caption">${d}</div>
+ ##% endif
+ % endfor
+</a>