DVDBurn fix capacity report for full dual layer media in Media Toolbox
[enigma2.git] / lib / python / Plugins / Extensions / TuxboxPlugins / pluginrunner.py
1 from enigma import eDBoxLCD, eRCInput, fbClass, eConsoleAppContainer
2 from Screens.Screen import Screen
3 from Screens.MessageBox import MessageBox
4
5 class PluginRunner(Screen):
6         skin = """
7                 <screen position="1,1" size="1,1" title="Plugin" >
8         </screen>"""
9         def __init__(self, session, pluginname, args = None):
10                 self.skin = PluginRunner.skin
11                 Screen.__init__(self, session)
12                 self.container = eConsoleAppContainer()
13                 self.container.appClosed.append(self.finishedExecution)
14                 self.runPlugin(pluginname)
15                 
16         def runPlugin(self, pluginname):
17                 eDBoxLCD.getInstance().lock()
18                 eRCInput.getInstance().lock()
19                 fbClass.getInstance().lock()
20                 print "executing:", ("pluginlauncher -x %s" % pluginname)
21                 if self.container.execute("pluginlauncher -x %s" % pluginname):
22                         self.finishedExecution(None)
23                         
24         def finishedExecution(self, retval = 1):
25                 print "PluginRunner retval:", retval
26                 fbClass.getInstance().unlock()
27                 eRCInput.getInstance().unlock()
28                 eDBoxLCD.getInstance().unlock()
29                 
30                 if retval is None or retval != 1:
31                         self.session.openWithCallback(
32                                 self.finishedExecution,
33                                 MessageBox,
34                                 _("Error executing plugin") % (param)
35                         )
36                 else:
37                         self.close()