Merge branch 'master' of fraxinas@git.opendreambox.org:/git/enigma2
[enigma2.git] / lib / python / Plugins / Extensions / SocketMMI / plugin.py
1 from Plugins.Plugin import PluginDescriptor
2 from SocketMMI import SocketMMIMessageHandler
3
4 socketHandler = None
5
6 def main(session, **kwargs):
7         socketHandler.startMMI()
8
9 def menu(menuid, **kwargs):
10         if menuid == "setup" and socketHandler and socketHandler.connected():
11                 return [(socketHandler.getName(), main, "socket_mmi", 0)]
12         return [ ]
13
14 def sessionstart(reason, session):
15         socketHandler.setSession(session)
16
17 def autostart(reason, **kwargs):
18         global socketHandler
19         if reason == 1:
20                 socketHandler = None
21         else:
22                 socketHandler = SocketMMIMessageHandler()
23
24 def Plugins(**kwargs):
25         return [ PluginDescriptor(name = "SocketMMI", description = _("Python frontend for /tmp/mmi.socket"), where = PluginDescriptor.WHERE_MENU, fnc = menu),
26                 PluginDescriptor(where = PluginDescriptor.WHERE_SESSIONSTART, fnc = sessionstart),
27                 PluginDescriptor(where = PluginDescriptor.WHERE_AUTOSTART, fnc = autostart) ]