# INCOMPLETE
from cPickle import dump, load
from os import basename
from os.path import exists, isdir, join
from sys import argv
from Zcgi import *
image_extentions = '.bmp', '.gif', '.jpg', '.png'
def main():
# Default Settings
title = 'Image Viewer'
image = ''
action = basename(argv[0])
back = ''
forward = ''
hidden = ''
if dictionary is None:
# Nothing To Do
pass
elif dictionary.had_key('directory'):
# Something To Do
if not dictionary.has_key('hidden'):
# Just Began Viewing
if isdir(dictionary['directory']):
# Check For Pickle
image_pickle = join(dictionary['directory'], 'image.pickle')
if exists(image_pickle):
# Load Directory Listing
dir_data = load(file(image_pickle))
else:
# Create Directory Listing
dir_data = update_image_pickle(dictionary['directory'])
# START HERE
image = WHAT_TO_DECIDE_HERE
else:
# Post Error Message
dictionary['directory'] = 'No Such Directory'
else:
# Find Next Image
show_form(title, image, action, back, forward, hidden)
def show_form(*form_settings):
print_html('''
\t
\t\t
\t\t\t%s
\t\t
\t
\t
\t\t%s
\t\t\t
\t\t
\t
''' % form_settings)