diff --git a/hexrdgui/load_images_dialog.py b/hexrdgui/load_images_dialog.py index ce1a7a1cb..3ef9b0145 100644 --- a/hexrdgui/load_images_dialog.py +++ b/hexrdgui/load_images_dialog.py @@ -1,6 +1,7 @@ from collections import Counter # To compare two lists' contents import re import os +from pathlib import Path from PySide6.QtWidgets import QMessageBox, QTableWidgetItem, QComboBox from hexrdgui.constants import TRANSFORM_OPTIONS @@ -49,13 +50,14 @@ def exec(self): if self.ui.exec(): # Perform some validation before returning results = self.results() - image_files = [v for f in results.values() for v in f] + matches = [Path(v).name for f in results.values() for v in f] + image_files = [Path(f).name for f in self.image_files] if Counter(results.keys()) != Counter(self.detectors): msg = 'Detectors do not match the current detectors' QMessageBox.warning(self.ui, 'HEXRD', msg) continue elif (not self.using_roi and - Counter(image_files) != Counter(self.image_files)): + (Counter(matches) != Counter(image_files))): msg = 'Image files do not match the selected files' QMessageBox.warning(self.ui, 'HEXRD', msg) continue @@ -121,7 +123,7 @@ def setup_standard_table(self, table): table.cellWidget(i, 1).currentTextChanged.connect( lambda v, i=i: self.selection_changed(v, i)) - f = QTableWidgetItem(self.image_files[i]) + f = QTableWidgetItem(Path(self.image_files[i]).name) table.setItem(i, 2, f) def setup_table(self): @@ -158,7 +160,7 @@ def update_table(self): table.cellWidget(i, 2).currentTextChanged.connect( lambda v, i=i: self.selection_changed(v, i)) else: - f = QTableWidgetItem(image_files[i]) + f = QTableWidgetItem(Path(image_files[i]).name) table.setItem(i, 2, f) def results(self): @@ -182,7 +184,7 @@ def results(self): det_idx = i if not self.using_roi: imgs_per_det = len(self.image_files) / len(self.detectors) - det_idx = i // imgs_per_det + det_idx = int(i / imgs_per_det) HexrdConfig().load_panel_state['trans'][det_idx] = idx return results