Mercurial > public > src > moin > extensions
diff data/plugin/parser/text_x_arnica.py @ 102:b446b9826cf8
text_x_arnica: whitepaces removed, some linebreaks
author | Reimar Bauer <rb.proj AT googlemail DOT com> |
---|---|
date | Thu, 26 Jun 2008 12:05:22 +0200 |
parents | ee184bd0f428 |
children | 6700a5be9537 |
line wrap: on
line diff
--- a/data/plugin/parser/text_x_arnica.py Wed Jun 25 10:20:13 2008 +0200 +++ b/data/plugin/parser/text_x_arnica.py Thu Jun 26 12:05:22 2008 +0200 @@ -175,7 +175,6 @@ @param idx: index postion of corresponding data """ this_image = self.full[idx] - text = '''\ <table align="center" width="%(thumbnail_width)s"%(tablestyle)s> <tr> @@ -250,8 +249,8 @@ """ defines arrangement of thumbnail, text, date and tools """ title = "" if self.album: - title = "%(n)d images (%(album_title)s)" % {"n": len(self.full), "album_title": self.album_title or self.pagename} - + title = "%(n)d images (%(album_title)s)" % {"n": len(self.full), + "album_title": self.album_title or self.pagename} text = '''\ <table width="%(thumbnail_width)s" align="center" valign="center"%(style)s> <tr align="center" valign="center"> @@ -305,7 +304,6 @@ for txt in quotes['image']: ddict[txt] = quotes['alias'][i] i += 1 - for attfile in files: # only files not thumb or webnails self.description.append(ddict.get(attfile, attfile)) @@ -352,7 +350,6 @@ alias = wikiutil.escape(alias, quote=1) text.append(alias) image.append(img.strip()) - return { 'alias': text, 'image': image, @@ -360,21 +357,18 @@ def select_files(self, formatter): """ select files """ - # we need to take the page_name from the formatter.page otherwise # include does not work self.pagename = formatter.page.page_name if self.target_page: self.pagename = self.target_page path = AttachFile.getAttachDir(self.request, self.pagename, create=1) - image_dict = {} quotes = self.get_quotes() - if self.only_items: files = quotes['image'] - all_files = [fn for fn in files if wikiutil.isPicture(fn) and AttachFile.exists(self.request, self.pagename, fn)] - + all_files = [fn for fn in files if wikiutil.isPicture(fn) and + AttachFile.exists(self.request, self.pagename, fn)] if self.sort_by_alias: alias_text = quotes['alias'] i = 0 @@ -386,13 +380,10 @@ all_files = [image_dict[txt] for txt in keys] else: all_files = _get_files(self.request, self.pagename) - 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 self.only_items is False: all_files.sort() - if self.sort_by_date: for attfile in all_files: infile = os.path.join(path, attfile) @@ -406,7 +397,6 @@ if self.reverse_sort: all_files.reverse() - if all_files: self.define_thumb_webnails(path, all_files, quotes) @@ -501,29 +491,24 @@ 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]) + self.create_thumbnail_and_webnail(image, self.web[i], + self.thumb[i], self.imgtype[i]) if not self.album: self.webimg = self.web if self.image_for_webnail: self.webimg = self.full - text = self.html_preview(i) - if col_count <= COLUMNS: result.append(''.join(text)) - if col_count == COLUMNS: col_count = 0 data.addRow(tuple(result)) # resets the result list after the row is added result = [] - col_count += 1 - if result and not self.album: for i in range(COLUMNS - col_count + 1): result.append('') - if self.album: album_image = self.album_image or self.full[0] try: @@ -540,9 +525,9 @@ # adds the last row if it is not filled up if result: data.addRow(tuple(result)) - browser = DataBrowserWidget(self.request, show_header=False) browser.setData(data) + return browser.format() def format(self, formatter):