本文整理汇总了Python中Plugins.SystemPlugins.ViX.BackupManager.BackupFiles类的典型用法代码示例。如果您正苦于以下问题:Python BackupFiles类的具体用法?Python BackupFiles怎么用?Python BackupFiles使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BackupFiles类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: doSettingsBackup
def doSettingsBackup(self):
from Plugins.SystemPlugins.ViX.BackupManager import BackupFiles
self.BackupFiles = BackupFiles(self.session, False, True)
Components.Task.job_manager.AddJob(self.BackupFiles.createBackupJob())
Components.Task.job_manager.in_background = False
for job in Components.Task.job_manager.getPendingJobs():
if job.name.startswith(_('Backup Manager')):
break
self.session.openWithCallback(self.keyResstore3, JobView, job, cancelable = False, backgroundable = False, afterEventChangeable = False, afterEvent="close")
示例2: doSettingsBackup
def doSettingsBackup(self):
backup = None
from Plugins.SystemPlugins.ViX.BackupManager import BackupFiles
self.BackupFiles = BackupFiles(self.session, True)
Components.Task.job_manager.AddJob(self.BackupFiles.createBackupJob())
Components.Task.job_manager.in_background = False
for job in Components.Task.job_manager.getPendingJobs():
if job.name == dgettext('vix', 'Backup Manager'):
break
self.showJobView(job)
示例3: doSettingsBackup
def doSettingsBackup(self):
backup = None
from Plugins.SystemPlugins.ViX.BackupManager import BackupFiles
self.BackupFiles = BackupFiles(self.session)
Components.Task.job_manager.AddJob(self.BackupFiles.createBackupJob())
Components.Task.job_manager.in_background = False
for job in Components.Task.job_manager.getPendingJobs():
if job.name.startswith(_("BackupManager")):
backup = job
if backup:
self.showJobView(backup)
示例4: UpdatePlugin
#.........这里部分代码省略.........
def startActualUpgrade(self, answer):
if not answer or not answer[1]:
self.close()
return
if answer[1] == "menu":
if config.softwareupdate.updateisunstable.value == '1':
message = _("The current update may be unstable") + "\n" + _("Are you sure you want to update your %s %s ?") % (getMachineBrand(), getMachineName()) + "\n(%s " % self.total_packages + _("Packages") + ")"
elif config.softwareupdate.updateisunstable.value == '0':
message = _("Do you want to update your %s %s ?") % (getMachineBrand(), getMachineName()) + "\n(%s " % self.total_packages + _("Packages") + ")"
choices = [(_("View the changes"), "changes"),
(_("Upgrade and reboot system"), "cold")]
if not self.SettingsBackupDone and not config.softwareupdate.autosettingsbackup.value and config.backupmanager.backuplocation.value:
choices.append((_("Perform a settings backup, making a backup before updating is strongly advised."), "backup"))
if not self.ImageBackupDone and not config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value:
choices.append((_("Perform a full image backup"), "imagebackup"))
choices.append((_("Update channel list only"), "channels"))
choices.append((_("Cancel"), ""))
self["actions"].setEnabled(True)
upgrademessage = self.session.openWithCallback(self.startActualUpgrade, ChoiceBox, title=message, list=choices, skin_name="SoftwareUpdateChoices", var=self.trafficLight, menu_path=self.menu_path_compressed)
upgrademessage.setTitle(self.title)
elif answer[1] == "changes":
self.session.openWithCallback(self.startActualUpgrade,SoftwareUpdateChanges, self.menu_path)
elif answer[1] == "backup":
self.doSettingsBackup()
elif answer[1] == "imagebackup":
self.doImageBackup()
elif answer[1] == "channels":
self.channellist_only = 1
self.slider.setValue(1)
self.ipkg.startCmd(IpkgComponent.CMD_LIST, args = {'installed_only': True})
elif answer[1] == "cold":
if (config.softwareupdate.autosettingsbackup.value and config.backupmanager.backuplocation.value) or (config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value):
self.doAutoBackup()
else:
self.session.open(TryQuitMainloop,retvalue=42)
self.close()
def modificationCallback(self, res):
self.ipkg.write(res and "N" or "Y")
def doSettingsBackup(self):
backup = None
from Plugins.SystemPlugins.ViX.BackupManager import BackupFiles
self.BackupFiles = BackupFiles(self.session, True)
Components.Task.job_manager.AddJob(self.BackupFiles.createBackupJob())
Components.Task.job_manager.in_background = False
for job in Components.Task.job_manager.getPendingJobs():
if job.name == dgettext('vix', 'Backup Manager'):
break
self.showJobView(job)
def doImageBackup(self):
backup = None
from Plugins.SystemPlugins.ViX.ImageManager import ImageBackup
self.ImageBackup = ImageBackup(self.session, True)
Components.Task.job_manager.AddJob(self.ImageBackup.createBackupJob())
Components.Task.job_manager.in_background = False
for job in Components.Task.job_manager.getPendingJobs():
if job.name == dgettext('vix', 'Image Manager'):
break
self.showJobView(job)
def doAutoBackup(self, val = False):
self.autobackuprunning = True
if config.softwareupdate.autosettingsbackup.value and config.backupmanager.backuplocation.value and not self.SettingsBackupDone:
self.doSettingsBackup()
elif config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value and not self.ImageBackupDone:
self.doImageBackup()
else:
self.session.open(TryQuitMainloop,retvalue=42)
self.close()
def showJobView(self, job):
if job.name == dgettext('vix', 'Image Manager'):
self.ImageBackupDone = True
elif job.name == dgettext('vix', 'Backup Manager'):
self.SettingsBackupDone = True
from Screens.TaskView import JobView
Components.Task.job_manager.in_background = False
if not self.autobackuprunning:
self.session.openWithCallback(self.startActualUpgrade(("menu", "menu")), JobView, job, cancelable = False, backgroundable = False, afterEventChangeable = False, afterEvent="close")
else:
self.session.openWithCallback(self.doAutoBackup, JobView, job, cancelable = False, backgroundable = False, afterEventChangeable = False, afterEvent="close")
def exit(self):
if not self.ipkg.isRunning():
if self.packages != 0 and self.error == 0 and self.channellist_only == 0:
self.session.openWithCallback(self.exitAnswer, MessageBox, _("Upgrade finished.") +" "+_("Do you want to reboot your %s %s") % (getMachineBrand(), getMachineName()))
else:
self.close()
else:
if not self.updating:
self.close()
def exitAnswer(self, result):
if result is not None and result:
self.session.open(TryQuitMainloop, retvalue=2)
self.close()
示例5: UpdatePlugin
#.........这里部分代码省略.........
upgrademessage = self.session.openWithCallback(
self.startActualUpgrade,
ChoiceBox,
title=message,
list=choices,
skin_name="SoftwareUpdateChoices",
var=self.trafficLight,
)
upgrademessage.setTitle(_("Software update"))
elif answer[1] == "changes":
self.session.openWithCallback(self.startActualUpgrade, SoftwareUpdateChanges)
elif answer[1] == "backup":
self.doSettingsBackup()
elif answer[1] == "imagebackup":
self.doImageBackup()
elif answer[1] == "channels":
self.channellist_only = 1
self.slider.setValue(1)
self.ipkg.startCmd(IpkgComponent.CMD_LIST, args={"installed_only": True})
elif answer[1] == "cold":
if (config.softwareupdate.autosettingsbackup.value and config.backupmanager.backuplocation.value) or (
config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value
):
self.doAutoBackup()
else:
self.session.open(TryQuitMainloop, retvalue=42)
self.close()
def modificationCallback(self, res):
self.ipkg.write(res and "N" or "Y")
def doSettingsBackup(self):
backup = None
from Plugins.SystemPlugins.ViX.BackupManager import BackupFiles
self.BackupFiles = BackupFiles(self.session, True)
Components.Task.job_manager.AddJob(self.BackupFiles.createBackupJob())
Components.Task.job_manager.in_background = False
for job in Components.Task.job_manager.getPendingJobs():
if job.name == dgettext("vix", "Backup Manager"):
break
self.showJobView(job)
def doImageBackup(self):
backup = None
from Plugins.SystemPlugins.ViX.ImageManager import ImageBackup
self.ImageBackup = ImageBackup(self.session, True)
Components.Task.job_manager.AddJob(self.ImageBackup.createBackupJob())
Components.Task.job_manager.in_background = False
for job in Components.Task.job_manager.getPendingJobs():
if job.name == dgettext("vix", "Image Manager"):
break
self.showJobView(job)
def doAutoBackup(self, val=False):
self.autobackuprunning = True
if (
config.softwareupdate.autosettingsbackup.value
and config.backupmanager.backuplocation.value
and not self.SettingsBackupDone
):
self.doSettingsBackup()
elif (
config.softwareupdate.autoimagebackup.value
and config.imagemanager.backuplocation.value
示例6: UpdatePlugin
#.........这里部分代码省略.........
self.channellist_name = param[0]
self.channellist_only = 2
def setEndMessage(self, txt):
self.slider.setValue(4)
self.activityTimer.stop()
self.activityslider.setValue(0)
self.package.setText(txt)
self.status.setText(self.oktext)
def startActualUpgrade(self, answer):
if not answer or not answer[1]:
self.close()
return
if answer[1] == 'menu':
message = _('Do you want to update your %s %s ?') % (getMachineBrand(), getMachineName()) + '\n(%s ' % self.total_packages + _('Packages') + ')'
choices = [(_('View the changes'), 'changes'), (_('Update and ask to reboot'), 'hot'), (_('Upgrade and reboot system'), 'cold')]
choices.append((_('Update channel list only'), 'channels'))
choices.append((_('Cancel'), ''))
upgrademessage = self.session.openWithCallback(self.startActualUpgrade, ChoiceBox, title=message, list=choices, skin_name='SoftwareUpdateChoices', var=self.trafficLight)
upgrademessage.setTitle(_('Software update'))
elif answer[1] == 'changes':
from Plugins.Extensions.EGAMINews.plugin import EGAMIMainNews
self.session.openWithCallback(self.startActualUpgrade, EGAMIMainNews)
elif answer[1] == 'backup':
self.doSettingsBackup()
elif answer[1] == 'imagebackup':
self.doImageBackup()
elif answer[1] == 'channels':
self.channellist_only = 1
self.slider.setValue(1)
self.ipkg.startCmd(IpkgComponent.CMD_LIST, args={'installed_only': True})
elif answer[1] == 'cold':
self.session.open(TryQuitMainloop, retvalue=42)
self.close()
else:
self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE, args={'test_only': False})
def modificationCallback(self, res):
self.ipkg.write(res and 'N' or 'Y')
def doSettingsBackup(self):
backup = None
from Plugins.SystemPlugins.ViX.BackupManager import BackupFiles
self.BackupFiles = BackupFiles(self.session, True)
Components.Task.job_manager.AddJob(self.BackupFiles.createBackupJob())
Components.Task.job_manager.in_background = False
for job in Components.Task.job_manager.getPendingJobs():
if job.name == dgettext('vix', 'Backup Manager'):
break
self.showJobView(job)
def doImageBackup(self):
backup = None
from Plugins.SystemPlugins.ViX.ImageManager import ImageBackup
self.ImageBackup = ImageBackup(self.session, True)
Components.Task.job_manager.AddJob(self.ImageBackup.createBackupJob())
Components.Task.job_manager.in_background = False
for job in Components.Task.job_manager.getPendingJobs():
if job.name == dgettext('vix', 'Image Manager'):
break
self.showJobView(job)
def doAutoBackup(self, val = False):
self.autobackuprunning = True
if config.softwareupdate.autosettingsbackup.value and config.backupmanager.backuplocation.value and not self.SettingsBackupDone:
self.doSettingsBackup()
elif config.softwareupdate.autoimagebackup.value and config.imagemanager.backuplocation.value and not self.ImageBackupDone:
self.doImageBackup()
else:
self.session.open(TryQuitMainloop, retvalue=42)
self.close()
def showJobView(self, job):
if job.name == dgettext('vix', 'Image Manager'):
self.ImageBackupDone = True
elif job.name == dgettext('vix', 'Backup Manager'):
self.SettingsBackupDone = True
from Screens.TaskView import JobView
Components.Task.job_manager.in_background = False
if not self.autobackuprunning:
self.session.openWithCallback(self.startActualUpgrade(('menu', 'menu')), JobView, job, cancelable=False, backgroundable=False, afterEventChangeable=False, afterEvent='close')
else:
self.session.openWithCallback(self.doAutoBackup, JobView, job, cancelable=False, backgroundable=False, afterEventChangeable=False, afterEvent='close')
def exit(self):
if not self.ipkg.isRunning():
if self.packages != 0 and self.error == 0 and self.channellist_only == 0:
self.session.openWithCallback(self.exitAnswer, MessageBox, _('Upgrade finished.') + ' ' + _('Do you want to reboot your %s %s') % (getMachineBrand(), getMachineName()))
else:
self.close()
elif not self.updating:
self.close()
def exitAnswer(self, result):
if result is not None and result:
self.session.open(TryQuitMainloop, retvalue=2)
self.close()
示例7: UpdatePlugin
#.........这里部分代码省略.........
self.status.setText(self.oktext)
def startActualUpgrade(self, answer):
if not answer or not answer[1]:
self.close()
return
if answer[1] == "menu":
if config.softwareupdate.updateisunstable.getValue() == '1':
message = _("The current update maybe unstable") + "\n" + _("Are you sure you want to update your STB_BOX?") + "\n(%s " % self.total_packages + _("Packages") + ")"
elif config.softwareupdate.updateisunstable.getValue() == '0':
message = _("Do you want to update your STB_BOX?") + "\n(%s " % self.total_packages + _("Packages") + ")"
choices = [(_("View the changes"), "changes"),
(_("Upgrade and reboot system"), "cold")]
if not self.SettingsBackupDone and not config.softwareupdate.autosettingsbackup.getValue():
choices.append((_("Perform a setting backup, making a backup before updating is strongly advised."), "backup"))
if not self.ImageBackupDone and not config.softwareupdate.autoimagebackup.getValue():
choices.append((_("Perform a full image backup"), "imagebackup"))
choices.append((_("Update channel list only"), "channels"))
choices.append((_("Cancel"), ""))
upgrademessage = self.session.openWithCallback(self.startActualUpgrade, ChoiceBox, title=message, list=choices, skin_name = "SoftwareUpdateChoices")
upgrademessage.setTitle(_('Software update'))
elif answer[1] == "changes":
self.session.openWithCallback(self.startActualUpgrade,SoftwareUpdateChanges)
elif answer[1] == "backup":
self.doSettingsBackup()
elif answer[1] == "imagebackup":
self.doImageBackup()
elif answer[1] == "channels":
self.channellist_only = 1
self.slider.setValue(1)
self.ipkg.startCmd(IpkgComponent.CMD_LIST, args = {'installed_only': True})
elif answer[1] == "cold":
if config.softwareupdate.autosettingsbackup.getValue() or config.softwareupdate.autoimagebackup.getValue():
self.doAutoBackup()
else:
self.session.open(TryQuitMainloop,retvalue=42)
self.close()
def modificationCallback(self, res):
self.ipkg.write(res and "N" or "Y")
def doSettingsBackup(self):
backup = None
from Plugins.SystemPlugins.ViX.BackupManager import BackupFiles
self.BackupFiles = BackupFiles(self.session)
Components.Task.job_manager.AddJob(self.BackupFiles.createBackupJob())
Components.Task.job_manager.in_background = False
for job in Components.Task.job_manager.getPendingJobs():
if job.name == dgettext('ViX', 'Backup Manager'):
break
self.showJobView(job)
def doImageBackup(self):
backup = None
from Plugins.SystemPlugins.ViX.ImageManager import ImageBackup
self.ImageBackup = ImageBackup(self.session)
Components.Task.job_manager.AddJob(self.ImageBackup.createBackupJob())
Components.Task.job_manager.in_background = False
for job in Components.Task.job_manager.getPendingJobs():
if job.name == dgettext('ViX', 'Image Manager'):
break
self.showJobView(job)
def doAutoBackup(self, val = False):
self.autobackuprunning = True
if config.softwareupdate.autosettingsbackup.getValue() and not self.SettingsBackupDone:
self.doSettingsBackup()
elif config.softwareupdate.autoimagebackup.getValue() and not self.ImageBackupDone:
self.doImageBackup()
else:
self.session.open(TryQuitMainloop,retvalue=42)
self.close()
def showJobView(self, job):
if job.name == dgettext('ViX', 'Image Manager'):
self.ImageBackupDone = True
elif job.name == dgettext('ViX', 'Backup Manager'):
self.SettingsBackupDone = True
from Screens.TaskView import JobView
Components.Task.job_manager.in_background = False
if not self.autobackuprunning:
self.session.openWithCallback(self.startActualUpgrade(("menu", "menu")), JobView, job, cancelable = False, backgroundable = False, afterEventChangeable = False, afterEvent="close")
else:
self.session.openWithCallback(self.doAutoBackup, JobView, job, cancelable = False, backgroundable = False, afterEventChangeable = False, afterEvent="close")
def exit(self):
if not self.ipkg.isRunning():
if self.packages != 0 and self.error == 0 and self.channellist_only == 0:
self.session.openWithCallback(self.exitAnswer, MessageBox, _("Upgrade finished.") +" "+_("Do you want to reboot your STB_BOX?"))
else:
self.close()
else:
if not self.updating:
self.close()
def exitAnswer(self, result):
if result is not None and result:
self.session.open(TryQuitMainloop, retvalue=2)
self.close()
示例8: VIXImageManager
#.........这里部分代码省略.........
backuptext = _("Next Backup: ") + strftime(_("%a %e %b %-H:%M"), t)
else:
backuptext = _("Next Backup: ")
self["backupstatus"].setText(str(backuptext))
def keyDelete(self):
self.sel = self['list'].getCurrent()
if self.sel:
message = _("Are you sure you want to delete this backup:\n ") + self.sel
ybox = self.session.openWithCallback(self.doDelete, MessageBox, message, MessageBox.TYPE_YESNO, default=False)
ybox.setTitle(_("Remove Confirmation"))
else:
self.session.open(MessageBox, _("You have no image to delete."), MessageBox.TYPE_INFO, timeout=10)
def doDelete(self, answer):
if answer is True:
self.sel = self['list'].getCurrent()
self["list"].instance.moveSelectionTo(0)
if self.sel.endswith('.zip'):
remove(self.BackupDirectory + self.sel)
else:
rmtree(self.BackupDirectory + self.sel)
self.populate_List()
def GreenPressed(self):
backup = None
self.BackupRunning = False
for job in Components.Task.job_manager.getPendingJobs():
if job.name.startswith(_("Image Manager")):
backup = job
self.BackupRunning = True
if self.BackupRunning and backup:
self.showJobView(backup)
else:
self.keyBackup()
def keyBackup(self):
message = _("Are you ready to create a backup image ?")
ybox = self.session.openWithCallback(self.doBackup, MessageBox, message, MessageBox.TYPE_YESNO)
ybox.setTitle(_("Backup Confirmation"))
def doBackup(self, answer):
if answer is True:
self.ImageBackup = ImageBackup(self.session)
Components.Task.job_manager.AddJob(self.ImageBackup.createBackupJob())
self.BackupRunning = True
self["key_green"].setText(_("View Progress"))
self["key_green"].show()
for job in Components.Task.job_manager.getPendingJobs():
if job.name.startswith(_("Image Manager")):
break
self.showJobView(job)
def doSettingsBackup(self):
from Plugins.SystemPlugins.ViX.BackupManager import BackupFiles
self.BackupFiles = BackupFiles(self.session, False, True)
Components.Task.job_manager.AddJob(self.BackupFiles.createBackupJob())
Components.Task.job_manager.in_background = False
for job in Components.Task.job_manager.getPendingJobs():
if job.name.startswith(_('Backup Manager')):
break
self.session.openWithCallback(self.keyResstore3, JobView, job, cancelable = False, backgroundable = False, afterEventChangeable = False, afterEvent="close")
def keyResstore(self):
self.sel = self['list'].getCurrent()
if getMachineMake() == 'vusolo4k':
self.session.open(MessageBox, _("Sorry, But this machine is not supported yet."), MessageBox.TYPE_INFO, timeout=10)
elif self.sel:
message = _("Are you sure you want to restore this image:\n ") + self.sel
ybox = self.session.openWithCallback(self.keyResstore2, MessageBox, message, MessageBox.TYPE_YESNO)
ybox.setTitle(_("Restore Confirmation"))
else:
self.session.open(MessageBox, _("You have no image to restore."), MessageBox.TYPE_INFO, timeout=10)
def keyResstore2(self, answer):
if answer:
if config.imagemanager.autosettingsbackup.value:
self.doSettingsBackup()
else:
self.keyResstore3()
def keyResstore3(self, val = None):
self.session.open(MessageBox, _("Please wait while the restore prepares"), MessageBox.TYPE_INFO, timeout=60, enable_input=False)
self.TEMPDESTROOT = self.BackupDirectory + 'imagerestore'
if self.sel.endswith('.zip'):
if not path.exists(self.TEMPDESTROOT):
mkdir(self.TEMPDESTROOT, 0755)
self.Console.ePopen('unzip -o %s%s -d %s' % (self.BackupDirectory, self.sel, self.TEMPDESTROOT), self.keyResstore4)
else:
self.keyResstore4(0, 0)
def keyResstore4(self, result, retval, extra_args=None):
if retval == 0:
kernelMTD = getMachineMtdKernel()
rootMTD = getMachineMtdRoot()
MAINDEST = '%s/%s' % (self.TEMPDESTROOT,getImageFolder())
CMD = '/usr/bin/ofgwrite -r%s -k%s %s/' % (rootMTD, kernelMTD, MAINDEST)
config.imagemanager.restoreimage.setValue(self.sel)
print '[ImageManager] running commnd:',CMD
self.Console.ePopen(CMD)