sync
[enigma2.git] / mytest.py
index 461fdfa..a3f28d7 100644 (file)
--- a/mytest.py
+++ b/mytest.py
@@ -1,6 +1,7 @@
 from enigma import *
 from tools import *
 
+import traceback
 import Screens.InfoBar
 
 import sys
@@ -10,7 +11,8 @@ import ServiceReference
 
 from Navigation import Navigation
 
-from skin import applyGUIskin
+from skin import readSkin, applyAllAttributes
+
 
 # A screen is a function which instanciates all components of a screen into a temporary component.
 # Thus, the global stuff is a screen, too.
@@ -54,8 +56,8 @@ html = HTMLOutputDevice()
 
 class GUIOutputDevice(OutputDevice):
        parent = None
-       def create(self, comp):
-               comp.createGUIScreen(self.parent)
+       def create(self, comp, desktop):
+               comp.createGUIScreen(self.parent, desktop)
 
 class Session:
        def __init__(self):
@@ -75,7 +77,7 @@ class Session:
                
                        print sys.getrefcount(self.currentDialog)
                        del self.currentDialog.instance
-                       dump(self.currentDialog)
+#                      dump(self.currentDialog)
                        del self.currentDialog
                
                self.popCurrent()
@@ -93,16 +95,28 @@ class Session:
                return screen(self, *arguments)
        
        def instantiateDialog(self, screen, *arguments):
-               dlg = self.create(screen, arguments)
+               # create dialog
+               
+               try:
+                       dlg = self.create(screen, arguments)
+               except:
+                       print 'EXCEPTION IN DIALOG INIT CODE, ABORTING:'
+                       print '-'*60
+                       traceback.print_exc(file=sys.stdout)
+                       quitMainloop()
+                       print '-'*60
+               
+               # read skin data
+               readSkin(dlg, None, dlg.skinName, self.desktop)
+
+               # create GUI view of this dialog
                assert self.desktop != None
                dlg.instance = eWindow(self.desktop)
-
+               applyAllAttributes(dlg.instance, self.desktop, dlg.skinAttributes)
                gui = GUIOutputDevice()
                gui.parent = dlg.instance
-               gui.create(dlg)
-
-               applyGUIskin(dlg, None, dlg.skinName, self.desktop)
-               
+               gui.create(dlg, self.desktop)
+               
                return dlg
         
        def pushCurrent(self):
@@ -153,10 +167,29 @@ def runScreenTest():
 import keymapparser
 keymapparser.readKeymap()
 import skin
-skin.loadSkin()
+skin.loadSkin(getDesktop())
+
+import Components.InputDevice
+Components.InputDevice.InitInputDevices()
+
+import Components.AVSwitch
+Components.AVSwitch.InitAVSwitch()
+
+import Components.Network
+Components.Network.InitNetwork()
+
+import Components.SetupDevices
+Components.SetupDevices.InitSetupDevices()
 
 # first, setup a screen
-runScreenTest()
+try:
+       runScreenTest()
+except:
+       print 'EXCEPTION IN PYTHON STARTUP CODE:'
+       print '-'*60
+       traceback.print_exc(file=sys.stdout)
+       quitMainloop()
+       print '-'*60
 
 # now, run the mainloop