Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report progress callback #48

Open
AndreMiras opened this issue Aug 3, 2015 · 3 comments
Open

Report progress callback #48

AndreMiras opened this issue Aug 3, 2015 · 3 comments

Comments

@AndreMiras
Copy link

I'm integrating your library to a Kivy graphical application.
I would like the user to know roughly the progress of the process.
I guess this could be achieved with a callback we could pass to the MBTilesBuilder.run() method.

@leplatrem
Copy link
Collaborator

Yes, why not. Or you could also poll a class attribute at regular interval. As you prefer...

@AndreMiras
Copy link
Author

Thanks @leplatrem, I had a look at which attribute I could poll and I found only two relevant ones.
MBTilesBuilder.nbtiles and TilesManager.rendered.
While MBTilesBuilder.nbtiles gives the number of tiles in total for a given bbox, TilesManager.rendered gives the number of tiles that were downloaded. The problem is that when accessing cached tiles, the rendered counter doesn't get incremented. Which means we do not always get TilesManager.rendered = MBTilesBuilder.nbtiles at the end.
I think I'll probably use your polling method even though I'm not a big fan of polling patterns (compared to callbacks), but I'll inherit MBTilesBuilder to specialise it and always increment a counter on each loop.

@leplatrem
Copy link
Collaborator

As you wish !
Don't hesitate to provide a pull-request to introduce your callback ! We'll review it with pleasure ! Especially if it comes with a small test case.
Thanks for your feedback !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants