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

find_file utility handles absolute path #1023

Merged
merged 1 commit into from
Jan 17, 2017
Merged

find_file utility handles absolute path #1023

merged 1 commit into from
Jan 17, 2017

Conversation

philippjfr
Copy link
Member

@philippjfr philippjfr commented Dec 18, 2016

Ensure the find_file utility can handle an absolute filename path passed to it. The function ensures that the default widget assets get resolved correctly but the user should be able to override these with an absolute path.

Concretely you can now supply custom CSS to the widgets to change the layout a bit. Setting:

hv.plotting.widgets.SelectionWidget.css = '/Users/philippjfr/Downloads/test.css'

can give you something like this:

screen shot 2016-12-18 at 7 41 20 pm

@philippjfr
Copy link
Member Author

Ready after review.

"""
matches = []
if os.path.isabs(filename) and os.path.isfile(filename):
return filename
for root, _, filenames in os.walk(folder):
for filename in fnmatch.filter(filenames, filename):
matches.append(os.path.join(root, filename))
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be worth avoid overwriting the filename argument with the return values of fnmatch.filter (i.e it might be worth calling it fname in this loop).

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch.

@philippjfr
Copy link
Member Author

Addressed your comment, ready to merge after tests pass.

@jlstevens
Copy link
Contributor

Just to say that I do think being to change the layout using CSS would be useful. Ideally, we could provide alternate CSS stylesheets and an API to switch them between them that is nicer than setting file paths.

Anyway, that could be a separate feature request and this PR would help make it possible. As the tests have passed, I'll merge now.

@jlstevens jlstevens merged commit 8e67b33 into master Jan 17, 2017
@philippjfr philippjfr deleted the find_file branch January 27, 2017 02:53
@philippjfr philippjfr mentioned this pull request Mar 29, 2017
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.

None yet

2 participants