def setTakeBackPlan(self): willbeinstalled, willberemoved = PisiIface.getPlan(self.selected.getOpNo()) information = "" if self.selected.getType() == 'snapshot': # configuration files in a snapshot configs = self.historydb.get_config_files(self.selected.getOpNo()) if len(configs) != 0: information += "<br>" + i18n("Configuration files in snapshot:") for i in configs.keys(): information += "<br><br><b>" + i + "</b><br>" for j in configs.get(i): information += "/".join(j.split(str(self.selected.getOpNo()),1)[1].split(i,1)[1:]) self.planTextEdit.setText(information) message = i18n("Take Back Plan for %1 operation on %2")\ .arg(self.selected.getTypeTr()).arg(self.selected.getDate()) + "<br><br>" if len(willbeinstalled) != 0: message += "<br>" + i18n("These package(s) will be <b>installed</b> :") + "<br>" for i in range(len(willbeinstalled)): message += willbeinstalled[i] + "<br>" if len(willberemoved) != 0: message += "<br>" + i18n("These package(s) will be <b>removed</b> :") + "<br>" for i in range(len(willberemoved)): message += willberemoved[i] + "<br>" message += "<br>" self.planTextEdit.setText(message + information)
def __take_back(self, operation): willbeinstalled, willberemoved = PisiIface.getPlan(operation) qmessage = i18n("This will restore your system back to : %1 %2\nIf you're unsure, click Cancel and see TakeBack Plan")\ .arg(self.selected.getDate()).arg(self.selected.getTime()) if not self.command.inProgress(): if 0 == QMessageBox.question(self, i18n("Warning"), \ qmessage, i18n("Continue"), i18n("Cancel")): self.enableButtons(False) self.progress.reset() self.progress.setTotalSteps((len(willbeinstalled)+len(willberemoved))*2) self.command.takeBack(operation)