log.info( "Out of documents. Scanned %d pages total." % (page - 1)) no_docs = True break if expected_bytes > 0: if adf: log.info( "Expecting to read %s from scanner (per page)." % utils.format_bytes(expected_bytes)) else: log.info("Expecting to read %s from scanner." % utils.format_bytes(expected_bytes)) device.waitForScanActive() pm = tui.ProgressMeter("Reading data:") while device.isScanActive(): while update_queue.qsize(): try: status, bytes_read = update_queue.get(0) if not log.is_debug(): if expected_bytes > 0: pm.update( int(100 * bytes_read / expected_bytes), utils.format_bytes(bytes_read)) else:
if adf and status == scanext.SANE_STATUS_NO_DOCS: if page-1 == 0: log.error("No document(s). Please load documents and try again.") sys.exit(0) else: log.info("Out of documents. Scanned %d pages total." % (page-1)) no_docs = True break if expected_bytes > 0: if adf: log.info("Expecting to read %s from scanner (per page)." % utils.format_bytes(expected_bytes)) else: log.info("Expecting to read %s from scanner." % utils.format_bytes(expected_bytes)) device.waitForScanActive() pm = tui.ProgressMeter("Reading data:") while device.isScanActive(): while update_queue.qsize(): try: status, bytes_read = update_queue.get(0) if not log.is_debug(): if expected_bytes > 0: pm.update(int(100*bytes_read/expected_bytes), utils.format_bytes(bytes_read)) else: pm.update(0, utils.format_bytes(bytes_read))