Conversation
|
@psavery @saransh13 If we have old files or something that may not follow the typical pattern they would be great to also test this with. The files that I tested appear to get loaded correctly. |
hexrdgui/main_window.py
Outdated
| try: | ||
| # Try loading it as a state file first | ||
| self.load_state_file(paths[0]) | ||
| except: | ||
| # If that fails, try loading it as a materials file | ||
| HexrdConfig().load_materials(paths[0]) |
There was a problem hiding this comment.
I think it's true that we normally raise exceptions when we attempt to load a file that isn't the right kind. Since we are now relying on it, now we should definitely make sure we do that 🙂.
There was a problem hiding this comment.
I've made some improvements here and we do get an error when trying to load non-image file(s):
Failed to process imageseries.
zero length imageseries.
If you try to load an invalid image file you will still have to go through the steps of selecting the path (for .h5, .hdf5) and associating the image(s) with the correct detectors before you get the error, both of which can be cancelled if you realize this was a mistake.
If a file or files are dropped on the main window we will attempt to automatically load them as a state file, instrument config, materials file, or as images. Signed-off-by: Brianna Major <brianna.major@kitware.com>
Signed-off-by: Brianna Major <brianna.major@kitware.com>
Signed-off-by: Brianna Major <brianna.major@kitware.com>
Signed-off-by: Brianna Major <brianna.major@kitware.com>
Signed-off-by: Brianna Major <brianna.major@kitware.com>
Signed-off-by: Brianna Major <brianna.major@kitware.com>
Before, it was replacing the materials with every load. I also don't think it would work with cif files. Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
Signed-off-by: Brianna Major <brianna.major@kitware.com>
Rather than raising an exception if a materials file contains a material that already exists, add the duplicate value but add a "_1" suffix and print a warning. Signed-off-by: Brianna Major <brianna.major@kitware.com>
Signed-off-by: Brianna Major <brianna.major@kitware.com>
Signed-off-by: Patrick Avery <patrick.avery@kitware.com>
If a file or files are dropped on the main window we will attempt to automatically load them as a state file, instrument config, materials file, or as images.