def importFromFile(self): tlist = Transformation.getAll() if len(tlist) > 0: ret = QMessageBox.question( self, self.tr("Import"), self.tr("Do you want to keep the defined transformations?"), QMessageBox.Yes | QMessageBox.No) infile = QFileDialog.getOpenFileName( self, self.tr("Select the file containing transformations"), self.lastImportFile(), self.tr("XML file (*.xml)")) if infile.isEmpty(): return self.setLastImportFile(infile) if len(tlist) > 0 and ret == QMessageBox.No: # clear all existent transformations before continue for t in tlist: t.deleteData() if not Transformation.importFromXml(infile): return False self.table.model().reloadData() self.table.model().reset() return True
def reloadData(self): self.transformations = Transformation.getAll(self.enabledOnly) self.row_count = len(self.transformations)