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

Refactor #17

Merged
merged 8 commits into from
Dec 7, 2022
Merged

Refactor #17

merged 8 commits into from
Dec 7, 2022

Conversation

adrien-berchet
Copy link
Contributor

Here is a first version of the refactoring I mentioned to be able to store several files and fetch their dataset hierarchies.
It's currently not working, I have an issue with borrowing mutable and immutable reference but I will see that later (or @anilbey you know how to fix it? 😇 ).
Does this refactoring makes sense to you?

@adrien-berchet
Copy link
Contributor Author

Note that I let a few useless stuff that I will have to clean later.

Copy link
Contributor

@anilbey anilbey left a comment

Choose a reason for hiding this comment

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

Fantastic change!
I left just a small comment.

To be honest, I couldn't fully understand the borrowing issue.

src/gui.rs Outdated
match file.path {
None => println!("Could not load the file!"),
Some(x) => (self.loaded_files)
.push(hdf::read_nwb_file(&x.display().to_string()).unwrap()),
Copy link
Contributor

Choose a reason for hiding this comment

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

Here there's a small inconsistency between the drag&drop and file picker.

When we select a non-nwb file using the file picker, it says:
Could not load /home/anil/work/Text File.txt

When we drag and drop the same file however it panics.

`thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/gui.rs:144:76
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace`

Maybe drag & drop can also say "could not load the file" instead of panicking.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yes yes, I forgot a match here. I will fix that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be good now.

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.

2 participants