73 | | try : |
74 | | parser = analyzer.PDLAnalyzer(infile, options) |
75 | | (cspace, pages) = parser.getInkCoverage() |
76 | | cspacelabels = self.cspaceExpanded[cspace] |
77 | | for page in pages : |
78 | | colordict = {} |
79 | | for color in page.keys() : |
80 | | colordict[cspacelabels[color]] = page[color] |
81 | | self.inkUsage.append(colordict) |
82 | | jobsize = len(pages) |
83 | | self.filter.logdebug("Ink usage : %s ===> %s" % (cspace, repr(self.inkUsage))) |
84 | | except pdlparser.PDLParserError, msg : |
85 | | # Here we just log the failure, but |
86 | | # we finally ignore it and return 0 since this |
87 | | # computation is just an indication of what the |
88 | | # job's size MAY be. |
89 | | self.filter.printInfo(_("Unable to precompute the job's size with the generic PDL analyzer : %s") % msg, "warn") |
90 | | else : |
91 | | if self.filter.InputFile is not None : |
92 | | # when a filename is passed as an argument, the backend |
93 | | # must generate the correct number of copies. |
94 | | jobsize *= self.filter.Copies |
95 | | finally : |
96 | | infile.close() |
| 72 | parser = analyzer.PDLAnalyzer(self.filter.DataFile, options) |
| 73 | (cspace, pages) = parser.getInkCoverage() |
| 74 | cspacelabels = self.cspaceExpanded[cspace] |
| 75 | for page in pages : |
| 76 | colordict = {} |
| 77 | for color in page.keys() : |
| 78 | colordict[cspacelabels[color]] = page[color] |
| 79 | self.inkUsage.append(colordict) |
| 80 | jobsize = len(pages) |
| 81 | self.filter.logdebug("Ink usage : %s ===> %s" % (cspace, repr(self.inkUsage))) |
| 82 | except pdlparser.PDLParserError, msg : |
| 83 | # Here we just log the failure, but |
| 84 | # we finally ignore it and return 0 since this |
| 85 | # computation is just an indication of what the |
| 86 | # job's size MAY be. |
| 87 | self.filter.printInfo(_("Unable to precompute the job's size with the generic PDL analyzer : %s") % msg, "warn") |
| 88 | else : |
| 89 | if self.filter.InputFile is not None : |
| 90 | # when a filename is passed as an argument, the backend |
| 91 | # must generate the correct number of copies. |
| 92 | jobsize *= self.filter.Copies |