Search code examples
pythonpy2exeesky

Get progress by Esky tasks


I'm using Esky with my frozen app. It has the following properties and methods are available on the Esky class:

app.version:                the current best available version.

app.active_version:         the currently-executing version, or None
                            if the esky isn't for the current app.

app.find_update():          find the best available update, or None
                            if no updates are available.

app.fetch_version(v):       fetch the specified version into local storage.

app.install_version(v):     install and activate the specified version.

Now, that's nice and all, but I want to show the progress of the download task in my Gui.

How can I achieve that?


Solution

  • Not properly documenated, there is the fetch_version_iter generator function:

    fetch_version_iter: like fetch_version but yielding progress updates during its execution

    It yields the following values:

    yield {"status": "downloading", "size": infile_size, "received": partfile.tell(), }

    yield {"status":"retrying","size":None}

    yield {"status":"ready","path":name}

    Also, you can get the filename like that:

    app.version_finder.version_graph.get_best_path(app.version,v)