Changeset 2181 for pykota/trunk

Show
Ignore:
Timestamp:
03/23/05 14:48:13 (20 years ago)
Author:
jerome
Message:

Hopefully final fix for HP LaserJet? Color with buggy SNMP support :
this bitch lies to us pretending to be idle, but the page
counter increases !

Files:
1 modified

Legend:

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

    r2180 r2181  
    119119        def waitPrinting(self) : 
    120120            """Waits for printer status being 'printing'.""" 
     121            firstvalue = None 
    121122            while 1: 
    122123                self.retrieveSNMPValues() 
     
    124125                if statusAsString in ('printing', 'warmup') : 
    125126                    break 
     127                if self.printerInternalPageCounter is not None :     
     128                    if firstvalue is None : 
     129                        # first time we retrieved a page counter, save it 
     130                        firstvalue = self.PrinterInternalPageCounter 
     131                    else :      
     132                        # second time (or later) 
     133                        if firstvalue < self.PrinterInternalPageCounter : 
     134                            # Here we have a printer which lies : 
     135                            # it says it is not printing or warming up 
     136                            # BUT the page counter increases !!! 
     137                            # So we can probably quit being sure it is printing. 
     138                            self.parent.filter.printInfo("Printer %s is lying to us !!!" % self.parent.filter.printername, "warn") 
     139                            break 
    126140                self.parent.filter.logdebug(_("Waiting for printer %s to be printing...") % self.parent.filter.printername)     
    127141                time.sleep(ITERATIONDELAY)