Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions GSASII/GSASIIdataGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,8 @@ def OnImportGeneric(self,reader,readerlist,label,multiple=False,
rd.selections = []
rd.dnames = []
rd.ReInitialize() # purge anything from a previous read
if not Start: # reuse bank selections from 1st file
rd.selections = list(userSel)
rd.errors = "" # clear out any old errors
if not rd.ContentsValidator(filename): # rejected on cursory check
errorReport += "\n "+rd.formatName + ' validator error'
Expand All @@ -1202,6 +1204,7 @@ def OnImportGeneric(self,reader,readerlist,label,multiple=False,
if dlg.ShowModal() == wx.ID_OK:
rd.selections = dlg.GetSelections()
Start = False
userSel = list(rd.selections)
dlg.Destroy()
repeat = True
rdbuffer = {} # create temporary storage for file reader
Expand Down
12 changes: 5 additions & 7 deletions GSASII/GSASIIscriptable.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,26 +482,24 @@ def import_generic(filename, readerlist, fmthint=None, bank=None,

for rd in primaryReaders + secondaryReaders:
# Initialize reader
rd.selections = []
rd.dnames = []
rd.ReInitialize()
rd.useNet = useNet # matters only for phase importers
if bank is None:
rd.selections = []
else:
try:
rd.selections = [i-1 for i in bank]
except TypeError:
rd.selections = [bank-1]
rd.dnames = []
rd.ReInitialize()
rd.useNet = useNet # matters only for phase importers
# Rewind file
rd.errors = ""
if any(i < 0 for i in rd.selections):
raise G2ImportException(f"Databank numbering starts at 1, got {bank}.")
if not rd.ContentsValidator(filename):
# Report error
G2fil.G2Print("Warning: File {} has a validation error, continuing".format(filename))
#if len(rd.selections) > 1:
# raise G2ImportException("File {} has {} banks. Specify which bank to read with databank param."
# .format(filename,len(rd.selections)))

block = 0
if buffer is None:
rdbuffer = {}
Expand Down
4 changes: 2 additions & 2 deletions GSASII/imports/G2pwd_GPX.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def ContentsValidator(self, filename):
if nhist:
if not len(self.selections): #no PWDR entries
self.selections = range(nhist)
fp.close()
return True
fp.close()
return True
self.errors = 'No powder entries found'
fp.close()
return False
Expand Down
Loading