--- ImageArchive/ImageArchive.py 2004/01/06 16:16:42 1.11 +++ ImageArchive/ImageArchive.py 2004/01/06 16:47:49 1.12 @@ -466,8 +466,12 @@ class ImageCollection(Folder, Persistent nr=0 else: nr=0 - - if ids.index(filename)==0: + try: + num=ids.index(filename) + except: + num=0 + + if num==0: return "" else: if selected: @@ -500,15 +504,18 @@ class ImageCollection(Folder, Persistent """set coltimes row""" RESPONSE=self.REQUEST.RESPONSE if not rows: - rows=100000 + rows=None if rows=="": - rows=100000 - RESPONSE.setCookie("ImageViewerRows",rows) + rows=None + + if rows: + RESPONSE.setCookie("ImageViewerRows",rows) RESPONSE.setCookie("ImageViewerCols",cols) RESPONSE.redirect(self.REQUEST['URL1']+"/setDone") def getColTimesRow(self): + """coltimesrow""" REQUEST=self.REQUEST """matrix""" @@ -517,16 +524,20 @@ class ImageCollection(Folder, Persistent try: rows=int(REQUEST.cookies["ImageViewerRows"]) except: - rows=20 + rows=None else: - rows=20 + rows=None if REQUEST.cookies.has_key("ImageViewerCols"): - print "COLS",REQUEST.cookies["ImageViewerCols"] + #print "COLS",REQUEST.cookies["ImageViewerCols"] cols=int(REQUEST.cookies["ImageViewerCols"]) else: cols=4 - print cols,rows + + idsnumber=len(self.show_thumbs()) + if rows: + if cols*rows >idsnumber: + rows=int(idsnumber/cols)+1 return (cols,rows) @@ -548,9 +559,12 @@ class ImageCollection(Folder, Persistent print "NOR:",numberOfRows if numberOfRows: - startPic=idsAll.index(startId) - endPic=startPic+numberOfColumns*numberOfRows - ids=idsAll[startPic:endPic] + try: + startPic=idsAll.index(startId) + endPic=startPic+numberOfColumns*numberOfRows + ids=idsAll[startPic:endPic] + except: + ids=idsAll else: ids=idsAll