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