Quantcast
Channel: [EN] OpenPLi Third-Party Development
Viewing all articles
Browse latest Browse all 1691

Open satfinder in myplugin

$
0
0

Hi Dears

 

I want to open satfinder plugin in myplugin.

 

first method:

def upsatfinder(self):
	if fileExists("/usr/lib/enigma2/python/Plugins/SystemPlugins/Satfinder/plugin.py"):
		from Plugins.SystemPlugins.Satfinder.plugin import Satfinder 
		self.session.open(Satfinder)

But I want a second method to open Satfinder plugin by following function"def SatfinderMain(session, close=None, **kwargs)" in Satfinder plugin

 

How can I do that?

 

thanks

 

Following codes  belong to satfinder plugin. also attached file.

class Satfinder(ScanSetup, ServiceScan):
    """Inherits StaticText [key_red] and [key_green] properties from ScanSetup"""

    def __init__(self, session):
    .
    .
    .
def SatfinderCallback(close, answer):
	if close and answer:
		close(True)

def SatfinderMain(session, close=None, **kwargs):"""I want a second method to open Satfinder plugin by this function"""
	nims = nimmanager.nim_slots
	nimList = []
	for n in nims:
		if not any([n.isCompatible(x) for x in "DVB-S", "DVB-S2"]):
			continue
		if n.config_mode in ("loopthrough", "satposdepends", "nothing"):
			continue
		if n.isCompatible("DVB-S") and n.config_mode in ("advanced", "simple") and len(nimmanager.getSatListForNim(n.slot)) < 1:
			config.Nims[n.slot].configMode.value = "nothing"
			config.Nims[n.slot].configMode.save()
			continue
		nimList.append(n)

	if len(nimList) == 0:
		session.open(MessageBox, _("No Satellite Tuner is configured. Please check your tuner setup."), MessageBox.TYPE_ERROR)
	else:
		session.openWithCallback(boundFunction(SatfinderCallback, close), Satfinder)

def SatfinderStart(menuid, **kwargs):
	if menuid == "scan" and nimmanager.somethingConnected():
		return [(_("Signal finder"), SatfinderMain, "satfinder", None)]
	else:
		return []

def Plugins(**kwargs):
	if any([nimmanager.hasNimType(x) for x in "DVB-S", "DVB-T", "DVB-C", "ATSC"]):
		return PluginDescriptor(name=_("Signal finder"), description=_("Helps setting up your antenna"), where = PluginDescriptor.WHERE_MENU, needsRestart = False, fnc=SatfinderStart)
	else:
		return []

Attached Files


Viewing all articles
Browse latest Browse all 1691

Trending Articles