-add Networkbrowser and Mountmanager to easy browse network for networkdevices and...
[enigma2-plugins.git] / networkbrowser / src / plugin.py
1 # -*- coding: utf-8 -*-\r
2 # for localized messages\r
3 from __init__ import _\r
4 \r
5 from Plugins.Plugin import PluginDescriptor\r
6 from NetworkBrowser import NetworkBrowser\r
7 from Components.Network import iNetwork\r
8 from MountManager import AutoMountManager\r
9 from os import path\r
10 \r
11 plugin_path = ""\r
12 \r
13 def NetworkBrowserMain(session, iface = None, **kwargs):\r
14         session.open(NetworkBrowser,iface, plugin_path)\r
15 \r
16 def MountManagerMain(session, iface = None, **kwargs):\r
17         session.open(AutoMountManager, iface, plugin_path)\r
18 \r
19 def NetworkBrowserCallFunction(iface):\r
20         interfaceState = iNetwork.getAdapterAttribute(iface, "up")\r
21         if interfaceState is True:\r
22                 return NetworkBrowserMain\r
23         else:\r
24                 return None\r
25 \r
26 def MountManagerCallFunction(iface):\r
27         return MountManagerMain\r
28 \r
29 def Plugins(path, **kwargs):\r
30         global plugin_path\r
31         plugin_path = path\r
32         return [\r
33                 PluginDescriptor(name=_("NetworkBrowser"), description=_("Search for network shares"), where = PluginDescriptor.WHERE_NETWORKSETUP, fnc={"ifaceSupported": NetworkBrowserCallFunction, "menuEntryName": lambda x: _("NetworkBrowser"), "menuEntryDescription": lambda x: _("Search for network shares...")}),\r
34                 PluginDescriptor(name=_("MountManager"), description=_("Manage network shares"), where = PluginDescriptor.WHERE_NETWORKSETUP, fnc={"ifaceSupported": MountManagerCallFunction, "menuEntryName": lambda x: _("MountManager"), "menuEntryDescription": lambda x: _("Manage your network shares...")})\r
35         ]\r
36 \r