From 24e05a0b065b7d01417efeabb07523b3cc8c0bf0 Mon Sep 17 00:00:00 2001 From: pepperpepperpepper Date: Mon, 16 Nov 2015 16:35:11 -0800 Subject: gallery first draft --- gallery/gallery.py | 206 +++-------------------------------------------------- 1 file changed, 9 insertions(+), 197 deletions(-) (limited to 'gallery/gallery.py') diff --git a/gallery/gallery.py b/gallery/gallery.py index 37af36c..ba3cb70 100644 --- a/gallery/gallery.py +++ b/gallery/gallery.py @@ -2,7 +2,6 @@ import os import cgi import re - import random import db @@ -55,202 +54,15 @@ class Gallery(object): return _TAG_TRANSLATE.get(tag, tag) def get_files (params): - sql = "SELECT * FROM im_cmd " - args = [] - where = [] - - if params['start'] is not None: - where.append("id < %s") - args.append(params['start']) - if params['name'] is not None: - where.append("name=%s") - args.append(params['name']) - if params['tag'] is not None: - where.append("tag=%s") - args.append(tagTranslate(params['tag'])) - if len(where): - sql += "WHERE " - sql += " AND ".join(where) - sql += " " - - if params['random'] is not None: - if params['random'] == '1': - sql += "ORDER BY RAND(" + str(random.randint(1,2**63)) + ") " - else: - sql += "ORDER BY RAND(" + params['random'] + ") " - else: - sql += "ORDER BY id DESC " - sql += "LIMIT %s" + """does a select * from im_cmd + with a where clause + the where clause needs to search by + name + id lt or gt + tag (using tag translate) + random (bool) - if params['limit'] is not None: - args.append( int(params['limit']) ) - else: - args.append( SQL_LIMIT ) - db.execute(sql, args) - rows = db.cursor.fetchall () - return rows + normally the results are ordered by id descending + """ params = get_params(PARAMLIST) - - -@-webkit-keyframes pulsate_and_grow { - 0% {-webkit-transform: scale(0.1, 0.1); opacity: 0.1;} - 50% {opacity: 1.0;} - 100% {-webkit-transform: scale(1.0, 1.0); opacity: 0.1;} -} -.tag-options:active, .tag-clear:active { - -webkit-animation: pulsate_opacity 0.5s ease-out; - -webkit-animation-iteration-count: 3; - opacity: 1.0; - -} -.sorting-options:active { - -webkit-animation: pulsate_opacity 0.5s ease-out; - -webkit-animation-iteration-count: 3; - opacity: 1.0; - -} -@-webkit-keyframes pulsate_opacity{ - 0% { opacity: 0.1;} - 50% {opacity: 1.0;} - 100% {opacity: 0.1;} -} - - - - - -
- key controls -
-
-
when composer is launched...
-
ESC toggle
-
C clear
-
R reverse
-
-
in the gallery...
-
BACKSPACE delete
-
LEFT ARROW newer
-
RIGHT ARROW older
-
-
-
- sort -
-
date
-
username
-
height
-
width
-
gif
-
shuffle
-
lombada
-
-
-
- tags -
- - -
remove tag
-
transparent
-
break
-
gradient
-
grid
-
pattern
-
landscape
-
shader
-
ascii
-
Over
-
ATop
-
Dst_Over
-
Dst_In
-
Dst_Out
-
Multiply
-
Screen
-
Divide
-
Plus
-
Difference
-
Exclusion
-
Lighten
-
Darken
-
Overlay
-
Hard_Light
-
Soft_Light
-
Pegtop_Light
-
Linear_Light
-
Vivid_Light
-
Pin_Light
-
Linear_Dodge
-
Linear_Burn
-
Color_Dodge
-
Color_Burn
- -
-
-
-
- -
-
copy
-
- -
-
-""" - - -previous_id = lowest_id + (SQL_LIMIT * 2) -back = ["start=%d" % lowest_id, "limit=%d" % SQL_LIMIT] -newer = ["start=%d" % previous_id, "limit=%d" % SQL_LIMIT] -random_time = "" -if params['name'] is not None: - back.append("name=%s" % params['name']) - newer.append("name=%s" % params['name']) - random_time = "name=%s" % params['name'] -if params['tag'] is not None: - back.append("tag=%s" % params['tag']) - newer.append("tag=%s" % params['tag']) - random_time = "tag=%s" % params['tag'] - -newer_QS = "&".join(newer) -back_QS = "&".join(back) -random_time_QS = ""; -if random_time: - random_time_QS = "&%s" % random_time; -print "
" -print "editor" -print "|" -print "← newer" % newer_QS; -print "|" -if params['random'] is not None and params['random'] == '1': - print "random" % (random.randint(1,2**63), random_time_QS); -else: - print "random" % (1, random_time_QS); -print "|" -print "older →" % back_QS; -print "
" -print """ -else: - print "Main.init()" -print """ - - -""" - -- cgit v1.2.3-70-g09d2