use twisted reactor when available
[enigma2.git] / mytest.py
index 42bcd3eefe17fa91ae139b4581ec29afc5634ebd..a9c8197e0e011e31f574dd88222943930c154788 100644 (file)
--- a/mytest.py
+++ b/mytest.py
@@ -16,8 +16,28 @@ from Navigation import Navigation
 from skin import readSkin, applyAllAttributes
 
 from Components.config import configfile
+from Tools.Directories import InitFallbackFiles
+InitFallbackFiles()
+eDVBDB.getInstance().reloadBouquets()
+
+try:
+       from twisted.internet import e2reactor
+       e2reactor.install()
+       
+       from twisted.internet import reactor
+       
+       def runReactor():
+               reactor.run()
+except:
+       def runReactor():
+               runMainloop()
+
+# initialize autorun plugins and plugin menu entries
+from Components.PluginComponent import plugins
+plugins.getPluginList(runAutostartPlugins=True)
 from Screens.Wizard import wizardManager
 from Screens.StartWizard import *
+from Screens.TutorialWizard import *
 from Tools.BoundFunction import boundFunction
 
 had = dict()
@@ -75,8 +95,6 @@ class Session:
 
                if self.currentDialog.isTmp:
                        self.currentDialog.doClose()
-
-                       del self.currentDialog.instance
 #                      dump(self.currentDialog)
                        del self.currentDialog
                else:
@@ -121,6 +139,9 @@ class Session:
                        quitMainloop(5)
                        print '-'*60
                
+               if dlg is None:
+                       return
+
                # read skin data
                readSkin(dlg, None, dlg.skinName, self.desktop)
 
@@ -196,7 +217,7 @@ def runScreenTest():
 
        CONNECT(keyPressedSignal(), session.keyEvent)
        
-       runMainloop()
+       runReactor()
        
        configfile.save()
        
@@ -215,6 +236,12 @@ Components.InputDevice.InitInputDevices()
 import Components.AVSwitch
 Components.AVSwitch.InitAVSwitch()
 
+import Components.RecordingConfig
+Components.RecordingConfig.InitRecordingConfig()
+
+import Components.UsageConfig
+Components.UsageConfig.InitUsageConfig()
+
 import Components.Network
 Components.Network.InitNetwork()
 
@@ -232,6 +259,7 @@ import Components.NimManager
 # first, setup a screen
 try:
        runScreenTest()
+       plugins.getPluginList(runAutoendPlugins=True)
 except:
        print 'EXCEPTION IN PYTHON STARTUP CODE:'
        print '-'*60