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

Enable pn.widgets.FileSelector() to watch for new files and update directory #1961

Closed
tlmille2 opened this issue Feb 3, 2021 · 3 comments
Closed
Milestone

Comments

@tlmille2
Copy link

tlmille2 commented Feb 3, 2021

Problem Statement
The general flow is a user can upload a series of images they would like to analyze or transform, select an image to do the analysis on, and then preform the analysis using Panel.

I'm using the file_input = pn.widgets.FileInput() to input files and = pn.widgets.FileSelector(nameofdir) to allow the selection of images to be analyzed using panel. However, I'm noticing the pn.widgets.FileSelector() doesn't update the available files unless you refresh the browser.

Additionally, the FileSelector() Widget has a method self._update_files() is called in response certain events, such as pressing the down arrow. You can force a refresh without reloading the browser. The only issue I have with using the UI to force the update is if you explicitly define a directory, without any children folders inside that directory, those buttons are basically disabled.

image

Desired Solution
Add a periodic callback to watch the directory for any changes.

Alternative Solution
A refresh button that can refresh the directory and display any new changes

@philippjfr
Copy link
Member

Thanks @tlmille2, very reasonable suggestions. I'll implement both, one question I have though, what did you do to get that layout for the FileSelector, it should really look like this:

Screen Shot 2021-02-04 at 11 40 09 AM

@tlmille2
Copy link
Author

tlmille2 commented Feb 4, 2021

@philippjfr - Appending the FileSelector in a bootstrap.main template (see below). I filtered out a large chunk of variable names.

image

I'm going to open another ticket about FileSelector not behaving it's margins when applied to the bootstrap template. I'm trying to diagnose it's cause, but I think it's a css issue.

@philippjfr
Copy link
Member

Thanks, I'll file a new issue.

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