Hi guys,
thanks for your attention.
I just remember to say that the skin suggestion is compatible both with current Satfinder and this new patched.
Also, you don't need to patch the skin to use this patched version.
Here follows the patch. I don't know if the default diff options generate your preferred format for patches. If don't, please tell me what flags do you prefer.
Since there's the same code in raw attached, I'll comment the code pasted here inline, so it will make it clear to understand.
All the changes on the following block:
- First of all, a cosmetic change: I moved the __init__ to the top of the class.
- Added a text for
self["introduction"]- Added the key actions used here (block with
self["actions"] = ActionMap(["SetupActions"])
- Moved some common code that should run on screen show to a separated function and added the onShow listener
self.onShow.append(self.__onShow). This function will be seen later.
17a18,43
> def __init__(self, session, feid):
> self.initcomplete = False
> self.feid = feid
> self.oldref = None
> self.frontendData = None
> service = session and session.nav.getCurrentService()
> feinfo = service and service.frontendInfo()
> self.frontendData = feinfo and feinfo.getAll(True)
> del feinfo
> del service
>
> ScanSetup.__init__(self, session)
>
> self["introduction"].setText(_("Press OK to scan"))
> self["Frontend"] = FrontendStatus(frontend_source = lambda : self.frontend, update_interval = 100)
>
> self["actions"] = ActionMap(["SetupActions"],
> {
> "ok": self.keyGoScan,
> "cancel": self.keyCancel,
> }, -3)
>
> self.initcomplete = True
> self.onClose.append(self.__onClose)
> self.onShow.append(self.__onShow)
>
- This block (besides continuing organizing the code), will define the
__onShow function.
It contains all the "
if not self.openFrontend()" block removed from __init__, and added a
retune in the end, to make sure it will tune on the current transponder and set the
self.transponder variable, that will be seen later.
34,44c60
< def __init__(self, session, feid):
< self.initcomplete = False
< self.feid = feid
< self.oldref = None
< self.frontendData = None
< service = session and session.nav.getCurrentService()
< feinfo = service and service.frontendInfo()
< self.frontendData = feinfo and feinfo.getAll(True)
< del feinfo
< del service
<
---
> def __onShow(self):
46,47c62,63
< self.oldref = session.nav.getCurrentlyPlayingServiceReference()
< session.nav.stopService() # try to disable foreground service
---
> self.oldref = self.session.nav.getCurrentlyPlayingServiceReference()
> self.session.nav.stopService() # try to disable foreground service
49,51c65,67
< if session.pipshown: # try to disable pip
< session.pipshown = False
< del session.pip
---
> if self.session.pipshown: # try to disable pip
> self.session.pipshown = False
> del self.session.pip
54,55d69
<
< ScanSetup.__init__(self, session)
57,60c71
< self["introduction"].setText("")
< self["Frontend"] = FrontendStatus(frontend_source = lambda : self.frontend, update_interval = 100)
< self.initcomplete = True
< self.onClose.append(self.__onClose)
---
> self.retune(None)
- Cosmetic changes: The following block will just fix the item order, and will make the predefined transponder easier to read.
71,72d81
< self.typeOfTuningEntry = getConfigListEntry(_('Tune'), self.tuning_type)
< self.list.append(self.typeOfTuningEntry)
74a84,85
> self.typeOfTuningEntry = getConfigListEntry(_('Tune'), self.tuning_type)
> self.list.append(self.typeOfTuningEntry)
87,88d97
< self.list.append(getConfigListEntry(_('Inversion'), self.scan_sat.inversion))
< self.list.append(getConfigListEntry(_('Symbol rate'), self.scan_sat.symbolrate))
89a99,100
> self.list.append(getConfigListEntry(_('Symbol rate'), self.scan_sat.symbolrate))
> self.list.append(getConfigListEntry(_('Inversion'), self.scan_sat.inversion))
204c215,216
< e = str(x[1]) + "," + str(x[2]) + "," + pol + "," + fec
---
> e = "%d %s %d %s" % ((x[1] / 1000), pol, (x[2] / 1000), fec)
>
- The following block will remove the
keyGo function (that overrides a function on ScanSetup.py) and define a
keyGoScan function.
The
keyGoScan will:
- Set current
frontend as None and delete
self.raw_channel, to make sure it will not interfere on ScanSetup later.
- Call
updateSatList from ScanSetup, to set some variables.
- The line on
self.scan_satselection is a little workaround to make ScanSetup recognize the selected satellite. This is due to different variable types and names for the same thing, on both ScanSetup and Satfinder.
- The
setValue block below will fill the
scan_sat values with the current transponder information. This will also apply the values of the predefined TP data over the manual TP, when you try to scan it.
- Then call the
keyGo from ScanSetup.
212,213c224,242
< def keyGo(self):
< self.retune(self.tuning_type)
---
> def keyGoScan(self):
> self.frontend = None
> del self.raw_channel
>
> self.updateSatList()
>
> self.scan_satselection = [ self.tuning_sat ]
>
> self.scan_sat.frequency.setValue(self.transponder[0])
> self.scan_sat.symbolrate.setValue(self.transponder[1])
> self.scan_sat.polarization.setValue(self.transponder[2])
> self.scan_sat.fec.setValue(self.transponder[3])
> self.scan_sat.inversion.setValue(self.transponder[4])
> self.scan_sat.system.setValue(self.transponder[6])
> self.scan_sat.modulation.setValue(self.transponder[7])
> self.scan_sat.rolloff.setValue(self.transponder[8])
> self.scan_sat.pilot.setValue(self.transponder[9])
>
> self.keyGo()
- The two following block will set the
self.transponder in
tune() function. This values are used in the
keyGoScan, that are set for later scanning on
ScanSetup.
- The last line just internationalize the description, addind
_("") around it.
233a263
> self.transponder = transponder
288c318
< return PluginDescriptor(name=_("Satfinder"), description="Helps setting up your dish", where = PluginDescriptor.WHERE_MENU, needsRestart = False, fnc=SatfinderStart)
---
> return PluginDescriptor(name=_("Satfinder"), description=_("Helps setting up your dish"), where = PluginDescriptor.WHERE_MENU, needsRestart = False, fnc=SatfinderStart)
That's it..
I hope you liked it and it could be useful for someone else.
If you want to ask anything about it, I'll be glad to answer and clear it.
Best regards