changeset 246:f7a67224bf69

text_x_arnica: refactored sort_by*=boolean to sort_by=what
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 07 Sep 2008 23:39:53 +0200
parents 9636895bf71b
children 809f2840ae46
files data/plugin/parser/text_x_arnica.py
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/parser/text_x_arnica.py	Sun Sep 07 23:14:13 2008 +0200
+++ b/data/plugin/parser/text_x_arnica.py	Sun Sep 07 23:39:53 2008 +0200
@@ -39,7 +39,7 @@
 def arnica_settings(target_page=u'', columns=4, file_regex=u'.',
                     image_for_webnail=False,
                     show_text=True, show_date=True, show_tools=False,
-                    sort_by_date=False, sort_by_name=True, sort_by_alias=False,
+                    sort_by=("name", "date", "alias"),
                     reverse_sort=False,
                     only_items=False, template_itemlist=False,
                     album=False, album_title=unicode, album_image=u'',
@@ -54,9 +54,7 @@
     @param show_text: default shows description
     @param show_date: default shows date from exif header, if available
     @param show_tools: default does not show the icon toolbar
-    @param sort_by_name: default, sorts images by name
-    @param sort_by_date: if set, sorts images by the modification time
-    @param sort_by_alias: if set, sorts images by the alias name, this also needs only_items enabled
+    @param sort_by: default, sorts images by name, optional by date or by alias
     @param reverse_sort: if set, the file list is sorted in reverse order
     @param only_items: if set, only images which are described in listitem are shown, e.g.
                        * [[image1.jpg|alias]]
@@ -402,7 +400,7 @@
 
             all_files = [fn for fn in files if wikiutil.isPicture(fn) and
                          AttachFile.exists(self.request, self.pagename, fn)]
-            if self.sort_by_alias:
+            if self.sort_by == "alias":
                 # ToDo use a longer var
                 i = 0
                 for attfile in all_files:
@@ -417,9 +415,9 @@
         if self.file_regex != u'.':
             all_files = [attfile for attfile in all_files if re.match(self.file_regex, attfile)]
 
-        if self.sort_by_name and not self.only_items:
+        if self.sort_by == "name" and not self.only_items:
             all_files.sort()
-        if self.sort_by_date:
+        if self.sort_by == "date":
             for attfile in all_files:
                 infile = os.path.join(path, attfile)
                 ft_file = "%s%x" % (os.path.getmtime(infile), randint(0, 256))