aboutsummaryrefslogtreecommitdiff
path: root/screens.py
blob: 9148f25f7e6a1d794b830023ca2cfc7dabc8c20e (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
from components import *
import sys

# some screens
def doGlobal(screen):
	screen["clock"] = Clock()

class Screen(dict, HTMLSkin, GUISkin):
	""" bla """
	
	# never call this directly - it will be called from the session!
	def doClose(self):
		GUISkin.close(self)
	
	def close(self, retval=None):
		self.session.close()
	
class mainMenu(Screen):
	
	def goEmu(self):
		self["title"].setText("EMUs ARE ILLEGAL AND NOT SUPPORTED!")
	
	def goTimeshift(self):
		self["title"].setText("JUST PRESS THE YELLOW BUTTON!")
	
	def goHDTV(self):
		self["title"].setText("HDTV GREEN FLASHES: ENABLED")
	
	def goClock(self):
		self.session.open(clockDisplay(Clock()))

	def okbuttonClick(self):
		selection = self["menu"].getCurrent()
		selection[1]()

	def __init__(self):
		GUISkin.__init__(self)
		b = Button("ok")

		b.onClick = [ self.okbuttonClick ]
		self["okbutton"] = b
		self["title"] = Header("Main Menu! - press ok to leave!")
		self["menu"] = MenuList(
			[
				("EMU SETUP", self.goEmu),
				("TIMESHIFT SETUP", self.goTimeshift),
				("HDTV PIP CONFIG", self.goHDTV),
				("wie spaet ists?!", self.goClock)
			])

#class mainMenu(Screen):
#	def __init__(self):
#		GUISkin.__init__(self)
#		
#		self["title"] = Header("this is the\nMAIN MENU !!!");
#		self["okbutton"] = Button("ok")
#		self["okbutton"].onClick = [ self.close ]

class channelSelection(Screen):
	def __init__(self):
		GUISkin.__init__(self)
		
		self["list"] = ServiceList()
		self["list"].setRoot(eServiceReference("1:0:1:0:0:0:0:0:0:0:PREMIERE"))
		
		self["okbutton"] = Button("ok", [self.channelSelected, self.close])

	def channelSelected(self):
#		print "channel selected!"
		pass

class infoBar(Screen):
	def __init__(self):
		GUISkin.__init__(self)
		
		self["channelSwitcher"] = Button("switch Channel", [self.switchChannel])
		self["okbutton"] = Button("mainMenu", [self.mainMenu])
	
	def mainMenu(self):
		self.session.open(mainMenu())
		
	def switchChannel(self):
		self.session.open(channelSelection())

# a clock display dialog
class clockDisplay(Screen):
	def okbutton(self):
		self.session.close()
	
	def __init__(self, clock):
		GUISkin.__init__(self)
		self["theClock"] = clock
		b = Button("bye")
		b.onClick = [ self.okbutton ]
		self["okbutton"] = b
		self["title"] = Header("clock dialog: here you see the current uhrzeit!")