Changeset 613:c57d80a649ea in documentViewer for documentViewer.py


Ignore:
Timestamp:
Oct 17, 2013, 2:25:39 PM (11 years ago)
Author:
casties
Branch:
default
Message:

CLOSED - # 281: List of thumbnails verschluckt Seite, wenn odd-scan-position gesetzt ist
https://it-dev.mpiwg-berlin.mpg.de/tracs/mpdl-project-software/ticket/281

File:
1 edited

Legend:

Unmodified
Added
Removed
  • documentViewer.py

    r612 r613  
    55from AccessControl import ClassSecurityInfo
    66from AccessControl import getSecurityManager
    7 from Globals import package_home
    87
    98import xml.etree.ElementTree as ET
    109
    1110import os
    12 import sys
    1311import urllib
    1412import logging
    1513import math
    1614import urlparse
    17 import re
    18 import string
    1915import json
    2016
     
    2319from SrvTxtUtils import getInt, utf8ify, getText, getHttpData, refreshingImageFileIndexHtml
    2420   
    25 def serializeNode(node, encoding="utf-8"):
    26     """returns a string containing node as XML"""
    27     s = ET.tostring(node)
    28    
    29     # 4Suite:
    30     #    stream = cStringIO.StringIO()
    31     #    Ft.Xml.Domlette.Print(node, stream=stream, encoding=encoding)
    32     #    s = stream.getvalue()
    33     #    stream.close()
    34     return s
    3521
    3622def getMDText(node):
     
    994980
    995981    def getPageBatch(self, start=1, rows=10, cols=2, pageFlowLtr=True, pageZero=False, minIdx=1, maxIdx=0):
    996         """returns dict with array of page information for one screenfull of thumbnails"""
     982        """Return dict with array of page information for one screenfull of thumbnails.
     983
     984        :param start: index of current page
     985        :param rows: number of rows in one batch
     986        :param cols: number of columns in one batch
     987        :param pageFlowLtr: do indexes increase from left to right
     988        :param pageZero: is there a zeroth non-visible page
     989        :param minIdx: minimum index to use
     990        :param maxIdx: maximum index to use
     991        :returns: dict with
     992            first: first page index
     993            last: last page index
     994            batches: list of all possible batches(dict: 'start': index, 'end': index)
     995            pages: list for current batch of rows(list of cols(list of pages(dict: 'idx': index)))
     996            nextStart: first index of next batch
     997            prevStart: first index of previous batch
     998        """
    997999        logging.debug("getPageBatch start=%s minIdx=%s maxIdx=%s"%(start,minIdx,maxIdx))
    9981000        batch = {}
     
    10021004
    10031005        np = maxIdx - minIdx + 1
     1006        if pageZero:
     1007            # correct number of pages for batching
     1008            np += 1
     1009           
    10041010        nb = int(math.ceil(np / float(grpsize)))
     1011       
    10051012        # list of all batch start and end points
    10061013        batches = []
     
    10171024        batch['batches'] = batches
    10181025
     1026        # list of pages for current screen
    10191027        pages = []
    10201028        if pageZero and start == minIdx:
     
    10461054           
    10471055        if start + grpsize <= maxIdx:
    1048             batch['nextStart'] = start + grpsize
     1056            if pageZero and start == minIdx:
     1057                # correct nextStart for pageZero
     1058                batch['nextStart'] = grpsize
     1059            else:
     1060                batch['nextStart'] = start + grpsize
    10491061        else:
    10501062            batch['nextStart'] = None
     
    10531065        batch['first'] = minIdx
    10541066        batch['last'] = maxIdx
     1067        logging.debug("batch: %s"%repr(batch))
    10551068        return batch
     1069       
    10561070       
    10571071    def getBatch(self, start=1, size=10, end=0, data=None, fullData=True):
Note: See TracChangeset for help on using the changeset viewer.