move the uncache-del's from commands.main to Image.cleanup, and call it after rendering each image's thumbs
authorTero Marttila <terom@fixme.fi>
Mon, 15 Jun 2009 00:29:43 +0300
changeset 123 31c4a328ef96
parent 122 292aaba6d6ec
child 124 cac613118e75
move the uncache-del's from commands.main to Image.cleanup, and call it after rendering each image's thumbs
degal/commands/main.py
degal/image.py
degal/thumbnail.py
--- a/degal/commands/main.py	Mon Jun 15 00:23:55 2009 +0300
+++ b/degal/commands/main.py	Mon Jun 15 00:29:43 2009 +0300
@@ -35,6 +35,11 @@
     """
 
     # XXX: handle this thumb-update/html-update stuff better
+
+    # render all HTML
+    for image in images :
+        render_image_html(ctx, image)
+
     
     # render the thumbnails concurrently
     for image in ctx.concurrent.execute(
@@ -48,14 +53,9 @@
     ) :
         # log image path
         ctx.log_info("%s", image)
-        
-    # then render all HTML
-    for image in images :
-        render_image_html(ctx, image)
 
         # release large objects that are not needed anymore
-        # XXX: verify that this works
-        del image.img
+        image.cleanup()
 
 def render_folder_html (ctx, folder) :
     """
--- a/degal/image.py	Mon Jun 15 00:23:55 2009 +0300
+++ b/degal/image.py	Mon Jun 15 00:29:43 2009 +0300
@@ -122,4 +122,13 @@
         
         self.preview.update()
         self.thumb.update()
+    
+    def cleanup (self) :
+        """
+            Drop some cached heavy values
+        """
 
+        del self.img
+        del self.exif
+        del self.metadata
+
--- a/degal/thumbnail.py	Mon Jun 15 00:23:55 2009 +0300
+++ b/degal/thumbnail.py	Mon Jun 15 00:29:43 2009 +0300
@@ -63,7 +63,8 @@
             height = thumb_height
         
         return width, height 
-    
+   
+    ## operations
     def resize (self, img) :
         """
             Resize the give image as needed.
@@ -80,7 +81,7 @@
         mirroring, rotation = orient_info
 
         if mirroring :
-            # XXX
+            # XXX: does anyone actually use this?
             pass
 
         if rotation :