fix nfs mount problems with latest kernel on some nas systems
[enigma2-plugins.git] / networkbrowser / src / plugin.py
1 # -*- coding: utf-8 -*-
2 # for localized messages
3 from __init__ import _
4
5 from Plugins.Plugin import PluginDescriptor
6 from NetworkBrowser import NetworkBrowser
7 from Components.Network import iNetwork
8 from MountManager import AutoMountManager
9
10 plugin_path = ""
11
12 def NetworkBrowserMain(session, iface = None, **kwargs):
13         session.open(NetworkBrowser,iface, plugin_path)
14
15 def MountManagerMain(session, iface = None, **kwargs):
16         session.open(AutoMountManager, iface, plugin_path)
17
18 def NetworkBrowserCallFunction(iface):
19         interfaceState = iNetwork.getAdapterAttribute(iface, "up")
20         if interfaceState is True:
21                 return NetworkBrowserMain
22         else:
23                 return None
24
25 def MountManagerCallFunction(iface):
26         return MountManagerMain
27
28 def Plugins(path, **kwargs):
29         global plugin_path
30         plugin_path = path
31         return [
32                 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...")}),
33                 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...")})
34         ]
35