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

Possibility of combining your FileUpload widget with the ProgressBar? #15

Open
jpfeuffer opened this issue May 16, 2023 · 4 comments
Open

Comments

@jpfeuffer
Copy link

Hi,

I wondered if it is possible to combine your nice FileUpload widget with the equally helpful ProgressBar widget somehow.

@redhog
Copy link
Member

redhog commented May 16, 2023

Heyas!

Cool to hear you find these tools useful!

You could probably subclass FileUpload and override this method https://github.com/emerald-geomodelling/BokehGarden/blob/master/bokeh_garden/upload.py#L121 with one that also calls ProgressBar.set();

Not sure if you'd have to wrap it in something like self.app.doc.add_next_tick_callback(tornado.gen.coroutine(self.method_to_update_progressbar)). I don't think so, but there's a risk. But if you do, Bokeh will let you know that you don't get to update from another thread.

You might also want to be careful with how often you update the progress bar. If on every uploaded chunk, this might add a lot of network overhead. Maybe each 10 or so?

@redhog
Copy link
Member

redhog commented May 16, 2023

If you get this to work and you make a combined widget, I'd be happy to include it in this library; shoot me a PR :)

@redhog
Copy link
Member

redhog commented May 16, 2023

Btw: Don't forget that you can also use something like self.app.doc.select({"tags": ["My progress bar"]}) to find the progress bar instance from the upload class, if you don't want to bake them into one GUI element but want them in different places in the UI.

@jpfeuffer
Copy link
Author

Thank you so much for the detailed comments. It indeed looks feasible to do. I will definitely report back once I have something running!

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