Changeset 591:5850689ecfac in documentViewer


Ignore:
Timestamp:
Nov 16, 2012, 12:41:02 PM (12 years ago)
Author:
casties
Branch:
default
Message:

ocrsearch layer for images.

Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • documentViewer.py

    r590 r591  
    6363                pn = default
    6464               
     65        return pn
     66   
     67    return default
     68
     69def getPfForPn(docinfo, pn, default=None):
     70    """returns image file name for image number or default"""
     71    if 'imgFileIndexes' in docinfo:
     72        pn = docinfo['imgFileIndexes'].get(pn, default)
    6573        return pn
    6674   
     
    105113    layer_text_pundit = PageTemplateFile('zpt/layer_text_pundit', globals())
    106114    layer_image_annotator = PageTemplateFile('zpt/layer_image_annotator', globals())
     115    layer_image_ocrsearch = PageTemplateFile('zpt/layer_image_ocrsearch', globals())
    107116    layer_index_extended = PageTemplateFile('zpt/layer_index_extended', globals())
    108117    # toc templates
     
    778787        # save list of image names and numbers
    779788        imgNames = {}
     789        imgIndexes = {}
    780790        for f in dir:
    781791            fn = f.findtext('name')
    782             pn = f.findtext('index')
    783             imgNames[fn] = getInt(pn)
     792            pn = getInt(f.findtext('index'))
     793            imgNames[fn] = pn
     794            imgIndexes[pn] = fn
    784795           
    785796        docinfo['imgFileNames'] = imgNames
     797        docinfo['imgFileIndexes'] = imgIndexes
    786798        return docinfo
    787799           
     
    849861        else:
    850862            pn = getInt(pn, 1)
     863            pf = getPfForPn(docinfo, pn)
     864            pageinfo['pf'] = pf
    851865           
    852866        pageinfo['pn'] = pn
     
    891905       
    892906        # cache search results
    893         pageinfo['resultPageSize'] = getInt(self.REQUEST.get('resultPageSize', 10))
    894907        query = self.REQUEST.get('query',None)
    895908        pageinfo['query'] = query
    896         if query:
     909        if query and viewMode == 'text':
     910            pageinfo['resultPageSize'] = getInt(self.REQUEST.get('resultPageSize', 10))
    897911            queryType = self.REQUEST.get('queryType', 'fulltextMorph')
    898912            pageinfo['queryType'] = queryType
     
    911925
    912926    def getPageBatch(self, start=1, rows=10, cols=2, pageFlowLtr=True, pageZero=False, minIdx=1, maxIdx=0):
    913         """returns dict with array of page informations for one screenfull of thumbnails"""
     927        """returns dict with array of page information for one screenfull of thumbnails"""
    914928        batch = {}
    915929        grpsize = rows * cols
  • version.txt

    r587 r591  
    1 DocumentViewer 2.2.8
     1DocumentViewer 2.2.9
Note: See TracChangeset for help on using the changeset viewer.