When loading files from a folder with many files (>1000) windows explorer is a bottleneck slowing the process down.
My suggestion is to add the following to read files from a given directory, with a common string.
def commonFiles(self,src):
src = QtWidgets.QFileDialog.getExistingDirectory(self, 'Select path', src)
string, _ = QtWidgets.QInputDialog.getText(self,"Common string","Common string file ends with")
print(string)
files = os.listdir(src)
files.sort()
print(files[0])
files = [ os.path.join(src,x) for x in files if x.endswith(f"{string}")]
print(len(files))
_ , ext = os.path.splitext(string)
print(files[0])
print("*"+ext)
return files,"*"+ext
filters = ext+';;'+';;'.join([x for x in filters.replace(ext,'').split(';;') if x])
files, ext = QtWidgets.QFileDialog.getOpenFileNames(self, 'Select files', path , filters)
if len(files)<1:
filters = ext+';;'+';;'.join([x for x in filters.replace(ext,'').split(';;') if x])
if us.UseCommonFiles:
files, ext = self.commonFiles(path)
else:
files, ext = QtWidgets.QFileDialog.getOpenFileNames(self, 'Select files', path , filters)
if len(files)<1: