本文整理汇总了Python中Plugins.SystemPlugins.ViX.ImageManager.ImageBackup类的典型用法代码示例。如果您正苦于以下问题:Python ImageBackup类的具体用法?Python ImageBackup怎么用?Python ImageBackup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ImageBackup类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: doImageBackup
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)
示例2: doImageBackup
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.startswith(_("ImageManager")):
backup = job
if backup:
self.showJobView(backup)
示例3: UpdatePlugin
class UpdatePlugin(Screen, ProtectedScreen):
def __init__(self, session, *args):
Screen.__init__(self, session)
ProtectedScreen.__init__(self)
screentitle = _("Software Update")
self.menu_path = args[0]
if config.usage.show_menupath.value == 'large':
self.menu_path += screentitle
self.title = self.menu_path
self.menu_path_compressed = ""
self.menu_path += ' / '
elif config.usage.show_menupath.value == 'small':
self.title = screentitle
condtext = ""
if self.menu_path and not self.menu_path.endswith(' / '):
condtext = self.menu_path + " >"
elif self.menu_path:
condtext = self.menu_path[:-3] + " >"
self.menu_path_compressed = condtext
self.menu_path += screentitle + ' / '
else:
self.title = screentitle
self.menu_path_compressed = ""
self["menu_path_compressed"] = StaticText(self.menu_path_compressed)
Screen.setTitle(self, self.title)
self["actions"] = ActionMap(["WizardActions"],
{
"ok": self.exit,
"back": self.exit
}, -1)
self['actions'].csel = self
self["actions"].setEnabled(False)
self.sliderPackages = { "dreambox-dvb-modules": 1, "enigma2": 2, "tuxbox-image-info": 3 }
self.slider = Slider(0, 4)
self["slider"] = self.slider
self.activityslider = Slider(0, 100)
self["activityslider"] = self.activityslider
self.status = StaticText(_("Please wait..."))
self["status"] = self.status
self.package = StaticText(_("Package list update"))
self["package"] = self.package
self.oktext = _("Press OK on your remote control to continue.")
self['tl_off'] = Pixmap()
self['tl_red'] = Pixmap()
self['tl_yellow'] = Pixmap()
self['tl_green'] = Pixmap()
self['feedStatusMSG'] = Label()
self.channellist_only = 0
self.channellist_name = ''
self.SettingsBackupDone = False
self.ImageBackupDone = False
self.autobackuprunning = False
self.updating = False
self.packages = 0
self.error = 0
self.processed_packages = []
self.total_packages = None
self.onFirstExecBegin.append(self.checkNetworkState)
def checkNetworkState(self):
self['tl_red'].hide()
self['tl_yellow'].hide()
self['tl_green'].hide()
self['tl_off'].hide()
self.trafficLight = feedsstatuscheck.getFeedsBool()
if self.trafficLight in feedsstatuscheck.feed_status_msgs:
status_text = feedsstatuscheck.feed_status_msgs[self.trafficLight]
else:
status_text = _('Feeds status: Unexpected')
if self.trafficLight:
self['feedStatusMSG'].setText(status_text)
if self.trafficLight == 'stable':
self['tl_green'].show()
elif self.trafficLight == 'unstable':
self['tl_red'].show()
elif self.trafficLight == 'updating':
self['tl_yellow'].show()
else:
self['tl_off'].show()
if (getImageType() != 'release' and self.trafficLight != 'unknown') or (getImageType() == 'release' and self.trafficLight not in ('stable', 'unstable')):
self.session.openWithCallback(self.close, MessageBox, feedsstatuscheck.getFeedsErrorMessage(), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True)
else:
if getImageType() != 'release' or (config.softwareupdate.updateisunstable.value == '1' and config.softwareupdate.updatebeta.value) or config.softwareupdate.updateisunstable.value == '0':
self.startCheck()
else:
self.session.openWithCallback(self.close, MessageBox, _("Sorry the feeds seem to be in an unstable state, if you wish to use them please enable 'Allow unstable (experimental) updates' in \"Software update settings\"."), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True)
def startCheck(self):
self.updating = True
self.activity = 0
self.activityTimer = eTimer()
self.activityTimer.callback.append(self.doActivityTimer)
self.ipkg = IpkgComponent()
self.ipkg.addCallback(self.ipkgCallback)
#.........这里部分代码省略.........
示例4: UpdatePlugin
class UpdatePlugin(Screen):
def __init__(self, session, *args):
Screen.__init__(self, session)
Screen.setTitle(self, _("Software Update"))
self.sliderPackages = {"dreambox-dvb-modules": 1, "enigma2": 2, "tuxbox-image-info": 3}
self.setTitle(_("Software update"))
self.slider = Slider(0, 4)
self["slider"] = self.slider
self.activityslider = Slider(0, 100)
self["activityslider"] = self.activityslider
self.status = StaticText(_("Please wait..."))
self["status"] = self.status
self.package = StaticText(_("Package list update"))
self["package"] = self.package
self.oktext = _("Press OK on your remote control to continue.")
status_msgs = {
"stable": _("Feeds status: Stable"),
"unstable": _("Feeds status: Unstable"),
"updating": _("Feeds status: Updating"),
"unknown": _("No connection"),
}
self["tl_off"] = Pixmap()
self["tl_red"] = Pixmap()
self["tl_yellow"] = Pixmap()
self["tl_green"] = Pixmap()
self.feedsStatus()
self["feedStatusMSG"] = Label(status_msgs[self.trafficLight])
self.channellist_only = 0
self.channellist_name = ""
self.SettingsBackupDone = False
self.ImageBackupDone = False
self.autobackuprunning = False
self.packages = 0
self.error = 0
self.processed_packages = []
self.total_packages = None
self.checkNetworkState()
def feedsStatus(self):
from urllib import urlopen
import socket
self["tl_red"].hide()
self["tl_yellow"].hide()
self["tl_green"].hide()
currentTimeoutDefault = socket.getdefaulttimeout()
socket.setdefaulttimeout(3)
try:
d = urlopen("http://openvix.co.uk/TrafficLightState.php")
self.trafficLight = d.read()
if self.trafficLight == "unstable":
self["tl_off"].hide()
self["tl_red"].show()
elif self.trafficLight == "updating":
self["tl_off"].hide()
self["tl_yellow"].show()
elif self.trafficLight == "stable":
self["tl_off"].hide()
self["tl_green"].show()
else:
self.trafficLight = "unknown"
self["tl_off"].show()
except:
self.trafficLight = "unknown"
self["tl_off"].show()
socket.setdefaulttimeout(currentTimeoutDefault)
def checkNetworkState(self):
cmd1 = "opkg update"
self.CheckConsole = Console()
self.CheckConsole.ePopen(cmd1, self.checkNetworkStateFinished)
def checkNetworkStateFinished(self, result, retval, extra_args=None):
if "bad address" in result:
self.session.openWithCallback(
self.close,
MessageBox,
_("Your %s %s is not connected to the internet, please check your network settings and try again.")
% (getMachineBrand(), getMachineName()),
type=MessageBox.TYPE_INFO,
timeout=10,
close_on_any_key=True,
)
elif ("wget returned 1" or "wget returned 255" or "404 Not Found") in result:
self.session.openWithCallback(
self.close,
MessageBox,
_(
"Sorry feeds are down for maintenance, please try again later. If this issue persists please check openvix.co.uk or world-of-satellite.com."
),
type=MessageBox.TYPE_INFO,
timeout=10,
close_on_any_key=True,
)
#.........这里部分代码省略.........
示例5: UpdatePlugin
class UpdatePlugin(Screen, ProtectedScreen):
def __init__(self, session, *args):
Screen.__init__(self, session)
ProtectedScreen.__init__(self)
Screen.setTitle(self, _('Software Update'))
self.sliderPackages = {'ini-dvb-modules': 1,
'enigma2': 2,
'tuxbox-image-info': 3}
self.slider = Slider(0, 4)
self['slider'] = self.slider
self.activityslider = Slider(0, 100)
self['activityslider'] = self.activityslider
self.status = StaticText(_('Please wait...'))
self['status'] = self.status
self.package = StaticText(_('Package list update'))
self['package'] = self.package
self.oktext = _('Press OK on your remote control to continue.')
self['tl_off'] = Pixmap()
self['tl_red'] = Pixmap()
self['tl_yellow'] = Pixmap()
self['tl_green'] = Pixmap()
self['feedStatusMSG'] = Label()
self.channellist_only = 0
self.channellist_name = ''
self.SettingsBackupDone = False
self.ImageBackupDone = False
self.autobackuprunning = False
self.packages = 0
self.error = 0
self.processed_packages = []
self.total_packages = None
self.onFirstExecBegin.append(self.checkNetworkState)
def checkNetworkState(self):
self.trafficLight = feedsstatuscheck.getFeedsBool()
status_msgs = {'stable': _('Feeds status: Stable'),
'unstable': _('Feeds status: Unstable'),
'updating': _('Feeds status: Updating'),
'-2': _('ERROR: No network found'),
'404': _('ERROR: No internet found'),
'inprogress': _('ERROR: Check is already running in background'),
'unknown': _('No connection')}
self['tl_red'].hide()
self['tl_yellow'].hide()
self['tl_green'].hide()
self['tl_off'].hide()
if self.trafficLight:
self['feedStatusMSG'].setText(status_msgs[str(self.trafficLight)])
if self.trafficLight == 'stable':
self['tl_green'].show()
elif self.trafficLight == 'unstable':
self['tl_red'].show()
elif self.trafficLight == 'updating':
self['tl_yellow'].show()
else:
self['tl_off'].show()
if self.trafficLight not in ('stable', 'unstable'):
self.session.openWithCallback(self.close, MessageBox, feedsstatuscheck.getFeedsErrorMessage(), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True)
elif config.softwareupdate.updateisunstable.value == '1' and config.softwareupdate.updatebeta.value or config.softwareupdate.updateisunstable.value == '0':
self.startCheck()
else:
self.session.openWithCallback(self.close, MessageBox, _('Sorry feeds seem to be in an unstable state, if you wish to use them please enable \'Allow unstable (experimental) updates\' in "Software update settings".'), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True)
def startCheck(self):
self.activity = 0
self.activityTimer = eTimer()
self.activityTimer.callback.append(self.doActivityTimer)
self.ipkg = IpkgComponent()
self.ipkg.addCallback(self.ipkgCallback)
self.updating = False
self['actions'] = ActionMap(['WizardActions'], {'ok': self.exit,
'back': self.exit}, -1)
self.updating = True
self.activityTimer.start(100, False)
self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)
def isProtected(self):
return config.ParentalControl.setuppinactive.value and (not config.ParentalControl.config_sections.main_menu.value and not config.ParentalControl.config_sections.configuration.value or hasattr(self.session, 'infobar') and self.session.infobar is None) and config.ParentalControl.config_sections.software_update.value
def doActivityTimer(self):
self.activity += 1
if self.activity == 100:
self.activity = 0
self.activityslider.setValue(self.activity)
def showUpdateCompletedMessage(self):
self.setEndMessage(ngettext('Update completed, %d package was installed.', 'Update completed, %d packages were installed.', self.packages) % self.packages)
def ipkgCallback(self, event, param):
global ocram
if event == IpkgComponent.EVENT_DOWNLOAD:
self.status.setText(_('Downloading'))
elif event == IpkgComponent.EVENT_UPGRADE:
if self.sliderPackages.has_key(param):
self.slider.setValue(self.sliderPackages[param])
self.package.setText(param)
self.status.setText(_('Upgrading') + ': %s/%s' % (self.packages, self.total_packages))
if param not in self.processed_packages:
self.processed_packages.append(param)
#.........这里部分代码省略.........
示例6: UpdatePlugin
class UpdatePlugin(Screen):
skin = """
<screen name="UpdatePlugin" position="center,center" size="550,300">
<widget name="activityslider" position="0,0" size="550,5" />
<widget name="slider" position="0,150" size="550,30" />
<widget source="package" render="Label" position="10,30" size="540,20" font="Regular;18" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
<widget source="status" render="Label" position="10,180" size="540,100" font="Regular;20" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
</screen>"""
def __init__(self, session, *args):
Screen.__init__(self, session)
Screen.setTitle(self, _("Software Update"))
self.sliderPackages = { "dreambox-dvb-modules": 1, "enigma2": 2, "tuxbox-image-info": 3 }
self.setTitle(_("Software update"))
self.slider = Slider(0, 4)
self["slider"] = self.slider
self.activityslider = Slider(0, 100)
self["activityslider"] = self.activityslider
self.status = StaticText(_("Please wait..."))
self["status"] = self.status
self.package = StaticText(_("Package list update"))
self["package"] = self.package
self.oktext = _("Press OK on your remote control to continue.")
self.channellist_only = 0
self.channellist_name = ''
self.SettingsBackupDone = False
self.ImageBackupDone = False
self.autobackuprunning = False
self.packages = 0
self.error = 0
self.processed_packages = []
self.total_packages = None
self.checkNetworkState()
def checkNetworkState(self):
cmd1 = "opkg update"
self.CheckConsole = Console()
self.CheckConsole.ePopen(cmd1, self.checkNetworkStateFinished)
def checkNetworkStateFinished(self, result, retval,extra_args=None):
if result.find('wget returned 1') != -1 or result.find('wget returned 255') != -1 or result.find('404 Not Found') != -1:
self.session.openWithCallback(self.close, MessageBox, _("Sorry feeds are down for maintenance, please try again later."), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True)
elif result.find('bad address') != -1:
self.session.openWithCallback(self.close, MessageBox, _("Your STB_BOX is not connected to the internet, please check your network settings and try again."), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True)
elif result.find('Collected errors') != -1:
self.session.openWithCallback(self.close, MessageBox, _("A background update check is is progress, please wait a few minutes and try again."), type=MessageBox.TYPE_INFO, timeout=10, close_on_any_key=True)
else:
self.startCheck()
def startCheck(self):
self.activity = 0
self.activityTimer = eTimer()
self.activityTimer.callback.append(self.doActivityTimer)
self.ipkg = IpkgComponent()
self.ipkg.addCallback(self.ipkgCallback)
self.updating = False
self["actions"] = ActionMap(["WizardActions"],
{
"ok": self.exit,
"back": self.exit
}, -1)
self.updating = True
self.activityTimer.start(100, False)
self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)
def doActivityTimer(self):
self.activity += 1
if self.activity == 100:
self.activity = 0
self.activityslider.setValue(self.activity)
def showUpdateCompletedMessage(self):
self.setEndMessage(ngettext("Update completed, %d package was installed.", "Update completed, %d packages were installed.", self.packages) % self.packages)
def ipkgCallback(self, event, param):
if event == IpkgComponent.EVENT_DOWNLOAD:
self.status.setText(_("Downloading"))
elif event == IpkgComponent.EVENT_UPGRADE:
if self.sliderPackages.has_key(param):
self.slider.setValue(self.sliderPackages[param])
self.package.setText(param)
self.status.setText(_("Upgrading") + ": %s/%s" % (self.packages, self.total_packages))
if not param in self.processed_packages:
self.processed_packages.append(param)
self.packages += 1
elif event == IpkgComponent.EVENT_INSTALL:
self.package.setText(param)
self.status.setText(_("Installing"))
if not param in self.processed_packages:
self.processed_packages.append(param)
self.packages += 1
elif event == IpkgComponent.EVENT_REMOVE:
#.........这里部分代码省略.........