Esempio n. 1
0
                    log.info("\nScanning...")

                bytes_read = 0

                try:
                    try:
                        ok, expected_bytes, status = device.startScan(
                            "RGBA", update_queue, event_queue)
                        # Note: On some scanners (Marvell) expected_bytes will be < 0 (if lines == -1)
                        log.debug("expected_bytes = %d" % expected_bytes)
                    except scanext.error, e:
                        sane.reportError(e)
                        sys.exit(1)
                    except KeyboardInterrupt:
                        log.error("Aborted.")
                        device.cancelScan()
                        sys.exit(1)

                    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
Esempio n. 2
0
                else:
                    log.info("\nScanning...")

                bytes_read = 0

                try:
                    try:
                        ok, expected_bytes, status = device.startScan("RGBA", update_queue, event_queue)
                        # Note: On some scanners (Marvell) expected_bytes will be < 0 (if lines == -1)
                        log.debug("expected_bytes = %d" % expected_bytes)
                    except scanext.error, e:
                        sane.reportError(e)
                        sys.exit(1)
                    except KeyboardInterrupt:
                        log.error("Aborted.")
                        device.cancelScan()
                        sys.exit(1)

                    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: