def readFolder(self, folder): if len(folder) != 0: currentIndex = self.receiverList.currentIndex() self.model.clear() files = [ f for f in os.listdir(folder) if os.path.isfile(os.path.join(folder, f)) ] files.sort() numValidFiles = 0 for f in files: if f.endswith('dat'): wf = Tecplot.read(os.path.join(folder, f)) if wf: item = QStandardItem(f) item.setData(wf) self.model.appendRow(item) numValidFiles = numValidFiles + 1 if currentIndex.row() >= 0 and numValidFiles > currentIndex.row(): newIndex = self.model.index(currentIndex.row(), currentIndex.column()) self.receiverList.setCurrentIndex(newIndex) self.activeItemChanged.emit()
def readFolder(self, folder): if len(folder) != 0: self.model.clear() files = [f for f in os.listdir(folder) if os.path.isfile(os.path.join(folder,f))] files.sort() for f in files: wf = Tecplot.read(os.path.join(folder,f)) item = QStandardItem(f) item.setData(wf) self.model.appendRow(item)
def readFolder(self, folder): if len(folder) != 0: self.model.clear() files = [ f for f in os.listdir(folder) if os.path.isfile(os.path.join(folder, f)) ] files.sort() for f in files: wf = Tecplot.read(os.path.join(folder, f)) item = QStandardItem(f) item.setData(wf) self.model.appendRow(item)
def readFolder(self, folder): if len(folder) != 0: currentIndex = self.receiverList.currentIndex() self.model.clear() files = [f for f in os.listdir(folder) if os.path.isfile(os.path.join(folder,f))] files.sort() for f in files: wf = Tecplot.read(os.path.join(folder,f)) item = QStandardItem(f) item.setData(wf) self.model.appendRow(item) if currentIndex.row() >= 0 and len(files) > currentIndex.row(): newIndex = self.model.index(currentIndex.row(), currentIndex.column()) self.receiverList.setCurrentIndex(newIndex) self.activeItemChanged.emit()