do not crash when attributes are not present; replace by defaults instead
[enigma2.git] / lib / python / Screens / ImageWizard.py
1 from Wizard import Wizard, wizardManager
2
3 from Tools.Directories import fileExists
4
5 import os
6
7 backupfile = "backupenigma2settings.tar"
8
9 def checkConfigBackup():
10         paths = ['/media/hdd/', '/media/cf/']
11         for x in paths:
12                 if fileExists(x + backupfile):
13                         return x
14         return None
15
16 if checkConfigBackup() is None:
17         backupAvailable = 0
18 else:
19         backupAvailable = 1
20
21 class ImageWizard(Wizard):
22         skin = """
23                 <screen position="0,0" size="720,576" title="Welcome..." flags="wfNoBorder">
24                         <widget name="text" position="50,100" size="440,250" font="Regular;22" />
25                         <widget name="list" position="50,350" zPosition="1" size="440,200" />
26                         <widget name="config" position="50,350" zPosition="1" size="440,200" transparent="1" scrollbarMode="showOnDemand" />
27                 </screen>"""
28         
29         def __init__(self, session):
30                 self.xmlfile = "imagewizard.xml"
31                 
32                 Wizard.__init__(self, session, showSteps=False, showStepSlider=False, showList=True, showConfig=True)
33                 
34         def markDone(self):
35                 pass
36
37 wizardManager.registerWizard(ImageWizard, backupAvailable, priority = 10)
38
39 def doBackup(path):
40         os.system('tar cvpf ' + path + backupfile + ' /etc/enigma2')
41
42 def doRestore(path):
43         os.system('cd / && /bin/tar xvpf ' + path + backupfile)
44         
45
46