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/escp2.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/>. 
     
    2929    """A parser for ESC/P2 documents.""" 
    3030    format = "ESC/P2" 
    31     def isValid(self) :         
     31    def isValid(self) : 
    3232        """Returns True if data is ESC/P2, else False.""" 
    3333        if self.firstblock.startswith("\033@") or \ 
     
    3636           self.firstblock.startswith("\0\0\0\033\1@EJL") : # ESC/P Raster ??? Seen on Stylus Photo 1284 
    3737            return True 
    38         else :     
     38        else : 
    3939            return False 
    40              
    41     def getJobSize(self) :     
     40 
     41    def getJobSize(self) : 
    4242        """Counts pages in an ESC/P2 document.""" 
    4343        # with Gimpprint, at least, for each page there 
    4444        # are two Reset Printer sequences (ESC + @) 
    4545        marker1 = "\033@" 
    46          
     46 
    4747        # with other software or printer driver, we 
    4848        # may prefer to search for "\r\n\fESCAPE" 
     
    5050        marker2r = "\r\f\033" 
    5151        marker2rn = "\r\n\f\033" 
    52          
     52 
    5353        # and ghostscript's stcolor for example seems to 
    5454        # output ESC + @ + \f for each page plus one 
    5555        marker3 = "\033@\f" 
    56          
     56 
    5757        # while ghostscript's escp driver outputs instead 
    5858        # \f + ESC + @ 
    5959        marker4 = "\f\033@" 
    60          
     60 
    6161        data = self.infile.read() 
    6262        pagecount1 = data.count(marker1) 
     
    6464        pagecount3 = data.count(marker3) 
    6565        pagecount4 = data.count(marker4) 
    66              
    67         if pagecount2 :     
     66 
     67        if pagecount2 : 
    6868            return pagecount2 
    69         elif pagecount3 > 1 :      
     69        elif pagecount3 > 1 : 
    7070            return pagecount3 - 1 
    71         elif pagecount4 :     
     71        elif pagecount4 : 
    7272            return pagecount4 
    73         else :     
    74             return int(pagecount1 / 2)        
     73        else : 
     74            return int(pagecount1 / 2)