def on_actionInsert_triggered(self): initialdir = session.dirname if not initialdir: with self.sgroup as settings: initialdir = settings.value('loadfiledirectory', '') filename, _ = QFileDialog.getOpenFileName(self, 'Select file name', initialdir, 'ufit files (*.ufit)') if filename == '': return self.insert_session(path_to_str(filename))
def on_settemplateBtn_clicked(self): previous = self.templateEdit.text() if previous: startdir = path.dirname(previous) else: startdir = '.' fn = path_to_str( QFileDialog.getOpenFileName(self, 'Choose a file', startdir, 'All files (*)')[0]) if not fn: return dtempl, numor = extract_template(fn) self.set_template(dtempl, numor)
def changeDir(self): """ Change directory from which are the data read """ if self.dir: startdir = self.dir else: startdir = '.' fn = path_to_str(QFileDialog.getOpenFileName( self, 'Choose a file', startdir, 'All files (*)')[0]) if not fn: return dtempl, numor = extract_template(fn) self.dir = dtempl self.ui.txtNumors.setText(str(numor)) print("directory changed to", self.dir)