def saveFile(self, fileName, data): file = QtCore.QFile(fileName) if not file.open(QtCore.QIODevice.WriteOnly): return False file.write(data.readAll()) file.close() return True