Skip to content

Updating path on a File/MultiFileSelector Parameter updates objects - #814

Merged
maximlt merged 2 commits into
mainfrom
path_update_objects
Aug 21, 2023
Merged

maximlt merged 2 commits into
mainfrom
path_update_objects

Conversation

@maximlt

@maximlt maximlt commented Aug 3, 2023

Copy link
Copy Markdown
Member

Fixes #545
Supersedes #546

The issue stated about FileSelector:

FileSelector behaves like Selector and should as such set its value to the first item of objects, objects being the result of a glob on path.

This has been addressed in #801.

About MultiFileSelector:

Also the docs currently state that the default value is all of the matched files, but in practice it's None.

While that's what the docs say, the behavior of ListSelector from which MultiFileSelector inherits is for default to be None so I'm not sure we should make this change without also updating ListSelector. Also, Panel maps the MultiFileSelector parameter to the FileSelector widget (the FileSelector Parameter being mapped to a simple Select or TextInput widget) and I don't think we'd want all the files to be selected by default.

import param

class P(param.Parameterized):
    ls = param.ListSelector(objects=[1, 2, 3])

a = A()

assert a.ls is None

@philippjfr philippjfr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@maximlt
maximlt merged commit 7175b37 into main Aug 21, 2023
@maximlt
maximlt deleted the path_update_objects branch August 21, 2023 15:45
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

Successfully merging this pull request may close these issues.

FileSelector/MultiFileSelector don't update objects when path is updated and FileSelector doesn't set its value

2 participants