Changeset 452 for pkpgcounter/trunk/pkpgpdls/pcl345.py
- Timestamp:
- 03/15/07 19:48:25 (18 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pkpgcounter/trunk/pkpgpdls/pcl345.py
r443 r452 33 33 34 34 NUL = chr(0x00) 35 LINEFEED = chr(0x0a) 35 36 FORMFEED = chr(0x0c) 36 37 ESCAPE = chr(0x1b) … … 105 106 def setPageDict(self, attribute, value) : 106 107 """Initializes a page dictionnary.""" 107 dic = self.pages.setdefault(self.pagecount, { "copies" : 1, "mediasource" : "Main", "mediasize" : "Default", "mediatype" : "Plain", "orientation" : "Portrait", "escaped" : "", "duplex": 0}) 108 dic = self.pages.setdefault(self.pagecount, { "linescount" : 1, 109 "copies" : 1, 110 "mediasource" : "Main", 111 "mediasize" : "Default", 112 "mediatype" : "Plain", 113 "orientation" : "Portrait", 114 "escaped" : "", 115 "duplex": 0 }) 108 116 dic[attribute] = value 109 117 … … 226 234 self.setPageDict("copies", value) 227 235 #self.logdebug("COPIES %i" % value) 236 elif end == 'F' : 237 self.linesperpagevalues.append(value) 238 self.linesperpage = value 239 #self.logdebug("LINES PER PAGE : %i" % self.linesperpage) 240 #else : 241 # self.logdebug("Unexpected end <%s> and value <%s>" % (end, value)) 228 242 229 243 def escAmpa(self) : … … 293 307 #self.logdebug("SKIPTO %08x" % self.pos) 294 308 309 def newLine(self) : 310 """Handles new lines markers.""" 311 if not self.hpgl2 : 312 dic = self.pages.get(self.pagecount, None) 313 if dic is None : 314 self.setPageDict("linescount", 1) 315 dic = self.pages.get(self.pagecount) 316 nblines = dic["linescount"] 317 self.setPageDict("linescount", nblines + 1) 318 if (self.linesperpage is not None) \ 319 and (dic["linescount"] > self.linesperpage) : 320 self.pagecount += 1 321 295 322 def getInteger(self) : 296 323 """Returns an integer value and the end character.""" … … 360 387 self.orientationsvalues = [] 361 388 self.mediatypesvalues = [] 389 self.linesperpagevalues = [] 390 self.linesperpage = None 362 391 self.startgfx = [] 363 392 self.endgfx = [] … … 368 397 369 398 tags = [ lambda : None] * 256 399 tags[ord(LINEFEED)] = self.newLine 370 400 tags[ord(FORMFEED)] = self.endPage 371 401 tags[ord(ESCAPE)] = self.escape … … 442 472 if self.isimagerunner : 443 473 self.pagecount += 1 # ImageRunner adjustment 474 elif self.linesperpage is not None : 475 self.pagecount += 1 # Adjusts for incomplete last page 444 476 elif len(self.startgfx) == len(self.endgfx) == 0 : 445 477 if self.resets % 2 :