Example #1
0
                                (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))
Example #2
0
                    break

        if plugin_path.startswith('file://'):
            tui.header("COPY PLUGIN")
        else:
            tui.header("DOWNLOAD PLUGIN")
            log.info("Checking for network connection...")
            ok = utils.check_network_connection()

            if not ok:
                log.error("Network connection not detected.")
                clean_exit(1)

        log.info("Downloading plug-in from: %s" % plugin_path)
        pm = tui.ProgressMeter("Downloading plug-in:")

        status, plugin_path, error_str = pluginObj.download(
            plugin_path, plugin_download_callback)
        print()

        if status != ERROR_SUCCESS:

            log.error(error_str)

            if status in (ERROR_UNABLE_TO_RECV_KEYS,
                          ERROR_DIGITAL_SIGN_NOT_FOUND):
                cont, ans = tui.enter_yes_no(
                    "Do you still want to install the plug-in?", 'n')

                if not cont or not ans:
                if plugin_conf_url.startswith('file://'):
                    tui.header("COPY CONFIGURATION")
                else:
                    tui.header("DOWNLOAD CONFIGURATION")

                    log.info("Checking for network connection...")
                    ok = core.check_network_connection()

                    if not ok:
                        log.error("Network connection not detected.")
                        sys.exit(1)

                log.info("Downloading configuration file from: %s" %
                         plugin_conf_url)
                pm = tui.ProgressMeter("Downloading configuration:")

                plugin_path, size, checksum, timestamp, ok = core.get_plugin_info(
                    plugin_conf_url, plugin_download_callback)

                print

                if not plugin_path.startswith(
                        'http://') and not plugin_path.startswith('file://'):
                    plugin_path = 'file://' + plugin_path

            else:  # p - specify plugin path

                while True:
                    plugin_path = raw_input(
                        log.bold(