""" returns a list of tuples of images arranged to support easy tabling """ # Copyright © 2004 Saugus.net, Inc. # All Rights Reserved. # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. from ZTUtils import LazyFilter imagePool=[] for image in LazyFilter(context.objectValues('Portal Image'),skip=''): if image.isEntryAllowedByFilter(subjectStr): imagePool.append((int(image.width),image)) if len(imagePool)>0: tables=[[]] tableWidths=[0] finalTable=0 for imageTuple in imagePool: for currentTable in range(finalTable+1): if tableWidths[currentTable]+int(imageTuple[0])<=windowWidth: tables[currentTable].append(imageTuple[1]) tableWidths[currentTable]=tableWidths[currentTable]+int(imageTuple[0]) break else: tables.append([imageTuple[1]]) tableWidths.append(imageTuple[0]) finalTable+=1 return tables else: return None