Changeset 2193

Show
Ignore:
Timestamp:
04/04/05 21:04:21 (19 years ago)
Author:
jerome
Message:

pkbanner now accepts more info to display on its command line

Location:
pykota/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/pkbanner

    r2147 r2193  
    5555command line usage : 
    5656 
    57   pkbanner  [options]  
     57  pkbanner  [options]  [more info] 
    5858 
    5959options : 
     
    144144        return (size + 4) 
    145145     
    146     def genPDF(self, pagesize, logo, url, savetoner) : 
     146    def genPDF(self, pagesize, logo, url, text, savetoner) : 
    147147        """Generates the banner in PDF format, return the PDF document as a string.""" 
    148          
    149148        document = cStringIO.StringIO() 
    150149        c = canvas.Canvas(document, pagesize=pagesize, pageCompression=1) 
     
    183182        # Outputs the username 
    184183        ypos -= self.printVar(c, xcenter, ypos, _("Username"), username, 20, savetoner)  
     184         
     185        # Text     
     186        if text : 
     187            ypos -= self.printVar(c, xcenter, ypos, _("More Info"), text, 20, savetoner)  
    185188         
    186189        # Printer and Job Id 
     
    239242        return document.getvalue() 
    240243         
    241     def main(self, files, options) : 
     244    def main(self, arguments, options) : 
    242245        """Generates a banner.""" 
    243246        if not hasRL : 
     
    261264             
    262265        self.logdebug("Generating the banner in PDF format...")     
    263         doc = self.genPDF(pagesize, options["logo"].strip(), options["url"].strip(), savetoner) 
     266        doc = self.genPDF(pagesize,  
     267                          options["logo"].strip(),  
     268                          options["url"].strip(),  
     269                          " ".join(arguments).strip(),  
     270                          savetoner) 
    264271         
    265272        self.logdebug("Converting the banner to PostScript...")     
    266273        os.environ["PATH"] = "%s:/bin:/usr/bin:/usr/local/bin:/opt/bin:/sbin:/usr/sbin" % os.environ.get("PATH", "") 
    267         child = popen2.Popen3("gs -q -dNOPAUSE -dBATCH -dPARANOIDSAFER -sDEVICE=pswrite -sOutputFile=- - 2>/tmp/errgs") 
    268         child.tochild.write(doc) 
    269         child.tochild.close() 
    270         sys.stdout.write(child.fromchild.read()) 
    271         sys.stdout.flush() 
    272         child.fromchild.close() 
     274        child = popen2.Popen3("gs -q -dNOPAUSE -dBATCH -dPARANOIDSAFER -sDEVICE=pswrite -sOutputFile=- -") 
     275        try : 
     276            child.tochild.write(doc) 
     277            child.tochild.close() 
     278            sys.stdout.write(child.fromchild.read()) 
     279            sys.stdout.flush() 
     280            child.fromchild.close() 
     281        except IOError, msg :     
     282            self.printInfo("I/O Error %s" % msg, "error") 
    273283        status = child.wait() 
    274284        if os.WIFEXITED(status) : 
  • pykota/trunk/conf/pykota.conf.sample

    r2146 r2193  
    721721# NB : pkbanner's default page size is A4 
    722722# 
     723# A static banner page 
    723724# endingbanner: /home/joe/mystaticbanner.ps 
     725# 
     726# A banner with personnalized logo and url 
    724727# endingbanner: /usr/bin/pkbanner --pagesize=A4 --logo="/home/joe/mylogo.jpeg" --url="http://tech.example.com" 
     728# 
     729# A banner in the format accepted by the printer 
    725730# endingbanner: /usr/bin/pkbanner | gs -q -dNOPAUSE -dBATCH -dPARANOIDSAFER -sOutputFile=- -sDEVICE=lj5mono - 
    726 # endingbanner: /usr/bin/pkbanner 
     731# 
     732# A banner with more info on it, extracted from the yellow pages. 
     733# the string "Phone 111222333444" will be added to the banner page 
     734# if extractphone.sh returns 111222333444 for the current user. 
     735# endingbanner: /usr/bin/pkbanner Phone `extractphone.sh $PYKOTAUSERNAME` 
     736# 
     737# Default PyKota banner 
     738# endingbanner: /usr/bin/pkbanner  
    727739 
    728740# How should enforcement be done for this printer ? 
  • pykota/trunk/NEWS

    r2188 r2193  
    2222PyKota NEWS : 
    2323        
     24    - 1.22alpha4 : 
     25     
     26        - Allows pkbanner to accept more info to display on its  
     27          command line. 
     28           
    2429    - 1.22alpha3 : 
    2530     
  • pykota/trunk/pykota/version.py

    r2179 r2193  
    2222# 
    2323 
    24 __version__ = "1.22alpha3_unofficial" 
     24__version__ = "1.22alpha4_unofficial" 
    2525 
    2626__doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""