Skip to content

Commit

Permalink
added fits file to choose file path
Browse files Browse the repository at this point in the history
  • Loading branch information
ashmeigh committed Nov 18, 2024
1 parent 48af91c commit a59dc92
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions mantidimaging/gui/windows/add_images_to_dataset_dialog/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations
import uuid

from PyQt5.QtWidgets import QComboBox, QFileDialog, QDialogButtonBox, QPushButton, QLineEdit, QLabel
from PyQt5.QtWidgets import QComboBox, QFileDialog, QDialogButtonBox, QPushButton, QLineEdit, QLabel, QMessageBox

from mantidimaging.gui.mvp_base import BaseDialogView
from mantidimaging.gui.windows.add_images_to_dataset_dialog.presenter import AddImagesToDatasetPresenter, Notification
Expand Down Expand Up @@ -37,8 +37,15 @@ def choose_file_path(self) -> None:
"""
Select a file in the stack path that we wish to add/replace in the dataset.
"""
selected_file, _ = QFileDialog.getOpenFileName(caption="Images", filter="Image File (*.tif *.tiff)")
file_filter = "Image Files (*.tif *.tiff *.fits);;All Files (*)"
selected_file, _ = QFileDialog.getOpenFileName(caption="Select Image File", filter=file_filter)

if selected_file:
# Ensure file extension validation (optional, as filter already handles it)
if not selected_file.lower().endswith(('.tif', '.tiff', '.fits')):
QMessageBox.warning(self, "Unsupported File", "Please select a valid .tif, .tiff, or .fits file.")
return

self.filePathLineEdit.setText(selected_file)
self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(True)

Expand Down

0 comments on commit a59dc92

Please sign in to comment.