def callback_open(self, widget, data=None): dialog = QFileDialog(self) dialog.setWindowTitle(_("Open an existing gpvdm simulation")) dialog.setNameFilter('Simulations - gpvdm (*.gpvdm *.opvdm)') dialog.setFileMode(QFileDialog.ExistingFile) if dialog.exec_() == QDialog.Accepted: filename = dialog.selectedFiles()[0] filename = to_native_path(filename) self.load_sim(filename)
def save_as_gpvdm(parent): dialog = QFileDialog(parent, directory=QDir.homePath()) dialog.setWindowTitle(_("Save a the simulation as")) dialog.setNameFilter(_("Directory")) dialog.setAcceptMode(QFileDialog.AcceptSave) dialog.setOption(QFileDialog.ShowDirsOnly, True) if dialog.exec_() == QDialog.Accepted: filename = dialog.selectedFiles()[0] filename = to_native_path(filename) return filename else: return None