Merge branch 'master' of git.opendreambox.org:/git/enigma2
[enigma2.git] / lib / python / Plugins / SystemPlugins / NFIFlash / plugin.py
1 from Plugins.Plugin import PluginDescriptor
2 from Tools.HardwareInfo import HardwareInfo
3 from Tools.Directories import fileExists
4 from downloader import NFIDownload, filescan
5
6 def NFIFlasherMain(session, tmp = None, **kwargs):
7         session.open(NFIDownload, "/home/root" )
8
9 def NFICallFnc(tmp = None):
10         return NFIFlasherMain
11
12 def Plugins(**kwargs):
13         # currently only available for DM8000
14         if HardwareInfo().get_device_name() != "dm8000":
15                 return [PluginDescriptor()]
16         if fileExists("/usr/share/bootlogo-flasher.mvi"):
17                 import flasher
18                 # started from usb stick # don't try to be intelligent and trick this - it's not possible to rewrite the flash memory with a system currently booted from it
19                 return [PluginDescriptor(where = PluginDescriptor.WHERE_WIZARD, fnc = (9,flasher.NFIFlash))]
20         else:
21                 # started on real enigma2
22                 return [PluginDescriptor(name=_("NFI Image Flashing"),
23                         description=_("Download .NFI-Files for USB-Flasher"),
24                         icon = "flash.png",
25                         where = PluginDescriptor.WHERE_SOFTWAREMANAGER,
26                         fnc={"SoftwareSupported": NFICallFnc, "menuEntryName": lambda x: _("NFI Image Flashing"),
27                              "menuEntryDescription": lambda x: _("Download .NFI-Files for USB-Flasher")}),
28                         PluginDescriptor(name="nfi", where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan)]