Show
Ignore:
Timestamp:
10/06/08 00:22:07 (16 years ago)
Author:
jerome
Message:

Removed spaces at EOL.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pkpgcounter/trunk/pkpgpdls/postscript.py

    r3410 r3436  
    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/>. 
     
    3434    openmode = "rU" 
    3535    format = "PostScript" 
    36     def isValid(self) :     
     36    def isValid(self) : 
    3737        """Returns True if data is PostScript, else False.""" 
    3838        if self.firstblock.startswith("%!") or \ 
     
    4545              (self.firstblock.find("%!PS-Adobe") != -1) : 
    4646            return True 
    47         else :     
     47        else : 
    4848            return False 
    49          
     49 
    5050    def throughGhostScript(self) : 
    5151        """Get the count through GhostScript, useful for non-DSC compliant PS files.""" 
     
    6262            except (IOError, OSError, AttributeError, ValueError), msg : 
    6363                raise pdlparser.PDLParserError, "Problem during analysis of Binary PostScript document : %s" % msg 
    64         finally :         
     64        finally : 
    6565            if fromchild.close() is not None : 
    6666                raise pdlparser.PDLParserError, "Problem during analysis of Binary PostScript document" 
    67         self.logdebug("GhostScript said : %s pages" % pagecount)     
     67        self.logdebug("GhostScript said : %s pages" % pagecount) 
    6868        return pagecount * self.copies 
    69          
    70     def setcopies(self, pagenum, txtvalue) :     
     69 
     70    def setcopies(self, pagenum, txtvalue) : 
    7171        """Tries to extract a number of copies from a textual value and set the instance attributes accordingly.""" 
    7272        try : 
    7373            number = int(txtvalue) 
    74         except (ValueError, TypeError) :      
     74        except (ValueError, TypeError) : 
    7575            pass 
    76         else :     
     76        else : 
    7777            if number > self.pages[pagenum]["copies"] : 
    7878                self.pages[pagenum]["copies"] = number 
    79                  
     79 
    8080    def natively(self) : 
    8181        """Count pages in a DSC compliant PostScript document.""" 
     
    9494            if nbparts >= 1 : 
    9595                part0 = parts[0] 
    96             else :     
     96            else : 
    9797                part0 = "" 
    9898            if part0 == r"%ADOPrintSettings:" : 
    9999                acrobatmarker = True 
    100             elif part0 == "!R!" :     
     100            elif part0 == "!R!" : 
    101101                prescribe = True 
    102102            elif part0 == r"%%Pages:" : 
     
    119119                if nbparts > 1 : 
    120120                    self.setcopies(pagecount, parts[1]) 
    121             elif part0 == r"%RBINumCopies:" :    
     121            elif part0 == r"%RBINumCopies:" : 
    122122                if nbparts > 1 : 
    123123                    self.setcopies(pagecount, parts[1]) 
     
    135135                    # treats both "%%Page: x x" and "%%Page: (x-y) z" (probably N-up mode) 
    136136                    newpagenum = int(line.split(']')[0].split()[-1]) 
    137                 except :     
     137                except : 
    138138                    notinteger = True # It seems that sometimes it's not an integer but an EPS file name 
    139                 else :     
     139                else : 
    140140                    notinteger = False 
    141141                    if newpagenum == oldpagenum : 
     
    143143                    else : 
    144144                        oldpagenum = newpagenum 
    145                 if proceed and not notinteger :         
     145                if proceed and not notinteger : 
    146146                    pagecount += 1 
    147147                    self.pages[pagecount] = { "copies" : self.pages[pagecount-1]["copies"] } 
     
    155155                self.setcopies(pagecount, part0) 
    156156            previousline = line 
    157              
    158         # extract max number of copies to please the ghostscript parser, just     
     157 
     158        # extract max number of copies to please the ghostscript parser, just 
    159159        # in case we will use it later 
    160160        self.copies = max([ v["copies"] for (k, v) in self.pages.items() ]) 
    161          
     161 
    162162        # now apply the number of copies to each page 
    163         if not pagecount and pagescomment :     
     163        if not pagecount and pagescomment : 
    164164            pagecount = pagescomment 
    165165        for pnum in range(1, pagecount + 1) : 
     
    168168            pagecount += (copies - 1) 
    169169            self.logdebug("%s * page #%s" % (copies, pnum)) 
    170              
     170 
    171171        self.logdebug("Internal parser said : %s pages" % pagecount) 
    172172        return (pagecount, notrust) 
    173          
    174     def getJobSize(self) :     
     173 
     174    def getJobSize(self) : 
    175175        """Count pages in PostScript document.""" 
    176176        self.copies = 1 
     
    182182            except pdlparser.PDLParserError, msg : 
    183183                self.logdebug(msg) 
    184         return max(nbpages, newnbpages)     
     184        return max(nbpages, newnbpages)