当前位置: 首页>>代码示例>>Python>>正文


Python ImageBackup.createBackupJob方法代码示例

本文整理汇总了Python中Plugins.SystemPlugins.ViX.ImageManager.ImageBackup.createBackupJob方法的典型用法代码示例。如果您正苦于以下问题:Python ImageBackup.createBackupJob方法的具体用法?Python ImageBackup.createBackupJob怎么用?Python ImageBackup.createBackupJob使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Plugins.SystemPlugins.ViX.ImageManager.ImageBackup的用法示例。


在下文中一共展示了ImageBackup.createBackupJob方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: UpdatePlugin

# 需要导入模块: from Plugins.SystemPlugins.ViX.ImageManager import ImageBackup [as 别名]
# 或者: from Plugins.SystemPlugins.ViX.ImageManager.ImageBackup import createBackupJob [as 别名]

#.........这里部分代码省略.........

	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()
开发者ID:Huevos,项目名称:enigma2,代码行数:104,代码来源:SoftwareUpdate.py

示例2: UpdatePlugin

# 需要导入模块: from Plugins.SystemPlugins.ViX.ImageManager import ImageBackup [as 别名]
# 或者: from Plugins.SystemPlugins.ViX.ImageManager.ImageBackup import createBackupJob [as 别名]

#.........这里部分代码省略.........
                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()
开发者ID:sodo13,项目名称:EG-gui,代码行数:104,代码来源:SoftwareUpdate.py

示例3: UpdatePlugin

# 需要导入模块: from Plugins.SystemPlugins.ViX.ImageManager import ImageBackup [as 别名]
# 或者: from Plugins.SystemPlugins.ViX.ImageManager.ImageBackup import createBackupJob [as 别名]

#.........这里部分代码省略.........
                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
            and not self.ImageBackupDone
        ):
            self.doImageBackup()
开发者ID:undertaker01,项目名称:enigma2,代码行数:70,代码来源:SoftwareUpdate.py

示例4: UpdatePlugin

# 需要导入模块: from Plugins.SystemPlugins.ViX.ImageManager import ImageBackup [as 别名]
# 或者: from Plugins.SystemPlugins.ViX.ImageManager.ImageBackup import createBackupJob [as 别名]

#.........这里部分代码省略.........
		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()
开发者ID:torac,项目名称:enigma2,代码行数:104,代码来源:SoftwareUpdate.py


注:本文中的Plugins.SystemPlugins.ViX.ImageManager.ImageBackup.createBackupJob方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。