--- ImageArchive/ImageArchive.py 2004/01/06 15:44:13 1.8 +++ 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: @@ -499,13 +503,19 @@ class ImageCollection(Folder, Persistent def setColTimesRow(self,cols,rows): """set coltimes row""" RESPONSE=self.REQUEST.RESPONSE - - RESPONSE.setCookie("ImageViewerRows",rows) + if not rows: + rows=None + if 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""" @@ -519,11 +529,15 @@ class ImageCollection(Folder, Persistent 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) @@ -545,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