def restoreBackup(self): appFilePath = self.appManager.appFilePath suggestedFolder = self.appManager.appStorageDir fileDialog = FileDialogWithValidation(self, [appFilePath]) fileDialog.setFileMode(QFileDialog.ExistingFile) fileDialog.selectFile(suggestedFolder) if fileDialog.exec_(): choosenPath = fileDialog.selectedFiles()[0] self.appManager.restoreBackup(unicode(choosenPath))
def createBackup(self): appFileName = self.appManager.appFileName appFilePath = self.appManager.appFilePath (name, ext) = appFileName.split('.') timestamp = datetime.now().strftime('%Y-%m-%d-%H-%M-%S') suggestedFileName = '%s-%s.%s' % (name, timestamp, ext) suggestedFolder = self.appManager.appStorageDir suggestedFilePath = suggestedFolder + os.sep + suggestedFileName fileDialog = FileDialogWithValidation(self, [appFilePath]) fileDialog.setFileMode(QFileDialog.AnyFile) fileDialog.selectFile(suggestedFilePath) if fileDialog.exec_(): choosenPath = fileDialog.selectedFiles()[0] self.appManager.createBackup(unicode(choosenPath))