dabodoc Commit
Revision 75
Date: 2011-04-01 06:22:08 -0700 (Fri, 01 Apr 2011)
Author: Werner
Trac: http://trac.dabodev.com/changeset/75

Changed:
_U  trunk/api/sphinx/
U   trunk/api/sphinx/genGallery.py
U   trunk/api/sphinx/makeRST.py
U   trunk/api/sphinx/resizeWidgetImages.py
U   trunk/api/sphinx/source/_static/AGW.css

Log:
- changes to handle gallery pages for the three platforms

Diff:

Property changes on: trunk/api/sphinx
___________________________________________________________________
Name: svn:ignore
   - dabo.log
db_activity.log
galleryToClassIndex.py
sphinxstderr.txt

   + config.py
dabo.log
db_activity.log
galleryToClassIndex.py
sphinxstderr.txt


Modified: trunk/api/sphinx/genGallery.py
===================================================================
--- trunk/api/sphinx/genGallery.py      2011-04-01 13:20:34 UTC (rev 74)
+++ trunk/api/sphinx/genGallery.py      2011-04-01 13:22:08 UTC (rev 75)
@@ -18,38 +18,39 @@
 <br/>
 
 %s
+
 {%% endblock %%}
 """
 
 
-def gen_gallery(app, doctree):
-       
-       if app.builder.name not in ['html', 'singlehtml']:
-               return
-
-       print 'gen_gallery: %s, %s' % (app, app.builder.name)
-
-       outdir = app.builder.outdir
-
+def gen_page(app, sdir, pname):
+       """
+       Generate a html page with the thumb images for widgets
+       """
        link = '<div class="gallery_class">'
 
        link_template = """\
        <table><caption align="bottom"><a href="%s"<b>%s</b></a</caption>
-       <tr><td><a href="%s"><img src="%s" border="5" alt="%s" width="100" 
height="100"/></a></td></tr>
-       </table>"""
+       <tr>
+       <td><a href="%s"><img src="%s" border="5" alt="%s"/></a>
+       </td>
+       </tr>
+       </table>
+       """
        
        data = []
        thumbnails = {}
        rows = ["<br/>", link]
 
        # need to join srcdir
-       for item in sorted(glob.glob(os.path.join(app.builder.srcdir, 
"_static\\winWidgets\\*_thumb.png"))):
+       for item in sorted(glob.glob(os.path.join(app.builder.srcdir, sdir + 
"\\*_thumb.png"))):
                path, filename = os.path.split(item)
                basename, ext = os.path.splitext(item)
                
                # get rid of _thumb and path
                widgetName = basename.replace("_thumb", "")
-               widgetName = widgetName.replace(app.builder.srcdir + 
"\\_static\\winWidgets\\", "")
+               toRemove = app.builder.srcdir + "\\" + sdir + "\\"
+               widgetName = widgetName.replace(toRemove, "")
                
                # get rid of srcdir
                thumbFile = item.replace(app.builder.srcdir + "\\", "")
@@ -68,8 +69,9 @@
                        # lets find the documentation link for this image
                        linkName = galleryToClassIndex.pictureIndex[linkKey]
                else:
-                       linkName = "gallery.html"
+                       linkName = pname
 ##             print "base: %s" % basename
+##             print "toRemove: %s" % toRemove
 ##             print "widget: %s" % widgetName
 ##             print "linkKey: %s" % linkKey
 ##             print "thumb: %s" % thumbFile
@@ -83,26 +85,42 @@
        rows.append('<br clear="all"> ')
        
        content = template % '\n'.join(rows)
-       gallery_path = os.path.join(app.builder.srcdir, '_templates', 
'gallery.html')
+       gallery_path = os.path.join(app.builder.srcdir, '_templates', pname)
 
-### thought this would reduce build time
-##     # check if file has already up to date content
-##     fhCheck = file(gallery_path, 'r')
-##     oldContent = fhCheck.read()
-##     if oldContent.strip() == content.strip():
-##             print "gallery file is already up to date"
-##     else:
-##             fh = file(gallery_path, 'w')
-##             fh.write(content)
-##             fh.flush()
-##             fh.close()
-##             print "gallery file updated"
 
+       # check if file has already up to date content
+       fhCheck = file(gallery_path, 'r')
+       oldContent = fhCheck.read()
+       if oldContent.strip() == content.strip():
+               print "gallery file is already up to date"
+       else:
+               fh = file(gallery_path, 'w')
+               fh.write(content)
+               fh.flush()
+               fh.close()
+               print "gallery file updated"
+
        fh = file(gallery_path, 'w')
        fh.write(content)
        fh.flush()
        fh.close()
        
+def gen_gallery(app, doctree):
+       
+       if app.builder.name not in ["html", "singlehtml"]:
+               return
+
+       print "gen_gallery: %s, %s" % (app, app.builder.name)
+
+##     outdir = app.builder.outdir
+       print "gen_gallery for Mac"
+       gen_page(app, "_static\\macWidgets", "gallery_mac.html")
+       print "gen_gallery for Win"
+       gen_page(app, "_static\\winWidgets", "gallery_win.html")
+       print "gen_gallery for Linux"
+       gen_page(app, "_static\\nixWidgets", "gallery_nix.html")
+
+
 def setup(app):
 
        app.connect('env-updated', gen_gallery)

Modified: trunk/api/sphinx/makeRST.py
===================================================================
--- trunk/api/sphinx/makeRST.py 2011-04-01 13:20:34 UTC (rev 74)
+++ trunk/api/sphinx/makeRST.py 2011-04-01 13:22:08 UTC (rev 75)
@@ -461,7 +461,9 @@
                                <li><img src="_static/dabo_small.png" alt="" 
style="vertical-align: middle; margin-top: 7px"/></li>
                                <li><a href="index.html" style="color: rgb(238, 
152, 22); hover: rgb(53, 95, 124);">Introduction</a> |&nbsp;</li>
                                <li><a href="search.html" style="color: 
rgb(238, 152, 22); hover: rgb(53, 95, 124);">Search</a> |&nbsp;</li>
-                               <li><a href="gallery.html" style="color: 
rgb(238, 152, 22); hover: rgb(53, 95, 124);">Gallery</a> |&nbsp;</li>
+                               <li><a href="gallery_mac.html" style="color: 
rgb(238, 152, 22); hover: rgb(53, 95, 124);">Gallery - Mac</a> |&nbsp;</li>
+                               <li><a href="gallery_win.html" style="color: 
rgb(238, 152, 22); hover: rgb(53, 95, 124);">Gallery - Win</a> |&nbsp;</li>
+                               <li><a href="gallery_nix.html" style="color: 
rgb(238, 152, 22); hover: rgb(53, 95, 124);">Gallery - Nix</a> |&nbsp;</li>
                                <li><a href="general_index.html" style="color: 
rgb(238, 152, 22); hover: rgb(53, 95, 124);">Contents</a>&raquo;</li>
 {% endblock %}
 
@@ -484,7 +486,9 @@
                                <li><img src="_static/dabo_small.png" alt="" 
style="vertical-align: middle; margin-top: 7px"/></li>
                                <li><a href="index.html" style="color: rgb(238, 
152, 22); hover: rgb(53, 95, 124);">Introduction</a> |&nbsp;</li>
                                <li><a href="search.html" style="color: 
rgb(238, 152, 22); hover: rgb(53, 95, 124);">Search</a> |&nbsp;</li>
-                               <li><a href="gallery.html" style="color: 
rgb(238, 152, 22); hover: rgb(53, 95, 124);">Gallery</a> |&nbsp;</li>
+                               <li><a href="gallery_mac.html" style="color: 
rgb(238, 152, 22); hover: rgb(53, 95, 124);">Gallery - Mac</a> |&nbsp;</li>
+                               <li><a href="gallery_win.html" style="color: 
rgb(238, 152, 22); hover: rgb(53, 95, 124);">Gallery - Win</a> |&nbsp;</li>
+                               <li><a href="gallery_nix.html" style="color: 
rgb(238, 152, 22); hover: rgb(53, 95, 124);">Gallery - Nix</a> |&nbsp;</li>
                                <li><a href="general_index.html" style="color: 
rgb(238, 152, 22); hover: rgb(53, 95, 124);">Contents</a>&raquo;</li>
 {% endblock %}
 

Modified: trunk/api/sphinx/resizeWidgetImages.py
===================================================================
--- trunk/api/sphinx/resizeWidgetImages.py      2011-04-01 13:20:34 UTC (rev 74)
+++ trunk/api/sphinx/resizeWidgetImages.py      2011-04-01 13:22:08 UTC (rev 75)
@@ -22,7 +22,7 @@
             im.thumbnail((400, 400), Image.ANTIALIAS)
             im.save(img, orgFormat)
             print "resized image: %s\n" % img
-            im.thumbnail((200, 200), Image.ANTIALIAS)
+            im.thumbnail((128, 128), Image.ANTIALIAS)
             tName = file + "_thumb" + ext
             im.save(tName)
             print "resized image: %s\n" % tName

Modified: trunk/api/sphinx/source/_static/AGW.css
===================================================================
--- trunk/api/sphinx/source/_static/AGW.css     2011-04-01 13:20:34 UTC (rev 74)
+++ trunk/api/sphinx/source/_static/AGW.css     2011-04-01 13:22:08 UTC (rev 75)
@@ -397,7 +397,11 @@
  .gallery_class table { float: left;
                   margin: 0 5px 20px 0; }
  .gallery_class table { border-collapse: collapse; }
- .gallery_class table td { padding: 0; }
+ .gallery_class table td {
+         padding: 0;
+         width: 150px;
+         height: 128px;}
+}
  .gallery_class table caption { font-size: 80%; }
  .gallery .caption { height: 4em; vertical-align: top; }
  .gallery table { width: 225px; }



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to