9 from skin import applyGUIskin
11 # A screen is a function which instanciates all components of a screen into a temporary component.
12 # Thus, the global stuff is a screen, too.
13 # In a screen, components can either be instanciated from the class-tree, cloned (copied) or
14 # "linked" from the instance tree.
15 # A screen itself lives as the container of the components, so a screen is a component, too.
17 # we thus have one (static) hierarchy of screens (classes, not instances)
18 # and one with the instanciated components itself (both global and dynamic)
20 def dump(dir, p = ""):
21 if isinstance(dir, dict):
22 for (entry, val) in dir.items():
23 dump(val, p + "/" + entry)
24 print p + ":" + str(dir.__class__)
35 def create(self, screen): pass
39 class HTMLOutputDevice(OutputDevice):
40 def create(self, comp):
41 print comp.produceHTML()
43 html = HTMLOutputDevice()
45 class GUIOutputDevice(OutputDevice):
47 def create(self, comp):
48 comp.createGUIScreen(self.parent)
53 self.delayTimer = eTimer()
54 self.delayTimer.timeout.get().append(self.processDelay)
56 self.currentDialog = None
58 self.dialogStack = [ ]
60 def processDelay(self):
62 self.currentDialog.doClose()
64 del self.currentDialog
65 del self.currentWindow
67 if len(self.dialogStack):
68 (self.currentDialog, self.currentWindow) = self.dialogStack.pop()
72 self.currentDialog.execBegin()
73 self.currentWindow.show()
76 self.currentDialog.execEnd()
77 self.currentWindow.hide()
79 def create(self, screen, arguments):
80 return screen(self, *arguments)
82 def open(self, screen, *arguments):
83 if self.currentDialog:
84 self.dialogStack.append((self.currentDialog, self.currentWindow))
87 self.currentDialog = self.create(screen, arguments)
89 if self.desktop != None:
90 self.currentWindow = eWindow(self.desktop)
92 gui = GUIOutputDevice()
93 gui.parent = self.currentWindow
94 gui.create(self.currentDialog)
96 applyGUIskin(self.currentDialog, self.currentWindow, None, self.currentDialog.skinName)
100 self.currentWindow = None
102 def keyEvent(self, code):
103 # print "code " + str(code)
105 self.currentDialog["okbutton"].instance.push()
108 self.currentDialog["channelSwitcher"].instance.push()
110 if code >= 0x30 and code <= 0x39:
112 self.currentDialog["menu"].instance.moveSelection(code - 0x31)
114 self.currentDialog["list"].instance.moveSelection(code - 0x31)
117 self.delayTimer.start(0, 1)
121 session.desktop = getDesktop()
123 session.nav = pNavigation()
125 session.open(infoBar)
127 CONNECT(keyPressedSignal(), session.keyEvent)
134 keymapparser.readKeymap()
136 # first, setup a screen
139 # now, run the mainloop