Show
Ignore:
Timestamp:
09/27/08 22:02:37 (16 years ago)
Author:
jerome
Message:

Removed unnecessary spaces at EOL.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/accounters/ink.py

    r3411 r3413  
    88# the Free Software Foundation, either version 3 of the License, or 
    99# (at your option) any later version. 
    10 #  
     10# 
    1111# This program is distributed in the hope that it will be useful, 
    1212# but WITHOUT ANY WARRANTY; without even the implied warranty of 
    1313# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414# GNU General Public License for more details. 
    15 #  
     15# 
    1616# You should have received a copy of the GNU General Public License 
    1717# along with this program.  If not, see <http://www.gnu.org/licenses/>. 
     
    3636                        "GC" : { "G" : "grayscale", "C" : "colored" } , 
    3737                     } 
    38     def computeJobSize(self) :     
     38    def computeJobSize(self) : 
    3939        """Do ink accounting for a print job.""" 
    4040        if (not self.isPreAccounter) and \ 
     
    4646            self.inkUsage = self.filter.preaccounter.inkUsage   # Optimize : already computed ! 
    4747            return self.filter.softwareJobSize                  # Optimize : already computed ! 
    48              
     48 
    4949        parameters = [p.strip() for p in self.arguments.split(',')] 
    5050        if len(parameters) == 1 : 
     
    5454        if colorspace not in ("cmyk", "bw", "cmy", "rgb", "gc") : 
    5555            raise PyKotaAccounterError, _("Invalid parameters for ink accounter : [%s]") % self.arguments 
    56              
    57         try :     
     56 
     57        try : 
    5858            resolution = int(resolution) 
    59         except ValueError :     
     59        except ValueError : 
    6060            raise PyKotaAccounterError, "Invalid parameters for ink accounter : [%s]" % self.arguments 
    61              
     61 
    6262        self.filter.logdebug("Using internal parser to compute job's size and ink usage.") 
    63          
     63 
    6464        jobsize = 0 
    6565        if self.filter.JobSizeBytes : 
    6666            try : 
    6767                from pkpgpdls import analyzer, pdlparser 
    68             except ImportError :     
     68            except ImportError : 
    6969                self.filter.printInfo("pkpgcounter is now distributed separately, please grab it from http://www.pykota.com/software/pkpgcounter", "error") 
    7070                self.filter.printInfo("Precomputed job size will be forced to 0 pages.", "error") 
    71             else :      
     71            else : 
    7272                options = analyzer.AnalyzerOptions(colorspace=colorspace, resolution=resolution) 
    7373                try : 
    7474                    parser = analyzer.PDLAnalyzer(self.filter.DataFile, options) 
    7575                    (cspace, pages) = parser.getInkCoverage() 
    76                 except pdlparser.PDLParserError, msg :     
     76                except pdlparser.PDLParserError, msg : 
    7777                    # Here we just log the failure, but 
    7878                    # we finally ignore it and return 0 since this 
     
    8080                    # job's size MAY be. 
    8181                    self.filter.printInfo(_("Unable to precompute the job's size and ink coverage with the generic PDL analyzer : %s") % msg, "warn") 
    82                 else :     
     82                else : 
    8383                    cspacelabels = self.cspaceExpanded[cspace] 
    8484                    for page in pages : 
     
    8686                        for color in page.keys() : 
    8787                            colordict[cspacelabels[color]] = page[color] 
    88                         self.inkUsage.append(colordict)     
     88                        self.inkUsage.append(colordict) 
    8989                    jobsize = len(pages) 
    9090                    try : 
    9191                        if self.filter.Ticket.FileName is not None : 
    92                             # when a filename is passed as an argument, the backend  
     92                            # when a filename is passed as an argument, the backend 
    9393                            # must generate the correct number of copies. 
    9494                            jobsize *= self.filter.Ticket.Copies 
    9595                            self.inkUsage *= self.filter.Ticket.Copies 
    96                     except AttributeError : # When not run from the cupspykota backend  
     96                    except AttributeError : # When not run from the cupspykota backend 
    9797                        pass 
    9898                    self.filter.logdebug("Ink usage : %s ===> %s" % (cspace, repr(self.inkUsage))) 
    99         return jobsize         
     99        return jobsize