Changeset 258 for pkpgcounter

Show
Ignore:
Timestamp:
09/07/05 20:30:56 (19 years ago)
Author:
jerome
Message:

Forgot to commit this afternoon !

Location:
pkpgcounter/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • pkpgcounter/trunk/NEWS

    r256 r258  
    2222pkpgcounter News : 
    2323    
     24  * 1.66 :  
     25   
     26    - Improved PCLXL parser. 
     27     
     28    - Improved PCL3/4/5 parser. 
     29     
    2430  * 1.65 : 
    2531     
  • pkpgcounter/trunk/pkpgpdls/pcl345.py

    r256 r258  
    309309            sys.stderr.write("escstart : %s\n" % escstart) 
    310310         
    311 #        if not pagecount : 
    312 #            pagecount = (pagecount or ((resets - 3) * (resets > 2))) 
    313 #        else :     
    314 #            # here we add counters for other ways new pages may have 
    315 #            # been printed and ejected by the printer 
    316 #            pagecount += ejects + backsides 
    317 #         
    318 #        # now handle number of copies for each page (may differ). 
    319 #        # in duplex mode, number of copies may be sent only once. 
    320 #        for pnum in range(pagecount) : 
    321 #            # if no number of copies defined, take the preceding one else the one set before any page else 1. 
    322 #            page = pages.get(pnum, pages.get(pnum - 1, pages.get(0, { "copies" : 1 }))) 
    323 #            pagecount += (page["copies"] - 1) 
    324 #             
    325 #        # in PCL3 files, there's one Start Gfx tag per page 
    326 #        if ispcl3 : 
    327 #            if endgfx == int(startgfx / 2) : # special case for cdj1600 
    328 #                pagecount = endgfx  
    329 #            elif startgfx : 
    330 #                pagecount = startgfx 
    331 #            elif endgfx :     
    332 #                pagecount = endgfx 
    333                  
    334              
    335311        if resets == ejects == mediasourcecount == mediasizecount == escstart == 1 : 
    336312            pagecount = orientationcount 
     
    342318            pass 
    343319        elif (not startgfx) and (not endgfx) : 
    344             if ejects : 
    345                 pagecount = ejects 
     320            pass 
    346321        elif (resets == 2) and (startgfx == endgfx) and (mediasourcecount == 1) : 
    347322            pass 
  • pkpgcounter/trunk/pkpgpdls/pclxl.py

    r253 r258  
    148148            # From what I read in PCLXL documentation, the number 
    149149            # of copies is an unsigned 16 bits integer 
    150             self.pages[self.pagecount]["copies"] = unpack(self.endianness + "H", minfile[pos-5:pos3])[0] 
     150            try : 
     151                self.pages[self.pagecount]["copies"] = unpack(self.endianness + "H", minfile[pos-5:pos3])[0] 
     152            except KeyError :     
     153                self.logdebug("It looks like this PCLXL file is corrupted.") 
    151154        return 0 
    152155         
     
    461464         
    462465        infileno = self.infile.fileno() 
    463         self.pages = {} 
     466        self.pages = { 0 : { "copies" : 1,  
     467                             "orientation" : "Default",  
     468                             "mediatype" : "Plain",  
     469                             "mediasize" : "Default",  
     470                             "mediasource" : "Default",  
     471                           }  
     472                     }       
    464473        self.minfile = minfile = mmap.mmap(infileno, os.fstat(infileno)[6], prot=mmap.PROT_READ, flags=mmap.MAP_SHARED) 
    465474        tags = self.tags 
  • pkpgcounter/trunk/pkpgpdls/version.py

    r256 r258  
    2020# 
    2121 
    22 __version__ = "1.65" 
     22__version__ = "1.66" 
    2323 
    2424__doc__ = """pkpgcounter : a generic Page Description Languages parser."""