aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Screens/DefaultWizard.py
blob: 5d274b0eb556199b60f0e30260926e958a8f1fc5 (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
47
48
49
from Wizard import Wizard, wizardManager
from Tools.Directories import crawlDirectory, resolveFilename, SCOPE_DEFAULTDIR

from Components.Pixmap import Pixmap, MovingPixmap
from Components.config import config, ConfigBoolean, configfile
from Components.DreamInfoHandler import DreamInfoHandler, InfoHandler, InfoHandlerParseError
import os

config.misc.defaultchosen = ConfigBoolean(default = True)

import xml.sax

class DefaultWizard(Wizard, DreamInfoHandler):
	def __init__(self, session):
		DreamInfoHandler.__init__(self, self.statusCallback)
		self.directory = resolveFilename(SCOPE_DEFAULTDIR)
		self.xmlfile = "defaultwizard.xml"
        
		Wizard.__init__(self, session, showSteps = False)
		self["wizard"] = Pixmap()
		self["rc"] = MovingPixmap()
		self["arrowdown"] = MovingPixmap()
		self["arrowup"] = MovingPixmap()
		self["arrowup2"] = MovingPixmap()
        
	def markDone(self):
		config.misc.defaultchosen.value = 0
		config.misc.defaultchosen.save()
		configfile.save()
		
	def statusCallback(self, status, progress):
		print "statusCallback:", status, progress
		if status == DreamInfoHandler.STATUS_DONE:
			self["text"].setText(_("Finished"))
			self.markDone()
			os.system("killall -9 enigma2")

	def listDefaults(self):
		self.packageslist = []
		self.fillPackagesList()
		list = []
		for x in range(len(self.packageslist)):
			list.append((self.packageslist[x][0]["attributes"]["name"], str(x)))
		print "defaults list:", list
		return list
    
	def selectionMade(self, index):
		print "selected:", index
		self.installPackage(int(index))