comparison documentViewer.py @ 61:f3d2f240692c

fixed bug in calculation of group numbers
author casties
date Thu, 14 Jun 2007 18:07:21 +0200
parents 996b61d71351
children 8a16ea8db858
comparison
equal deleted inserted replaced
60:346e94770901 61:f3d2f240692c
16 import os.path 16 import os.path
17 import sys 17 import sys
18 import cgi 18 import cgi
19 import urllib 19 import urllib
20 import logging 20 import logging
21 import math
21 22
22 import urlparse 23 import urlparse
23 24
24 def logger(txt,method,txt2): 25 def logger(txt,method,txt2):
25 """logging""" 26 """logging"""
438 """gets the bibliographical information from the preseantion entry in texttools 439 """gets the bibliographical information from the preseantion entry in texttools
439 """ 440 """
440 dom=self.getPresentationInfoXML(url) 441 dom=self.getPresentationInfoXML(url)
441 docinfo['author']=getTextFromNode(dom.xpath("//author")[0]) 442 docinfo['author']=getTextFromNode(dom.xpath("//author")[0])
442 docinfo['title']=getTextFromNode(dom.xpath("//title")[0]) 443 docinfo['title']=getTextFromNode(dom.xpath("//title")[0])
443 docinfo['year']=getTextFromNode(dom.xpath("//date")[0]) 444 #docinfo['year']=getTextFromNode(dom.xpath("//date")[0])
444 return docinfo 445 return docinfo
445 446
446 def getDocinfoFromImagePath(self,path,docinfo=None): 447 def getDocinfoFromImagePath(self,path,docinfo=None):
447 """path ist the path to the images it assumes that the index.meta file is one level higher.""" 448 """path ist the path to the images it assumes that the index.meta file is one level higher."""
448 logger("documentViewer (getdocinfofromimagepath)", logging.INFO,"path: %s"%(path)) 449 logger("documentViewer (getdocinfofromimagepath)", logging.INFO,"path: %s"%(path))
493 pageinfo['rows'] = rows 494 pageinfo['rows'] = rows
494 cols = int(cols or self.thumbcols) 495 cols = int(cols or self.thumbcols)
495 pageinfo['cols'] = cols 496 pageinfo['cols'] = cols
496 grpsize = cols * rows 497 grpsize = cols * rows
497 pageinfo['groupsize'] = grpsize 498 pageinfo['groupsize'] = grpsize
498 start = getInt(start, default=(int(current / grpsize) * grpsize +1)) 499 start = getInt(start, default=(math.ceil(float(current)/float(grpsize))*grpsize-(grpsize-1)))
500 # int(current / grpsize) * grpsize +1))
499 pageinfo['start'] = start 501 pageinfo['start'] = start
500 pageinfo['end'] = start + grpsize 502 pageinfo['end'] = start + grpsize
501 if docinfo is not None: 503 if docinfo is not None:
502 np = int(docinfo['numPages']) 504 np = int(docinfo['numPages'])
503 pageinfo['end'] = min(pageinfo['end'], np) 505 pageinfo['end'] = min(pageinfo['end'], np)