def dropDataFiles(self , listOfFiles): warningCollector = '' for filePath in listOfFiles: if filePath != '': if self.ui.lst_data.findItems(str(filePath) , QtCore.Qt.MatchExactly) != []: warningCollector = warningCollector + self.warnings['openData_err_N'] + filePath + '\n' continue self.displayInformation('Opening file '+ filePath + '. Please wait...' , 'new') if filePath[-4:] == '.mat' or filePath[-2:] == '.p': (dataMatrix , dataInfo , message) = dl.loadSigmalFromFile(filePath) else: warningCollector += self.warnings['wrongType'] + filePath + '\n' if message == 'ok': self.addData(filePath , dataMatrix , dataInfo) else: warningCollector += self.warnings['openData_'+message] + filePath + '\n' else: return if self.refreshSamplingFrequency() == 1: warningCollector += 'Sampling frequency is not uniform across all files!' + '\n' self.displayInformation('' , 'new') if warningCollector != '': self.warrning('on' , warningCollector) self.enableAllWidgets(True) self.changeButtonsAvailability()
def chooseDataFiles(self): dialog = QtGui.QFileDialog.getOpenFileNames(self , 'Open data files' , expanduser('~') , 'All Files (*);;Matlab files (*.mat);;Python pickles (*.p)') if len(dialog) == 0: return warningCollector = '' for filePath in dialog: if filePath != '': if self.ui.lst_data.findItems(str(filePath) , QtCore.Qt.MatchExactly) != []: warningCollector = warningCollector + self.warnings['openData_err_N'] + filePath + '\n' continue self.displayInformation('Opening file '+ filePath + '. Please wait...' , 'new') if filePath[-4:] == '.mat' or filePath[-2:] == '.p': (dataMatrix , dataInfo , message) = dl.loadSigmalFromFile(filePath) else: warningCollector += self.warnings['wrongType'] + filePath + '\n' if message == 'ok': self.addData(filePath , dataMatrix , dataInfo) else: warningCollector += self.warnings['openData_'+message] + filePath + '\n' else: return if self.refreshSamplingFrequency() == 1: warningCollector += 'Sampling frequency is not uniform across all files!' + '\n' self.displayInformation('' , 'new') if warningCollector != '': self.warrning('on' , warningCollector) self.enableAllWidgets(True) self.changeButtonsAvailability()