from time import localtime, mktime
from datetime import datetime
+from sets import Set
+
def getConfigSatlist(orbpos, satlist):
default_orbpos = None
for x in satlist:
return procFile
class SecConfigure:
+ def getConfiguredSats(self):
+ return self.configuredSatellites
+
+ def addSatellite(self, sec, orbpos):
+ sec.addSatellite(orbpos)
+ self.configuredSatellites.add(orbpos)
+
def addLNBSimple(self, sec, slotid, diseqcmode, toneburstmode = diseqcParam.NO, diseqcpos = diseqcParam.SENDNO, orbpos = 0, longitude = 0, latitude = 0, loDirection = 0, laDirection = 0, turningSpeed = rotorParam.FAST, useInputPower=True, inputPowerDelta=50):
#simple defaults
sec.addLNB()
#print "set orbpos to:" + str(orbpos)
if 0 <= diseqcmode < 3:
- sec.addSatellite(orbpos)
- self.satList.append(orbpos)
+ self.addSatellite(sec, orbpos)
elif (diseqcmode == 3): # diseqc 1.2
if self.satposdepends.has_key(slotid):
tunermask |= (1 << self.satposdepends[slotid])
for x in self.NimManager.satList:
print "Add sat " + str(x[0])
- sec.addSatellite(int(x[0]))
+ self.addSatellite(sec, int(x[0]))
sec.setVoltageMode(0)
sec.setToneMode(0)
sec.setRotorPosNum(0) # USALS
- self.satList.append(int(x[0]))
sec.setLNBSlotMask(tunermask)
print "link tuner", nim1, "to tuner", nim2
sec.setTunerLinked(nim1, nim2)
- def getSatList(self):
- return self.satList
-
def update(self):
sec = secClass.getInstance()
+ self.configuredSatellites = Set()
sec.clear() ## this do unlinking NIMs too !!
print "sec config cleared"
- self.satList = []
self.linked = { }
self.satposdepends = { }
# finally add the orbital positions
for y in lnbSat[x]:
- sec.addSatellite(y)
+ self.addSatellite(sec, y)
currSat = config.Nims[slotid].advanced.sat[y]
if currSat.voltage.value == "polarization":
def __init__(self, nimmgr):
self.NimManager = nimmgr
+ self.configuredSatellites = Set()
self.update()
class NIM(object):
empty = property(lambda self: self.type is None)
class NimManager:
+ def getConfiguredSats(self):
+ return self.sec.getConfiguredSats()
+
def getTransponders(self, pos):
if self.transponders.has_key(pos):
return self.transponders[pos]
def getTerrestrialFlags(self, nim):
return self.terrestrialsList[config.Nims[nim].terrestrial.index][1]
- def getConfiguredSats(self):
- return self.sec.getSatList()
-
def getSatDescription(self, pos):
return self.satellites[pos]
+from enigma import eDVBDB
from Screen import Screen
from Components.ActionMap import ActionMap
from Components.ConfigList import ConfigListScreen
from Components.MenuList import MenuList
from Components.NimManager import nimmanager
from Components.config import getConfigListEntry, config, ConfigNothing
+from Screens.MessageBox import MessageBox
from time import mktime, localtime
from datetime import datetime
dt = datetime(1970, 1, 1, tm.tm_hour, tm.tm_min)
x[1].value = int(mktime(dt.timetuple()))
x[1].save()
+
+ old_configured_sats = nimmanager.getConfiguredSats()
nimmanager.sec.update()
+ new_configured_sats = nimmanager.getConfiguredSats()
+ self.unconfed_sats = old_configured_sats - new_configured_sats
+ self.satpos_to_remove = None
+ self.deleteConfirmed(False)
+
+ def deleteConfirmed(self, confirmed):
+ if confirmed:
+ eDVBDB.getInstance().removeServices(-1, -1, -1, self.satpos_to_remove)
+
+ if self.satpos_to_remove is not None:
+ self.unconfed_sats.remove(self.satpos_to_remove)
+
+ self.satpos_to_remove = None
+ for orbpos in self.unconfed_sats:
+ self.satpos_to_remove = orbpos
+ orbpos = self.satpos_to_remove
+ try:
+ # why we need this cast?
+ sat_name = str(nimmanager.getSatDescription(orbpos))
+ except:
+ if orbpos > 1800: # west
+ orbpos = 3600 - orbpos
+ h = _("W")
+ else:
+ h = _("E")
+ sat_name = ("%d.%d" + h) % (orbpos / 10, orbpos % 10)
+ self.session.openWithCallback(self.deleteConfirmed, MessageBox, _("Delete no more configured satellite\n%s?") %(sat_name))
+ break
def fillListWithAdvancedSatEntrys(self, Sat):
currLnb = self.nimConfig.advanced.lnb[int(Sat.lnb.value)]