Index: /pykota/trunk/pykota/accounters/snmp.py
===================================================================
--- /pykota/trunk/pykota/accounters/snmp.py (revision 2584)
+++ /pykota/trunk/pykota/accounters/snmp.py (revision 2615)
@@ -25,4 +25,5 @@
 ITERATIONDELAY = 1.5   # 1.5 Second
 STABILIZATIONDELAY = 3 # We must read three times the same value to consider it to be stable
+NOPRINTINGMAXDELAY = 30 # The printer must begin to print within 30 seconds.
 
 import sys
@@ -97,5 +98,5 @@
         def handleAnswer(self, wholeMsg, notusedhere, req):
             """Decodes and handles the SNMP answer."""
-            self.parent.filter.logdebug("SNMP message : '%s'" % repr(wholeMsg))
+            self.parent.filter.logdebug("SNMP answer : '%s'" % repr(wholeMsg))
             ver = alpha.protoVersions[alpha.protoVersionId1]
             rsp = ver.Message()
@@ -118,5 +119,8 @@
                             self.printerStatus = self.values[1]
                             self.deviceStatus = self.values[2]
-                            self.parent.filter.logdebug("SNMP answer is decoded : PageCounter : %s  PrinterStatus : %s  DeviceStatus : %s" % tuple(self.values))
+                            self.parent.filter.logdebug("SNMP answer decoded : PageCounter : %s  PrinterStatus : '%s'  DeviceStatus : '%s'" \
+                                 % (self.printerInternalPageCounter, \
+                                    printerStatusValues.get(self.printerStatus, "ILLEGAL VALUE"), \
+                                    deviceStatusValues.get(self.deviceStatus, "ILLEGAL VALUE")))
                         except IndexError :    
                             self.parent.filter.logdebug("SNMP answer is incomplete : %s" % str(self.values))
@@ -127,4 +131,6 @@
         def waitPrinting(self) :
             """Waits for printer status being 'printing'."""
+            previousValue = self.parent.getLastPageCounter()
+            timebefore = time.time()
             firstvalue = None
             while 1:
@@ -145,4 +151,16 @@
                             # So we can probably quit being sure it is printing.
                             self.parent.filter.printInfo("Printer %s is lying to us !!!" % self.parent.filter.PrinterName, "warn")
+                            break
+                        elif (time.time() - timebefore) > NOPRINTINGMAXDELAY :
+                            # More than X seconds without the printer being in 'printing' mode
+                            # We can safely assume this won't change
+                            if self.printerInternalPageCounter == previousValue :
+                                # Here the job won't be printed, because probably
+                                # the printer rejected it for some reason.
+                                self.parent.filter.printInfo("Printer %s probably won't print this job !!!" % self.parent.filter.PrinterName, "warn")
+                            else :     
+                                # Here the job has already been entirely printed, and
+                                # the printer has already passed from 'idle' to 'printing' to 'idle' again.
+                                self.parent.filter.printInfo("Printer %s has probably already printed this job !!!" % self.parent.filter.PrinterName, "warn")
                             break
                 self.parent.filter.logdebug(_("Waiting for printer %s to be printing...") % self.parent.filter.PrinterName)    
@@ -206,4 +224,7 @@
             self.filter = fakeFilter()
             self.protocolHandler = Handler(self, hostname)
+            
+        def getLastPageCounter(self) :    
+            return 0
         
     acc = fakeAccounter()            
Index: /pykota/trunk/pykota/accounters/pjl.py
===================================================================
--- /pykota/trunk/pykota/accounters/pjl.py (revision 2584)
+++ /pykota/trunk/pykota/accounters/pjl.py (revision 2615)
@@ -33,4 +33,5 @@
 ITERATIONDELAY = 1   # 1 Second
 STABILIZATIONDELAY = 3 # We must read three times the same value to consider it to be stable
+NOPRINTINGMAXDELAY = 30 # The printer must begin to print within 30 seconds.
 
 # Here's the real thing :
@@ -130,4 +131,6 @@
     def waitPrinting(self) :
         """Waits for printer status being 'printing'."""
+        previousValue = self.parent.getLastPageCounter()
+        timebefore = time.time()
         firstvalue = None
         while 1:
@@ -147,4 +150,16 @@
                         # So we can probably quit being sure it is printing.
                         self.parent.filter.printInfo("Printer %s is lying to us !!!" % self.parent.filter.PrinterName, "warn")
+                        break
+                    elif (time.time() - timebefore) > NOPRINTINGMAXDELAY :
+                        # More than X seconds without the printer being in 'printing' mode
+                        # We can safely assume this won't change
+                        if self.printerInternalPageCounter == previousValue :
+                            # Here the job won't be printed, because probably
+                            # the printer rejected it for some reason.
+                            self.parent.filter.printInfo("Printer %s probably won't print this job !!!" % self.parent.filter.PrinterName, "warn")
+                        else :     
+                            # Here the job has already been entirely printed, and
+                            # the printer has already passed from 'idle' to 'printing' to 'idle' again.
+                            self.parent.filter.printInfo("Printer %s has probably already printed this job !!!" % self.parent.filter.PrinterName, "warn")
                         break
             self.parent.filter.logdebug(_("Waiting for printer %s to be printing...") % self.parent.filter.PrinterName)
@@ -204,4 +219,7 @@
             self.filter = fakeFilter()
             self.protocolHandler = Handler(self, sys.argv[1])
+            
+        def getLastPageCounter(self) :    
+            return 0
         
     acc = fakeAccounter()            
Index: /pykota/trunk/NEWS
===================================================================
--- /pykota/trunk/NEWS (revision 2614)
+++ /pykota/trunk/NEWS (revision 2615)
@@ -24,4 +24,8 @@
     - 1.24alpha6 :
     
+        - Fixed internal SNMP and PJL handling code for very fast
+          printers : PyKota didn't see them going from 'idle'
+          to 'printing' to 'idle' again.
+          
         - Now waitprinter.sh accepts SNMP version number and 
           community name as arguments, thanks to Brandon
