PythonSlideShow

Changeset

5:12b106f3967c
2010-08-26 ink raw files shortlog changelog graph Changed walkfs-writemarkup.py: trying to figure out vertical transition.
README (file) walkfs-writemarkup.py (file)
     1.1 --- a/README	Thu Aug 26 10:19:48 2010 +0300
     1.2 +++ b/README	Thu Aug 26 14:56:43 2010 +0300
     1.3 @@ -6,11 +6,12 @@
     1.4  Use cases: Family album, Business analysis portfolio, File system navigation, Blender presentation
     1.5  
     1.6  Current activity
     1.7 -	Python: Map file system, generating slide content from file and directory meta-information and then from wiki text file content.
     1.8 +	Python: Map files below "./", generating slide content from file and directory meta-information and then from wiki text file content. Put the result in a HTML 5 slideshow template.
     1.9  
    1.10  Next
    1.11     Python: Read wiki text files and parse their content into one or more slides subordinate to the meta-information slide.
    1.12 -   Python: Put the result in a HTML 5 slideshow template.
    1.13 +
    1.14 +   Javascript: Implement the current transition model but in the vertical, not the horizontal.
    1.15     Javascript: Edit Spacebar, right cursor action (go to next-sibling file or directory slide)
    1.16     Javascript: Edit left cursor action (go to previous-sibling file or directory slide)  
    1.17     Javascript: Add up cursor key action (go to parent directory or ../first-child slide).
     2.1 --- a/walkfs-writemarkup.py	Thu Aug 26 10:19:48 2010 +0300
     2.2 +++ b/walkfs-writemarkup.py	Thu Aug 26 14:56:43 2010 +0300
     2.3 @@ -3,14 +3,17 @@
     2.4  
     2.5  from os import walk, path, stat
     2.6  from sha import new
     2.7 -from time import 
     2.8 +#from time import 
     2.9  
    2.10  # Bug: Class attributes end up with white space (if filenames have them): this might be a bug or a feature, I suppose.
    2.11  
    2.12 +# Put template loader from file minimumWorking... mod with %s at slide insertion point.
    2.13 +# Setup a current slideset, current index display (re-add it modified from original).
    2.14 +
    2.15  def makeSlides(root):
    2.16     defaultOrder, slideData = "", ""
    2.17     for current, directories, files in walk(root):
    2.18 -      print current, directories, files
    2.19 +#      print current, directories, files
    2.20        classes = ""
    2.21        if directories != []:
    2.22           for directory in directories:
    2.23 @@ -18,7 +21,7 @@
    2.24                 fullpath = path.join(current, directory)
    2.25                 uid = new(fullpath).hexdigest()
    2.26                 metaInfo = stat(fullpath) # see http://wiki.forum.nokia.com/index.php/How_to_handle_file_metadata
    2.27 -               slideData += '\n<!-- directory --><DIV class="%s" id="%s">%s</DIV>' % (classes, uid, metaInfo)
    2.28 +               slideData += '\n<!-- directory --><DIV class="slide %s" id="%s">%s</DIV>' % ("defaultOrder", uid, metaInfo)
    2.29                 defaultOrder += " " + uid
    2.30              except:
    2.31                 pass
    2.32 @@ -30,14 +33,17 @@
    2.33                 fullpath = path.join(current, filename) 
    2.34                 uid = new(fullpath).hexdigest()
    2.35                 metaInfo = stat(fullpath)
    2.36 -               slideData += '\n<!-- filename --><DIV class="%s" id="%s">%s</DIV>' % (classes, uid, metaInfo)
    2.37 +               slideData += '\n<!-- filename --><DIV class="slide %s" id="%s">%s</DIV>' % ("defaultOrder", uid, metaInfo)
    2.38                 defaultOrder += " " + uid
    2.39              except:
    2.40                 pass
    2.41 -   slideOrder = '\n<!-- default order --><DIV class="%s">The default slide order is this DIV\'s class attribute.</DIV>' % defaultOrder
    2.42 +   slideOrder = '\n<!-- default order --><DIV class="%s">\n%s\n</DIV>' % ("sequencing defaultOrder", defaultOrder)
    2.43     slideData += slideOrder   
    2.44  
    2.45     return slideData
    2.46  
    2.47  s = makeSlides('.')
    2.48 -file("./generated_slides", "w").write(s)
    2.49 +template = file("./template_H5p10n.html", "r").read()
    2.50 +r = template.split("%s")
    2.51 +t = r[0] + s + r[1]
    2.52 +file("./generated_slides", "w").write(t)