aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Plugins/Extensions/SocketMMI/plugin.py
blob: 4eadf2ea2e0aa8cd5db63a2fa37224a9c4283ca6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from Plugins.Plugin import PluginDescriptor
from SocketMMI import SocketMMIMessageHandler

socketHandler = None

def main(session, **kwargs):
	socketHandler.startMMI()

def menu(menuid, **kwargs):
	if menuid == "setup" and socketHandler and socketHandler.connected():
		return [(socketHandler.getName(), main, "socket_mmi", 0)]
	return [ ]

def sessionstart(reason, session):
	socketHandler.setSession(session)

def autostart(reason, **kwargs):
	global socketHandler
	if reason == 1:
		socketHandler = None
	else:
		socketHandler = SocketMMIMessageHandler()

def Plugins(**kwargs):
	return [ PluginDescriptor(name = "SocketMMI", description = "Python frontend for /tmp/mmi.socket", where = PluginDescriptor.WHERE_MENU, fnc = menu),
		PluginDescriptor(where = PluginDescriptor.WHERE_SESSIONSTART, fnc = sessionstart),
 		PluginDescriptor(where = PluginDescriptor.WHERE_AUTOSTART, fnc = autostart) ]