Changeset 482:7ca8ac7db06e in documentViewer for documentViewer.py
- Timestamp:
- Aug 16, 2011, 4:27:08 PM (13 years ago)
- Branch:
- elementtree
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
documentViewer.py
r480 r482 556 556 docinfo['imagePath'] = url.replace('/mpiwg/online/', '', 1) 557 557 558 559 560 558 # number of images from digilib 561 559 if docinfo.get('imagePath', None): … … 787 785 788 786 789 def getPageBatch(self, start= None, rows=None, cols=None, pageFlowLtr=True, pageZero=False, minIdx=1, maxIdx=0):787 def getPageBatch(self, start=1, rows=10, cols=2, pageFlowLtr=True, pageZero=False, minIdx=1, maxIdx=0): 790 788 """returns dict with array of page informations for one screenfull of thumbnails""" 789 batch = {} 791 790 grpsize = rows * cols 792 791 if maxIdx == 0: 793 792 maxIdx = start + grpsize 793 794 nb = int(math.ceil(maxIdx / float(grpsize))) 795 # list of all batch start and end points 796 batches = [] 797 if pageZero: 798 ofs = 0 799 else: 800 ofs = 1 801 802 for i in range(nb): 803 s = i * grpsize + ofs 804 e = min((i + 1) * grpsize + ofs - 1, maxIdx) 805 batches.append({'start':s, 'end':e}) 806 807 batch['batches'] = batches 794 808 795 809 pages = [] … … 816 830 pages.append(row) 817 831 818 batch = {}819 832 if start > 1: 820 833 batch['prevStart'] = max(start - grpsize, 1) … … 828 841 829 842 batch['pages'] = pages 830 #logging.debug("getPageList returns=%s"%(batch)) 843 return batch 844 845 def getBatch(self, start=1, size=10, end=0, data=None, fullData=True): 846 """returns dict with information for one screenfull of data.""" 847 batch = {} 848 if end == 0: 849 end = start + size 850 851 nb = int(math.ceil(end / float(size))) 852 # list of all batch start and end points 853 batches = [] 854 for i in range(nb): 855 s = i * size + 1 856 e = min((i + 1) * size, end) 857 batches.append({'start':s, 'end':e}) 858 859 batch['batches'] = batches 860 # list of elements in this batch 861 this = [] 862 j = 0 863 for i in range(start, min(start+size, end)): 864 if data: 865 if fullData: 866 d = data[i] 867 else: 868 d = data[j] 869 j += 1 870 871 else: 872 d = i+1 873 874 this.append(d) 875 876 batch['this'] = this 877 if start > 1: 878 batch['prevStart'] = max(start - size, 1) 879 else: 880 batch['prevStart'] = None 881 882 if start + size < end: 883 batch['nextStart'] = start + size 884 else: 885 batch['nextStart'] = None 886 831 887 return batch 832 888
Note: See TracChangeset
for help on using the changeset viewer.