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