changeset 173:f5cdee2715a3

text_x_arnica: various variables renamed
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Mon, 14 Jul 2008 20:24:17 +0200
parents a2c26bbd9ed8
children c38b672ffb3c
files data/plugin/parser/text_x_arnica.py
diffstat 1 files changed, 43 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/parser/text_x_arnica.py	Mon Jul 14 19:52:26 2008 +0200
+++ b/data/plugin/parser/text_x_arnica.py	Mon Jul 14 20:24:17 2008 +0200
@@ -215,13 +215,13 @@
 
         self.inner_table_style = ' style="border-style:none; margin:10px;"'
         self.td_style = ' align="center" style="padding:0; margin:2px 2px; border-style:none"'
-        self.web = [] # array for webnails
-        self.full = [] # array for  images
-        self.thumb = [] # array for thumbnails
+        self.web_key = [] # array for webnail keys (medium_resolution_image)
+        self.high_resolution_image = [] # array for images
+        self.thumb_key = [] # array for thumbnail keys
         self.exif_date = [] # array of exif date description
-        self.imgtype = [] # array of imagetype of full image
+        self.imgtype = [] # array of imagetype of high_resolution_image image
         self.description = [] # array of description
-        self.webimg = [] # array of images for forms
+        self.webnail_image = [] # array of images for forms
 
     def html_tools_restricted(self, this_target):
         """ shows restricted tools
@@ -264,7 +264,7 @@
         """ html code of thumbnails view with contol
         @param idx: index postion of corresponding data
         """
-        this_image = self.full[idx]
+        this_image = self.high_resolution_image[idx]
         text = '''
         <form action="%(url)s" method="POST" enctype="multipart/form-data">
             <div class="get-image">
@@ -297,12 +297,12 @@
             "description": packLine([self.description[idx]] + self.description),
             "image_for_webnail": self.image_for_webnail,
             "exif_date": packLine([self.exif_date[idx]] + self.exif_date),
-            "target": self.webimg[idx],
-            "original_images": packLine([self.full[idx]] + self.full),
-            "images": packLine([self.webimg[idx]] + self.webimg),
-            "original_images": packLine([self.full[idx]] + self.full),
-            "this_target": self.full[idx],
-            "thumbnail": "%s%s" % (AttachFile.getAttachUrl(self.pagename, '', self.request), self.thumb[idx]),
+            "target": self.webnail_image[idx],
+            "original_images": packLine([self.high_resolution_image[idx]] + self.high_resolution_image),
+            "images": packLine([self.webnail_image[idx]] + self.webnail_image),
+            "original_images": packLine([self.high_resolution_image[idx]] + self.high_resolution_image),
+            "this_target": self.high_resolution_image[idx],
+            "thumbnail": "%s%s" % (AttachFile.getAttachUrl(self.pagename, '', self.request), self.thumb_key[idx]),
             "html_tools_restricted": self.html_tools_restricted(this_image)
             }
         return text
@@ -336,7 +336,7 @@
         """ defines arrangement of thumbnail, text, date and tools """
         title = ""
         if self.album:
-            title = '<div class="title">%(n)d images (%(album_title)s)</div>' % {"n": len(self.full),
+            title = '<div class="title">%(n)d images (%(album_title)s)</div>' % {"n": len(self.high_resolution_image),
                                                         "album_title": self.album_title or self.pagename}
         text = '''
 <div class="arrange-thumbnails">
@@ -366,10 +366,10 @@
      "description": packLine([self.description[idx]] + self.description),
      "exif_date": packLine([self.exif_date[idx]] + self.exif_date),
      "image_for_webnail": self.image_for_webnail,
-     "target": self.webimg[idx],
-     "original_images": packLine([self.full[idx]] + self.full),
-     "images": packLine([self.webimg[idx]] + self.webimg),
-     "thumbnail": cache.url(self.request, self.thumb[idx]),
+     "target": self.webnail_image[idx],
+     "original_images": packLine([self.high_resolution_image[idx]] + self.high_resolution_image),
+     "images": packLine([self.webnail_image[idx]] + self.webnail_image),
+     "thumbnail": cache.url(self.request, self.thumb_key[idx]),
      "thumbnail_width": self.thumbnail_width,
      "html_tools": self.html_show_tools(idx),
      "date_html": self.html_show_date(idx),
@@ -390,9 +390,9 @@
                 ddict[txt] = quotes['alias'][i]
                 i += 1
         for attfile in files:
-            # only files not thumb or webnails
+            # only files not thumb_key or webnails
             self.description.append(ddict.get(attfile, attfile))
-            self.full.append(attfile)
+            self.high_resolution_image.append(attfile)
             fname, ext = os.path.splitext(attfile)
             key = cache.key(self.request, itemname=self.pagename, attachname=attfile) 
             webnail = 'W' + key
@@ -404,8 +404,8 @@
 
             att_file = os.path.join(path, attfile)
             if os.path.exists(att_file):
-                self.web.append(webnail)
-                self.thumb.append(thumbfile)
+                self.web_key.append(webnail)
+                self.thumb_key.append(thumbfile)
                 date = get_exif_info(att_file)
                 self.exif_date.append(self.formatter.text(date))
 
@@ -484,7 +484,7 @@
 
         return all_files
 
-    def create_thumbnail_and_webnail(self, image, webnail, thumbnail, image_type):
+    def create_thumbnail_and_webnail_image(self, image, webnail, thumbnail, image_type):
         """creates thumbnails and webnails cache files for given image type
         @param image: filename of image
         @param webnail: name of webnail file
@@ -507,11 +507,11 @@
 
         cache_web = caching.CacheEntry(self.request, cache.cache_arena, webnail+'.data',
                                         cache.cache_scope, do_locking=False)
-        webf = cache_web._filename()
+        webnail_image_filename = cache_web._filename()
         
         cache_thumb = caching.CacheEntry(self.request, cache.cache_arena, thumbnail+'.data',
                                         cache.cache_scope, do_locking=False)
-        thumbf = cache_thumb._filename()
+        thumbnail_image_filename = cache_thumb._filename()
         
         if self.renew:
             cache_web.remove()
@@ -530,18 +530,18 @@
                 if not self.image_for_webnail:
                     im_obj.thumbnail((int(self.webnail_width.strip('px')), int(self.webnail_width.strip('px'))), Image.ANTIALIAS)
                     # ToDo find a way to add the im_obj data immediately to the cache arena
-                    im_obj.save(webf, image_type)
-                    st = os.stat(webf)
+                    im_obj.save(webnail_image_filename, image_type)
+                    st = os.stat(webnail_image_filename)
                     cache.put(self.request, webnail, 'dummy', filename=image, content_length=st.st_size)
-                    im_obj.save(webf, image_type)
+                    im_obj.save(webnail_image_filename, image_type)
 
             if not cache_thumb.exists():
                 im_obj.thumbnail((int(self.thumbnail_width.strip('px')), int(self.thumbnail_width.strip('px'))), Image.ANTIALIAS)
                 # ToDo find a way to add the im_obj data immediately to the cache arena
-                im_obj.save(thumbf, image_type)
-                st = os.stat(thumbf)
+                im_obj.save(thumbnail_image_filename, image_type)
+                st = os.stat(thumbnail_image_filename)
                 cache.put(self.request, thumbnail, 'dummy', filename=image, content_length=st.st_size)
-                im_obj.save(thumbf, image_type)
+                im_obj.save(thumbnail_image_filename, image_type)
 
     def render(self, formatter):
         """ renders thumbnails """
@@ -571,7 +571,7 @@
             self.request.write(self.formatter.text(text))
             self.request.write(self.formatter.div(1))
             self.request.write(self.formatter.preformatted(1))
-            for image in self.full:
+            for image in self.high_resolution_image:
                 text = ' * [[%(image)s|alias]]\n' % {
                            'image': image,
                         }
@@ -579,7 +579,7 @@
             self.request.write(self.formatter.preformatted(0))
             self.request.write(self.formatter.div(0))
             self.request.write(self.formatter.div(0))
-        COLUMNS = min([self.columns, len(self.full)])
+        COLUMNS = min([self.columns, len(self.high_resolution_image)])
         if self.album:
             COLUMNS = 1
         data = TupleDataset()
@@ -588,14 +588,14 @@
             data.columns.extend([Column('', label=(''))])
         col_count = 1
         result = []
-        for image in self.full:
-            i = self.full.index(image)
-            self.create_thumbnail_and_webnail(image, self.web[i],
-                                              self.thumb[i], self.imgtype[i])
+        for image in self.high_resolution_image:
+            i = self.high_resolution_image.index(image)
+            self.create_thumbnail_and_webnail_image(image, self.web_key[i],
+                                                    self.thumb_key[i], self.imgtype[i])
             if not self.album:
-                self.webimg = self.web
+                self.webnail_image = self.web_key
                 if self.image_for_webnail:
-                    self.webimg = self.full
+                    self.webnail_image = self.high_resolution_image
                 text = self.html_arrange_thumbnails(i)
                 if col_count <= COLUMNS:
                     result.append(''.join(text))
@@ -609,13 +609,13 @@
             for i in range(COLUMNS - col_count + 1):
                 result.append('')
         if self.album:
-            album_image = self.album_image or self.full[0]
+            album_image = self.album_image or self.high_resolution_image[0]
             try:
-                i = self.full.index(album_image)
-                self.create_thumbnail_and_webnail(image, self.web[i], self.thumb[i], self.imgtype[i])
-                self.webimg = self.web
+                i = self.high_resolution_image.index(album_image)
+                self.create_thumbnail_and_webnail_image(image, self.web_key[i], self.thumb_key[i], self.imgtype[i])
+                self.webnail_image = self.web_key
                 if self.image_for_webnail:
-                    self.webimg = self.full
+                    self.webnail_image = self.high_resolution_image
                 text = self.html_arrange_thumbnails(i)
             except ValueError:
                 text = self.formatter.text(_("""You can't use as album image: \