aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Screens/ImageWizard.py
blob: 148eba52ba85b89f7d162109b266feee5ef3dc3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from Wizard import Wizard, wizardManager

from Tools.Directories import fileExists

import os

backupfile = "backupenigma2settings.tar"

def checkConfigBackup():
	paths = ['/media/hdd/', '/media/cf/']
	for x in paths:
		if fileExists(x + backupfile):
			return x
	return None

if checkConfigBackup() is None:
	backupAvailable = 0
else:
	backupAvailable = 1

class ImageWizard(Wizard):
	skin = """
		<screen position="0,0" size="720,576" title="Welcome..." flags="wfNoBorder">
			<widget name="text" position="50,100" size="440,250" font="Regular;22" />
			<widget name="list" position="50,350" zPosition="1" size="440,200" />
			<widget name="config" position="50,350" zPosition="1" size="440,200" transparent="1" scrollbarMode="showOnDemand" />
		</screen>"""
	
	def __init__(self, session):
		self.xmlfile = "imagewizard.xml"
		
		Wizard.__init__(self, session, showSteps=False, showStepSlider=False, showList=True, showConfig=True)
		
	def markDone(self):
		pass

wizardManager.registerWizard(ImageWizard, backupAvailable)

def doBackup(path):
	os.system('tar cvpf ' + path + backupfile + ' /etc/enigma2')

def doRestore(path):
	os.system('cd / && /bin/tar xvpf ' + path + backupfile)