示例#1
0
 def __init__(self, session):
     self.softcam = CamControl("softcam")
     self.ecminfo = GetEcmInfo()
     config.misc.softcams.value == ""
     Setup.__init__(self, session=session, setup="softcamscriptsetup")
     self["key_yellow"] = StaticText()
     self["key_blue"] = StaticText()
     self["restartActions"] = HelpableActionMap(
         self, ["ColorActions"], {
             "yellow":
             (self.restart, _("Immediately restart selected cams."))
         },
         prio=0,
         description=_("Softcam Actions"))
     self["restartActions"].setEnabled(False)
     self["infoActions"] = HelpableActionMap(
         self, ["ColorActions"],
         {"blue": (self.softcamInfo, _("Display oscam information."))},
         prio=0,
         description=_("Softcam Actions"))
     self["infoActions"].setEnabled(False)
     (newEcmFound, ecmInfo) = self.ecminfo.getEcm()
     self["info"] = ScrollLabel("".join(ecmInfo))
     self.EcmInfoPollTimer = eTimer()
     self.EcmInfoPollTimer.callback.append(self.setEcmInfo)
     self.EcmInfoPollTimer.start(1000)
     self.onShown.append(self.updateButtons)
示例#2
0
    def __init__(self, session):
        Screen.__init__(self, session)

        self.setup_title = _("Softcam setup")
        self.setTitle(self.setup_title)

        self["actions"] = ActionMap(
            ["OkCancelActions", "ColorActions", "CiSelectionActions"], {
                "cancel": self.cancel,
                "green": self.save,
                "red": self.cancel,
                "blue": self.ppanelShortcut,
            }, -1)

        self.list = []
        ConfigListScreen.__init__(self,
                                  self.list,
                                  session=session,
                                  on_change=self.changedEntry)

        self.softcam = CamControl('softcam')
        self.cardserver = CamControl('cardserver')

        self.ecminfo = GetEcmInfo()
        (newEcmFound, ecmInfo) = self.ecminfo.getEcm()
        self["info"] = ScrollLabel("".join(ecmInfo))
        self.EcmInfoPollTimer = eTimer()
        self.EcmInfoPollTimer.callback.append(self.setEcmInfo)
        self.EcmInfoPollTimer.start(1000)

        softcams = self.softcam.getList()
        cardservers = self.cardserver.getList()

        self.softcams = ConfigSelection(choices=softcams)
        self.softcams.value = self.softcam.current()

        self.softcams_text = _("Select Softcam")
        self.list.append(getConfigListEntry(self.softcams_text, self.softcams))
        if cardservers:
            self.cardservers = ConfigSelection(choices=cardservers)
            self.cardservers.value = self.cardserver.current()
            self.list.append(
                getConfigListEntry(_("Select Card Server"), self.cardservers))

        self.list.append(
            getConfigListEntry(_("Restart softcam"),
                               ConfigAction(self.restart, "s")))
        if cardservers:
            self.list.append(
                getConfigListEntry(_("Restart cardserver"),
                                   ConfigAction(self.restart, "c")))
            self.list.append(
                getConfigListEntry(_("Restart both"),
                                   ConfigAction(self.restart, "sc")))

        self["key_red"] = StaticText(_("Cancel"))
        self["key_green"] = StaticText(_("OK"))
        self["key_blue"] = StaticText()
        self.onShown.append(self.blueButton)
示例#3
0
 def __init__(self, session):
     self.softcam = CamControl("softcam")
     self.cardserver = CamControl("cardserver")
     self.ecminfo = GetEcmInfo()
     restartOptions = [("", _("Don't restart")),
                       ("s", _("Restart softcam"))]
     defaultrestart = ""
     softcams = self.softcam.getList()
     defaultsoftcam = self.softcam.current()
     if len(softcams) > 1:
         defaultrestart = "s"
     else:
         softcams = [("", _("None"))]
         defaultsoftcam = ""
     config.misc.softcams = ConfigSelection(default=defaultsoftcam,
                                            choices=softcams)
     cardservers = self.cardserver.getList()
     defaultcardserver = self.cardserver.current()
     if len(cardservers) > 1:
         restartOptions.extend([("c", _("Restart cardserver")),
                                ("sc", _("Restart both"))])
         defaultrestart += "c"
     else:
         cardservers = [("", _("None"))]
         defaultcardserver = ""
     config.misc.cardservers = ConfigSelection(default=defaultcardserver,
                                               choices=cardservers)
     config.misc.restarts = ConfigSelection(default=defaultrestart,
                                            choices=restartOptions)
     Setup.__init__(self, session=session, setup="Softcam")
     self["key_yellow"] = StaticText()
     self["key_blue"] = StaticText()
     self["restartActions"] = HelpableActionMap(
         self, ["ColorActions"], {
             "yellow":
             (self.restart, _("Immediately restart selected devices."))
         },
         prio=0,
         description=_("Softcam Actions"))
     self["restartActions"].setEnabled(False)
     self["infoActions"] = HelpableActionMap(
         self, ["ColorActions"],
         {"blue": (self.softcamInfo, _("Display oscam information."))},
         prio=0,
         description=_("Softcam Actions"))
     self["infoActions"].setEnabled(False)
     (newEcmFound, ecmInfo) = self.ecminfo.getEcm()
     self["info"] = ScrollLabel("".join(ecmInfo))
     self.EcmInfoPollTimer = eTimer()
     self.EcmInfoPollTimer.callback.append(self.setEcmInfo)
     self.EcmInfoPollTimer.start(1000)
     self.onShown.append(self.updateButtons)
示例#4
0
	def __init__(self, session):
		Screen.__init__(self, session)

		self.setup_title = _("Softcam setup")
		self.setTitle(self.setup_title)

		self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "CiSelectionActions"],
			{
				"cancel": self.cancel,
				"green": self.save,
				"red": self.cancel,
				"blue": self.ppanelShortcut,
			},-1)

		self.list = [ ]
		ConfigListScreen.__init__(self, self.list, session = session, on_change = self.changedEntry)

		self.softcam = CamControl('softcam')
		self.cardserver = CamControl('cardserver')

		self.ecminfo = GetEcmInfo()
		(newEcmFound, ecmInfo) = self.ecminfo.getEcm()
		self["info"] = ScrollLabel("".join(ecmInfo))
		self.EcmInfoPollTimer = eTimer()
		self.EcmInfoPollTimer.callback.append(self.setEcmInfo)
		self.EcmInfoPollTimer.start(1000)

		softcams = self.softcam.getList()
		cardservers = self.cardserver.getList()

		self.softcams = ConfigSelection(choices = softcams)
		self.softcams.value = self.softcam.current()

		self.softcams_text = _("Select Softcam")
		self.list.append(getConfigListEntry(self.softcams_text, self.softcams))
		if cardservers:
			self.cardservers = ConfigSelection(choices = cardservers)
			self.cardservers.value = self.cardserver.current()
			self.list.append(getConfigListEntry(_("Select Card Server"), self.cardservers))

		self.list.append(getConfigListEntry(_("Restart softcam"), ConfigAction(self.restart, "s")))
		if cardservers:
			self.list.append(getConfigListEntry(_("Restart cardserver"), ConfigAction(self.restart, "c")))
			self.list.append(getConfigListEntry(_("Restart both"), ConfigAction(self.restart, "sc")))

		self["key_red"] = StaticText(_("Cancel"))
		self["key_green"] = StaticText(_("OK"))
		self["key_blue"] = StaticText()
		self.onShown.append(self.blueButton)
示例#5
0
	def createMenu(self):
		try:
			test = self.index
		except:
			return
		self.list = []
		if self.index == self.STATE_UPDATE:
			if config.misc.installwizard.hasnetwork.value:
				self.list.append(getConfigListEntry(_("Your internet connection is working (ip: %s)") % (self.ipConfigEntry.getText()), self.enabled))
			else:
				self.list.append(getConfigListEntry(_("Your receiver does not have an internet connection"), self.enabled))
		elif self.index == self.STATE_CHOISE_CHANNELLIST:
			self.list.append(getConfigListEntry(_("Install channel list"), self.enabled))
			if self.enabled.value:
				self.list.append(getConfigListEntry(_("Channel list type"), self.channellist_type))
		elif self.index == self.STATE_CHOISE_SOFTCAM:
			self.list.append(getConfigListEntry(_("Install softcam"), self.enabled))
			if self.enabled.value:
				self.list.append(getConfigListEntry(_("Softcam type"), self.softcam_type))
		elif self.index == self.STATE_RUN_SOFTCAM:
			self.softcam = CamControl('softcam')
			softcams = self.softcam.getList()
			for scam in softcams:  
				self.list.append(getConfigListEntry(_(scam), self.softcams))
		self["config"].list = self.list
		self["config"].l.setList(self.list)
示例#6
0
def hassoftcaminstalled():
    from Tools.camcontrol import CamControl
    return len(CamControl('softcam').getList()) > 1
示例#7
0
class SoftcamSetup(Screen, ConfigListScreen):
    skin = """
	<screen name="SoftcamSetup" position="center,center" size="560,550" >
		<widget name="config" position="5,10" size="550,180" />
		<widget name="info" position="5,200" size="550,340" font="Fixed;18" />
		<ePixmap name="red" position="0,510" zPosition="1" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
		<ePixmap name="green" position="140,510" zPosition="1" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
		<widget objectTypes="key_red,StaticText" source="key_red" render="Label" position="0,510" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
		<widget objectTypes="key_green,StaticText" source="key_green" render="Label" position="140,510" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
		<widget objectTypes="key_blue,StaticText" source="key_blue" render="Label"  position="420,510" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1"/>
		<widget objectTypes="key_blue,StaticText" source="key_blue" render="Pixmap" pixmap="skin_default/buttons/blue.png"  position="420,510" zPosition="1" size="140,40" transparent="1" alphatest="on">
			<convert type="ConditionalShowHide"/>
		</widget>
	</screen>"""

    def __init__(self, session):
        Screen.__init__(self, session)

        self.setup_title = _("Softcam setup")
        self.setTitle(self.setup_title)

        self["actions"] = ActionMap(
            ["OkCancelActions", "ColorActions", "CiSelectionActions"], {
                "red": self.cancel,
                "green": self.save,
                "blue": self.cancel,
                "cancel": self.cancel,
            }, -1)

        self.list = []
        ConfigListScreen.__init__(self,
                                  self.list,
                                  session=session,
                                  on_change=self.changedEntry)

        self.softcam = CamControl('softcam')
        self.cardserver = CamControl('cardserver')
        self.softcams_text = ""
        self.ecminfo = GetEcmInfo()
        (newEcmFound, ecmInfo) = self.ecminfo.getEcm()
        self["info"] = ScrollLabel("".join(ecmInfo))
        self.EcmInfoPollTimer = eTimer()
        self.EcmInfoPollTimer.callback.append(self.setEcmInfo)
        self.EcmInfoPollTimer.start(1000)

        softcams = self.softcam.getList()
        cardservers = self.cardserver.getList()
        if softcams:
            self.softcams = ConfigSelection(choices=softcams)
            self.softcams.value = self.softcam.current()
            self.softcams_text = _("Select Softcam")
            self.list.append(
                getConfigListEntry(self.softcams_text, self.softcams))

        if cardservers:
            self.cardservers = ConfigSelection(choices=cardservers)
            self.cardservers.value = self.cardserver.current()
            self.list.append(
                getConfigListEntry(_("Select Card Server"), self.cardservers))

        if cardservers and softcams:
            self.list.append(
                getConfigListEntry(_("Restart both"),
                                   ConfigAction(self.restart, "sc")))
        elif softcams:
            self.list.append(
                getConfigListEntry(_("Restart softcam"),
                                   ConfigAction(self.restart, "s")))
        else:
            self.list.append(
                getConfigListEntry(_("Restart cardserver"),
                                   ConfigAction(self.restart, "c")))

        self["key_red"] = StaticText(_("Cancel"))
        self["key_green"] = StaticText(_("OK"))
        self["key_blue"] = StaticText()
        self.onShown.append(self.blueButton)

    def changedEntry(self):
        if self["config"].getCurrent()[0] == self.softcams_text:
            self.blueButton()

    def blueButton(self):
        if self.softcams.value and self.softcams.value.lower() != "none":
            self["key_blue"].setText(_("Info"))
        else:
            self["key_blue"].setText("")

    def setEcmInfo(self):
        (newEcmFound, ecmInfo) = self.ecminfo.getEcm()
        if newEcmFound:
            self["info"].setText("".join(ecmInfo))

    def restart(self, what):
        self.what = what
        if "s" in what:
            if "c" in what:
                msg = _("Please wait, restarting softcam and cardserver.")
            else:
                msg = _("Please wait, restarting softcam.")
        elif "c" in what:
            msg = _("Please wait, restarting cardserver.")
        self.mbox = self.session.open(MessageBox, msg, MessageBox.TYPE_INFO)
        self.activityTimer = eTimer()
        self.activityTimer.timeout.get().append(self.doStop)
        self.activityTimer.start(100, False)

    def doStop(self):
        self.activityTimer.stop()
        if "c" in self.what:
            self.cardserver.command('stop')
        if "s" in self.what:
            self.softcam.command('stop')
        self.oldref = self.session.nav.getCurrentlyPlayingServiceOrGroup()
        self.session.nav.stopService()
        self.activityTimer = eTimer()
        self.activityTimer.timeout.get().append(self.doStart)
        self.activityTimer.start(1000, False)

    def doStart(self):
        self.activityTimer.stop()
        del self.activityTimer
        if "c" in self.what:
            self.cardserver.select(self.cardservers.value)
            self.cardserver.command('start')
        if "s" in self.what:
            self.softcam.select(self.softcams.value)
            self.softcam.command('start')
        if self.mbox:
            self.mbox.close()
        self.close()
        self.session.nav.playService(self.oldref, adjust=False)

    def restartCardServer(self):
        if hasattr(self, 'cardservers'):
            self.restart("c")

    def restartSoftcam(self):
        self.restart("s")

    def save(self):
        what = ''
        if hasattr(self, 'cardservers') and (self.cardservers.value !=
                                             self.cardserver.current()):
            what = 'sc'
        elif self.softcams.value != self.softcam.current():
            what = 's'
        if what:
            self.restart(what)
        else:
            self.close()

    def cancel(self):
        self.close()
示例#8
0
class SoftcamSetup(Screen, ConfigListScreen):
    if getDesktop(0).size().width() == 1280:
        skin = """
		<screen name="SoftcamSetup" position="center,center" size="560,550" >
			<widget name="config" position="5,10" size="550,180" />
			<widget name="info" position="5,200" size="550,340" font="Fixed;18" />
			<ePixmap name="red" position="0,510" zPosition="1" size="140,40" pixmap="buttons/red.png" transparent="1" alphatest="on" />
			<ePixmap name="green" position="140,510" zPosition="1" size="140,40" pixmap="buttons/green.png" transparent="1" alphatest="on" />
			<widget objectTypes="key_red,StaticText" source="key_red" render="Label" position="0,510" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
			<widget objectTypes="key_green,StaticText" source="key_green" render="Label" position="140,510" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
			<widget objectTypes="key_blue,StaticText" source="key_blue" render="Label"  position="420,510" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1"/>
			<widget objectTypes="key_blue,StaticText" source="key_blue" render="Pixmap" pixmap="buttons/blue.png"  position="420,510" zPosition="1" size="140,40" transparent="1" alphatest="on">
				<convert type="ConditionalShowHide"/>
			</widget>
		</screen>"""
    else:
        skin = """
		<screen name="SoftcamSetup" position="485,center" size="951,860" >
			<widget name="config" position="5,10" size="941,180" font="Fixed;28" itemHeight="32" />
			<widget name="info" position="5,200" size="941,500" font="Fixed;32" />
			<ePixmap name="red" position="0,819" zPosition="1" size="140,40" pixmap="buttons/red.png" transparent="1" alphatest="on" />
			<ePixmap name="green" position="140,819" zPosition="1" size="141,40" pixmap="buttons/green.png" transparent="1" alphatest="on" />
			<widget objectTypes="key_red,StaticText" source="key_red" render="Label" position="0,819" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;28" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
			<widget objectTypes="key_green,StaticText" source="key_green" render="Label" position="140,819" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;28" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
			<widget objectTypes="key_blue,StaticText" source="key_blue" render="Label"  position="809,819" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;28" transparent="1" shadowColor="black" shadowOffset="-1,-1"/>
			<widget objectTypes="key_blue,StaticText" source="key_blue" render="Pixmap" pixmap="buttons/blue.png"  position="809,819" zPosition="1" size="140,40" transparent="1" alphatest="on">
				<convert type="ConditionalShowHide"/>
			</widget>
		</screen>"""

    def __init__(self, session):
        Screen.__init__(self, session)

        self.setup_title = _("Softcam setup")
        self.setTitle(self.setup_title)

        self["actions"] = ActionMap(
            ["OkCancelActions", "ColorActions", "CiSelectionActions"], {
                "cancel": self.cancel,
                "green": self.save,
                "red": self.cancel,
                "blue": self.ppanelShortcut,
            }, -1)

        self.list = []
        ConfigListScreen.__init__(self,
                                  self.list,
                                  session=session,
                                  on_change=self.changedEntry)

        self.softcam = CamControl('softcam')
        self.cardserver = CamControl('cardserver')

        self.ecminfo = GetEcmInfo()
        (newEcmFound, ecmInfo) = self.ecminfo.getEcm()
        self["info"] = ScrollLabel("".join(ecmInfo))
        self.EcmInfoPollTimer = eTimer()
        self.EcmInfoPollTimer.callback.append(self.setEcmInfo)
        self.EcmInfoPollTimer.start(1000)

        softcams = self.softcam.getList()
        cardservers = self.cardserver.getList()

        self.softcams = ConfigSelection(choices=softcams)
        self.softcams.value = self.softcam.current()

        self.softcams_text = _("Select Softcam")
        self.list.append(getConfigListEntry(self.softcams_text, self.softcams))
        if cardservers:
            self.cardservers = ConfigSelection(choices=cardservers)
            self.cardservers.value = self.cardserver.current()
            self.list.append(
                getConfigListEntry(_("Select Card Server"), self.cardservers))

        self.list.append(
            getConfigListEntry(_("Restart softcam"),
                               ConfigAction(self.restart, "s")))
        if cardservers:
            self.list.append(
                getConfigListEntry(_("Restart cardserver"),
                                   ConfigAction(self.restart, "c")))
            self.list.append(
                getConfigListEntry(_("Restart both"),
                                   ConfigAction(self.restart, "sc")))

        self["key_red"] = StaticText(_("Cancel"))
        self["key_green"] = StaticText(_("OK"))
        self["key_blue"] = StaticText()
        self.onShown.append(self.blueButton)

    def changedEntry(self):
        if self["config"].getCurrent()[0] == self.softcams_text:
            self.blueButton()

    def blueButton(self):
        if self.softcams.value and self.softcams.value.lower() != "none":
            self["key_blue"].setText(_("Info"))
        else:
            self["key_blue"].setText("")

    def setEcmInfo(self):
        (newEcmFound, ecmInfo) = self.ecminfo.getEcm()
        if newEcmFound:
            self["info"].setText("".join(ecmInfo))

    def ppanelShortcut(self):
        ppanelFileName = '/etc/ppanels/' + self.softcams.value + '.xml'
        if "oscam" or "ncam" in self.softcams.value.lower():
            from Screens.OScamInfo import OscamInfoMenu
            self.session.open(OscamInfoMenu)
        elif "cccam" in self.softcams.value.lower() and os.path.isfile(
                resolveFilename(
                    SCOPE_PLUGINS,
                    'Extensions/CCcamInfo/plugin.pyo')) or os.path.isfile(
                        resolveFilename(SCOPE_PLUGINS,
                                        'Extensions/CCcamInfo/plugin.py')):
            from Plugins.Extensions.CCcamInfo.plugin import CCcamInfoMain
            self.session.open(CCcamInfoMain)
        elif os.path.isfile(ppanelFileName) and os.path.isfile(
                resolveFilename(
                    SCOPE_PLUGINS,
                    'Extensions/PPanel/plugin.pyo')) or os.path.isfile(
                        resolveFilename(SCOPE_PLUGINS,
                                        'Extensions/PPanel/plugin.py')):
            from Plugins.Extensions.PPanel.ppanel import PPanel
            self.session.open(PPanel,
                              name=self.softcams.value + ' PPanel',
                              node=None,
                              filename=ppanelFileName,
                              deletenode=None)
        else:
            return 0

    def restart(self, what):
        self.what = what
        if "s" in what:
            if "c" in what:
                msg = _("Please wait, restarting softcam and cardserver.")
            else:
                msg = _("Please wait, restarting softcam.")
        elif "c" in what:
            msg = _("Please wait, restarting cardserver.")
        self.mbox = self.session.open(MessageBox, msg, MessageBox.TYPE_INFO)
        self.activityTimer = eTimer()
        self.activityTimer.timeout.get().append(self.doStop)
        self.activityTimer.start(100, False)

    def doStop(self):
        self.activityTimer.stop()
        if "c" in self.what:
            self.cardserver.command('stop')
        if "s" in self.what:
            self.softcam.command('stop')
        self.oldref = self.session.nav.getCurrentlyPlayingServiceOrGroup()
        self.session.nav.stopService()
        self.activityTimer = eTimer()
        self.activityTimer.timeout.get().append(self.doStart)
        self.activityTimer.start(1000, False)

    def doStart(self):
        self.activityTimer.stop()
        del self.activityTimer
        if "c" in self.what:
            self.cardserver.select(self.cardservers.value)
            self.cardserver.command('start')
        if "s" in self.what:
            self.softcam.select(self.softcams.value)
            self.softcam.command('start')
        if self.mbox:
            self.mbox.close()
        self.close()
        self.session.nav.playService(self.oldref, adjust=False)

    def restartCardServer(self):
        if hasattr(self, 'cardservers'):
            self.restart("c")

    def restartSoftcam(self):
        self.restart("s")

    def save(self):
        what = ''
        if hasattr(self, 'cardservers') and (self.cardservers.value !=
                                             self.cardserver.current()):
            what = 'sc'
        elif self.softcams.value != self.softcam.current():
            what = 's'
        if what:
            self.restart(what)
        else:
            self.close()

    def cancel(self):
        self.close()
示例#9
0
    def __init__(self, session):
        Screen.__init__(self, session)

        self.setup_title = _("Softcam setup")
        self.setTitle(self.setup_title)

        self["actions"] = ActionMap(
            ["OkCancelActions", "ColorActions", "CiSelectionActions"], {
                "cancel": self.cancel,
                "green": self.save,
                "red": self.cancel,
                "blue": self.ppanelShortcut,
            }, -1)

        self.list = []
        ConfigListScreen.__init__(self,
                                  self.list,
                                  session=session,
                                  on_change=self.changedEntry)

        self.softcam = CamControl('softcam')
        self.cardserver = CamControl('cardserver')

        self.ecminfo = GetEcmInfo()
        (newEcmFound, ecmInfo) = self.ecminfo.getEcm()
        self["info"] = ScrollLabel("".join(ecmInfo))
        self.EcmInfoPollTimer = eTimer()
        self.EcmInfoPollTimer.callback.append(self.setEcmInfo)
        self.EcmInfoPollTimer.start(1000)

        softcams = self.softcam.getList()
        cardservers = self.cardserver.getList()

        self.softcams = ConfigSelection(choices=softcams)
        self.softcams.value = self.softcam.current()

        self.softcams_text = _("Select Softcam")
        self.list.append(getConfigListEntry(self.softcams_text, self.softcams))
        if cardservers:
            self.cardservers = ConfigSelection(choices=cardservers)
            self.cardservers.value = self.cardserver.current()
            self.list.append(
                getConfigListEntry(_("Select Card Server"), self.cardservers))

        self.list.append(
            getConfigListEntry(_("Restart softcam"),
                               ConfigAction(self.restart, "s")))
        if cardservers:
            self.list.append(
                getConfigListEntry(_("Restart cardserver"),
                                   ConfigAction(self.restart, "c")))
            self.list.append(
                getConfigListEntry(_("Restart both"),
                                   ConfigAction(self.restart, "sc")))

        softcams = listdir('/usr/bin/')
        for softcam in softcams:
            if softcam.startswith('CCcam') or softcam.startswith('cccam'):
                config.plugins.softcam.cccaminfo.value = True
            elif softcam.startswith('OScam') or softcam.startswith('oscam'):
                config.plugins.softcam.oscaminfo.value = True
            elif softcam.startswith('Ncam') or softcam.startswith('ncam'):
                config.plugins.softcam.ncaminfo.value = True

        if config.plugins.softcam.cccaminfo.value:
            self.list.append(
                getConfigListEntry(_("Show CCcamInfo in extensions menu?"),
                                   config.cccaminfo.showInExtensions, None,
                                   None))
        if config.plugins.softcam.oscaminfo.value:
            self.list.append(
                getConfigListEntry(_("Show OScamInfo in extensions menu?"),
                                   config.oscaminfo.showInExtensions, None,
                                   None))
        if config.plugins.softcam.ncaminfo.value:
            self.list.append(
                getConfigListEntry(_("Show NcamInfo in extensions menu?"),
                                   config.ncaminfo.showInExtensions, None,
                                   None))

        self["key_red"] = StaticText(_("Cancel"))
        self["key_green"] = StaticText(_("OK"))
        self["key_blue"] = StaticText()
        self.onShown.append(self.blueButton)
示例#10
0
class SoftcamSetup(Screen, ConfigListScreen):
	skin = """
	<screen name="SoftcamSetup" position="center,center" size="560,450" >
		<widget name="config" position="5,10" size="550,90" />
		<widget name="info" position="5,100" size="550,300" font="Fixed;18" />
		<ePixmap name="red" position="0,410" zPosition="1" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
		<ePixmap name="green" position="140,410" zPosition="1" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
		<ePixmap name="blue" position="420,410" zPosition="1" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
		<widget name="key_red" position="0,410" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
		<widget name="key_green" position="140,410" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
		<widget name="key_blue" position="420,410" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
	</screen>"""
	def __init__(self, session):
		Screen.__init__(self, session)

		self.setup_title = _("Softcam setup")
		self.setTitle(self.setup_title)

		self["actions"] = ActionMap(["OkCancelActions", "ColorActions", "CiSelectionActions"],
			{
				"cancel": self.cancel,
				"green": self.save,
				"red": self.cancel,
				"blue": self.ppanelShortcut,
			},-1)

		self.list = [ ]
		ConfigListScreen.__init__(self, self.list, session = session)

		self.softcam = CamControl('softcam')
		self.cardserver = CamControl('cardserver')

		self.ecminfo = GetEcmInfo()
		(newEcmFound, ecmInfo) = self.ecminfo.getEcm()
		self["info"] = ScrollLabel("".join(ecmInfo))
		self.EcmInfoPollTimer = eTimer()
		self.EcmInfoPollTimer.callback.append(self.setEcmInfo)
		self.EcmInfoPollTimer.start(1000)

		softcams = self.softcam.getList()
		cardservers = self.cardserver.getList()

		self.softcams = ConfigSelection(choices = softcams)
		self.softcams.value = self.softcam.current()

		self.list.append(getConfigListEntry(_("Select Softcam"), self.softcams))
		if cardservers:
			self.cardservers = ConfigSelection(choices = cardservers)
			self.cardservers.value = self.cardserver.current()
			self.list.append(getConfigListEntry(_("Select Card Server"), self.cardservers))

		self.list.append(getConfigListEntry(_("Restart softcam"), ConfigAction(self.restart, "s")))
		if cardservers:
			self.list.append(getConfigListEntry(_("Restart cardserver"), ConfigAction(self.restart, "c")))
			self.list.append(getConfigListEntry(_("Restart both"), ConfigAction(self.restart, "sc")))

		self["key_red"] = Label(_("Cancel"))
		self["key_green"] = Label(_("OK"))
		self["key_blue"] = Label(_("Info"))

	def setEcmInfo(self):
		(newEcmFound, ecmInfo) = self.ecminfo.getEcm()
		if newEcmFound:
			self["info"].setText("".join(ecmInfo))

	def ppanelShortcut(self):
		ppanelFileName = '/etc/ppanels/' + self.softcams.value + '.xml'
		if "oscam" in self.softcams.value.lower() and os.path.isfile('/usr/lib/enigma2/python/Plugins/Extensions/OscamStatus/plugin.py'):
			from Plugins.Extensions.OscamStatus.plugin import OscamStatus
			self.session.open(OscamStatus)
		elif "cccam" in self.softcams.value.lower() and os.path.isfile('/usr/lib/enigma2/python/Plugins/Extensions/CCcamInfo/plugin.py'):
			from Plugins.Extensions.CCcamInfo.plugin import CCcamInfoMain
			self.session.open(CCcamInfoMain)
		elif os.path.isfile(ppanelFileName) and os.path.isfile('/usr/lib/enigma2/python/Plugins/Extensions/PPanel/plugin.py'):
			from Plugins.Extensions.PPanel.ppanel import PPanel
			self.session.open(PPanel, name = self.softcams.value + ' PPanel', node = None, filename = ppanelFileName, deletenode = None)
		else:
			return 0

	def restart(self, what):
		self.what = what
		if "s" in what:
			if "c" in what:
				msg = _("Please wait, restarting softcam and cardserver.")
			else:
				msg  = _("Please wait, restarting softcam.")
		elif "c" in what:
			msg = _("Please wait, restarting cardserver.")
		self.mbox = self.session.open(MessageBox, msg, MessageBox.TYPE_INFO)
		self.activityTimer = eTimer()
		self.activityTimer.timeout.get().append(self.doStop)
		self.activityTimer.start(100, False)

	def doStop(self):
		self.activityTimer.stop()
		if "c" in self.what:
			self.cardserver.command('stop')
		if "s" in self.what:
			self.softcam.command('stop')
		self.oldref = self.session.nav.getCurrentlyPlayingServiceOrGroup()
		self.session.nav.stopService()
		self.activityTimer = eTimer()
		self.activityTimer.timeout.get().append(self.doStart)
		self.activityTimer.start(1000, False)

	def doStart(self):
		self.activityTimer.stop()
		del self.activityTimer
		if "c" in self.what:
			self.cardserver.select(self.cardservers.value)
			self.cardserver.command('start')
		if "s" in self.what:
			self.softcam.select(self.softcams.value)
			self.softcam.command('start')
		if self.mbox:
			self.mbox.close()
		self.close()
		self.session.nav.playService(self.oldref, adjust=False)

	def restartCardServer(self):
		if hasattr(self, 'cardservers'):
			self.restart("c")

	def restartSoftcam(self):
		self.restart("s")

	def save(self):
		what = ''
		if hasattr(self, 'cardservers') and (self.cardservers.value != self.cardserver.current()):
			what = 'sc'
		elif self.softcams.value != self.softcam.current():
			what = 's'
		if what:
			self.restart(what)
		else:
			self.close()

	def cancel(self):
		self.close()
示例#11
0
class SoftcamSetup(Screen, ConfigListScreen):
    skin = """
	<screen name="SoftcamSetup" position="center,center" size="560,450" >
		<widget name="config" position="5,10" size="550,90" />
		<widget name="info" position="5,100" size="550,300" font="Fixed;18" />
		<ePixmap name="red" position="0,410" zPosition="1" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
		<ePixmap name="green" position="140,410" zPosition="1" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
		<ePixmap name="blue" position="420,410" zPosition="1" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
		<widget name="key_red" position="0,410" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
		<widget name="key_green" position="140,410" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
		<widget name="key_blue" position="420,410" zPosition="2" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
	</screen>"""

    def __init__(self, session):
        Screen.__init__(self, session)

        self.setup_title = _("Softcam setup")
        self.setTitle(self.setup_title)

        self["actions"] = ActionMap(
            ["OkCancelActions", "ColorActions", "CiSelectionActions"], {
                "cancel": self.cancel,
                "green": self.save,
                "red": self.cancel,
                "blue": self.ppanelShortcut,
            }, -1)

        self.list = []
        ConfigListScreen.__init__(self, self.list, session=session)

        self.softcam = CamControl('softcam')
        self.cardserver = CamControl('cardserver')

        self.ecminfo = GetEcmInfo()
        (newEcmFound, ecmInfo) = self.ecminfo.getEcm()
        self["info"] = ScrollLabel("".join(ecmInfo))
        self.EcmInfoPollTimer = eTimer()
        self.EcmInfoPollTimer.callback.append(self.setEcmInfo)
        self.EcmInfoPollTimer.start(1000)

        softcams = self.softcam.getList()
        cardservers = self.cardserver.getList()

        self.softcams = ConfigSelection(choices=softcams)
        self.softcams.value = self.softcam.current()

        self.list.append(getConfigListEntry(_("Select Softcam"),
                                            self.softcams))
        if cardservers:
            self.cardservers = ConfigSelection(choices=cardservers)
            self.cardservers.value = self.cardserver.current()
            self.list.append(
                getConfigListEntry(_("Select Card Server"), self.cardservers))

        self.list.append(
            getConfigListEntry(_("Restart softcam"),
                               ConfigAction(self.restart, "s")))
        if cardservers:
            self.list.append(
                getConfigListEntry(_("Restart cardserver"),
                                   ConfigAction(self.restart, "c")))
            self.list.append(
                getConfigListEntry(_("Restart both"),
                                   ConfigAction(self.restart, "sc")))

        self["key_red"] = Label(_("Cancel"))
        self["key_green"] = Label(_("OK"))
        self["key_blue"] = Label(_("Info"))

    def setEcmInfo(self):
        (newEcmFound, ecmInfo) = self.ecminfo.getEcm()
        if newEcmFound:
            self["info"].setText("".join(ecmInfo))

    def ppanelShortcut(self):
        ppanelFileName = '/etc/ppanels/' + self.softcams.value + '.xml'
        if "oscam" in self.softcams.value.lower() and os.path.isfile(
                '/usr/lib/enigma2/python/Plugins/Extensions/OscamStatus/plugin.py'
        ):
            from Plugins.Extensions.OscamStatus.plugin import OscamStatus
            self.session.open(OscamStatus)
        elif "cccam" in self.softcams.value.lower() and os.path.isfile(
                '/usr/lib/enigma2/python/Plugins/Extensions/CCcamInfo/plugin.py'
        ):
            from Plugins.Extensions.CCcamInfo.plugin import CCcamInfoMain
            self.session.open(CCcamInfoMain)
        elif os.path.isfile(ppanelFileName) and os.path.isfile(
                '/usr/lib/enigma2/python/Plugins/Extensions/PPanel/plugin.py'):
            from Plugins.Extensions.PPanel.ppanel import PPanel
            self.session.open(PPanel,
                              name=self.softcams.value + ' PPanel',
                              node=None,
                              filename=ppanelFileName,
                              deletenode=None)
        else:
            return 0

    def restart(self, what):
        self.what = what
        if "s" in what:
            if "c" in what:
                msg = _("Please wait, restarting softcam and cardserver.")
            else:
                msg = _("Please wait, restarting softcam.")
        elif "c" in what:
            msg = _("Please wait, restarting cardserver.")
        self.mbox = self.session.open(MessageBox, msg, MessageBox.TYPE_INFO)
        self.activityTimer = eTimer()
        self.activityTimer.timeout.get().append(self.doStop)
        self.activityTimer.start(100, False)

    def doStop(self):
        self.activityTimer.stop()
        if "c" in self.what:
            self.cardserver.command('stop')
        if "s" in self.what:
            self.softcam.command('stop')
        self.oldref = self.session.nav.getCurrentlyPlayingServiceOrGroup()
        self.session.nav.stopService()
        self.activityTimer = eTimer()
        self.activityTimer.timeout.get().append(self.doStart)
        self.activityTimer.start(1000, False)

    def doStart(self):
        self.activityTimer.stop()
        del self.activityTimer
        if "c" in self.what:
            self.cardserver.select(self.cardservers.value)
            self.cardserver.command('start')
        if "s" in self.what:
            self.softcam.select(self.softcams.value)
            self.softcam.command('start')
        if self.mbox:
            self.mbox.close()
        self.close()
        self.session.nav.playService(self.oldref, adjust=False)

    def restartCardServer(self):
        if hasattr(self, 'cardservers'):
            self.restart("c")

    def restartSoftcam(self):
        self.restart("s")

    def save(self):
        what = ''
        if hasattr(self, 'cardservers') and (self.cardservers.value !=
                                             self.cardserver.current()):
            what = 'sc'
        elif self.softcams.value != self.softcam.current():
            what = 's'
        if what:
            self.restart(what)
        else:
            self.close()

    def cancel(self):
        self.close()
示例#12
0
class SoftcamSetup(Setup):
    def __init__(self, session):
        self.softcam = CamControl("softcam")
        self.cardserver = CamControl("cardserver")
        self.ecminfo = GetEcmInfo()
        restartOptions = [("", _("Don't restart")),
                          ("s", _("Restart softcam"))]
        config.misc.softcams = NoSave(
            ConfigSelection(choices=self.softcam.getList()))
        config.misc.softcams.value = self.softcam.current()
        cardservers = self.cardserver.getList()
        if cardservers:
            default = self.cardserver.current()
            restartOptions.extend([("c", _("Restart cardserver")),
                                   ("sc", _("Restart both"))])
        else:
            cardservers = [("", _("None"))]
            default = ""
        config.misc.cardservers = NoSave(ConfigSelection(choices=cardservers))
        config.misc.cardservers.value = default
        config.misc.restarts = NoSave(
            ConfigSelection(default="", choices=restartOptions))
        Setup.__init__(self, session=session, setup="softcamsettings")
        self["key_yellow"] = StaticText()
        self["key_blue"] = StaticText()
        self["restartActions"] = HelpableActionMap(
            self, ["ColorActions"], {
                "yellow":
                (self.restart, _("Immediately restart selected devices."))
            },
            prio=0,
            description=_("Softcam Actions"))
        self["restartActions"].setEnabled(False)
        self["infoActions"] = HelpableActionMap(
            self, ["ColorActions"],
            {"blue": (self.softcamInfo, _("Display oscam information."))},
            prio=0,
            description=_("Softcam Actions"))
        self["infoActions"].setEnabled(False)
        (newEcmFound, ecmInfo) = self.ecminfo.getEcm()
        self["info"] = ScrollLabel("".join(ecmInfo))
        self.EcmInfoPollTimer = eTimer()
        self.EcmInfoPollTimer.callback.append(self.setEcmInfo)
        self.EcmInfoPollTimer.start(1000)
        self.onShown.append(self.updateButtons)

    def selectionChanged(self):
        self.updateButtons()
        Setup.selectionChanged(self)

    def changedEntry(self):
        self.updateButtons()
        Setup.changedEntry(self)

    def keySave(self):
        device = ""
        if hasattr(self, "cardservers") and (config.misc.cardservers.value !=
                                             self.cardserver.current()):
            device = "sc"
        elif config.misc.softcams.value != self.softcam.current():
            device = "s"
        if device:
            self.restart(device="e%s" % device)
        else:
            Setup.keySave(self)

    def keyCancel(self):
        config.misc.softcams.value = config.misc.softcams.default
        config.misc.cardservers.value = config.misc.cardservers.default
        config.misc.restarts.value = config.misc.restarts.default
        Setup.keyCancel(self)

    def updateButtons(self):
        if config.misc.restarts.value:
            self["key_yellow"].setText(_("Restart"))
            self["restartActions"].setEnabled(True)
        else:
            self["key_yellow"].setText("")
            self["restartActions"].setEnabled(False)
        if self["config"].getCurrent(
        )[1] == config.misc.softcams and config.misc.softcams.value and config.misc.softcams.value.lower(
        ) != "none":
            self["key_blue"].setText(_("Info"))
            self["infoActions"].setEnabled(True)
        else:
            self["key_blue"].setText("")
            self["infoActions"].setEnabled(False)

    def softcamInfo(self):
        ppanelFilename = "/etc/ppanels/%s.xml" % config.misc.softcams.value
        if "oscam" in config.misc.softcams.value.lower():
            from Screens.OScamInfo import OscamInfoMenu
            self.session.open(OscamInfoMenu)
        elif "ncam" in config.misc.softcams.value.lower():
            from Screens.NcamInfo import NcamInfoMenu
            self.session.open(NcamInfoMenu)
        elif "cccam" in config.misc.softcams.value.lower():
            from Screens.CCcamInfo import CCcamInfoMain
            self.session.open(CCcamInfoMain)
        elif "cccam" in config.misc.softcams.value.lower() and isfile(
                resolveFilename(SCOPE_PLUGINS,
                                "Extensions/CCcamInfo/plugin.pyo")) or isfile(
                                    resolveFilename(
                                        SCOPE_PLUGINS,
                                        "Extensions/CCcamInfo/plugin.py")):
            from Plugins.Extensions.CCcamInfo.plugin import CCcamInfoMain
            self.session.open(CCcamInfoMain)
        elif isfile(ppanelFilename) and isfile(
                resolveFilename(
                    SCOPE_PLUGINS, "Extensions/PPanel/plugin.pyo")) or isfile(
                        resolveFilename(SCOPE_PLUGINS,
                                        "Extensions/PPanel/plugin.py")):
            from Plugins.Extensions.PPanel.ppanel import PPanel
            self.session.open(PPanel,
                              name="%s PPanel" % config.misc.softcams.value,
                              node=None,
                              filename=ppanelFilename,
                              deletenode=None)

    def restart(self, device=None):
        self.device = config.misc.restarts.value if device is None else device
        msg = []
        if "s" in self.device:
            msg.append(_("softcam"))
        if "c" in self.device:
            msg.append(_("cardserver"))
        msg = (" %s " % _("and")).join(msg)
        self.mbox = self.session.open(MessageBox,
                                      _("Please wait, restarting %s.") % msg,
                                      MessageBox.TYPE_INFO)
        self.activityTimer = eTimer()
        self.activityTimer.timeout.get().append(self.doStop)
        self.activityTimer.start(100, False)

    def doStop(self):
        self.activityTimer.stop()
        if "s" in self.device:
            self.softcam.command("stop")
        if "c" in self.device:
            self.cardserver.command("stop")
        self.oldref = self.session.nav.getCurrentlyPlayingServiceOrGroup()
        self.session.nav.stopService()
        self.activityTimer = eTimer()
        self.activityTimer.timeout.get().append(self.doStart)
        self.activityTimer.start(1000, False)

    def doStart(self):
        self.activityTimer.stop()
        del self.activityTimer
        if "s" in self.device:
            self.softcam.select(config.misc.softcams.value)
            self.softcam.command("start")
        if "c" in self.device:
            self.cardserver.select(config.misc.cardservers.value)
            self.cardserver.command("start")
        if self.mbox:
            self.mbox.close()
        self.session.nav.playService(self.oldref, adjust=False)
        if "e" in self.device:
            Setup.keySave(self)

    def setEcmInfo(self):
        (newEcmFound, ecmInfo) = self.ecminfo.getEcm()
        if newEcmFound:
            self["info"].setText("".join(ecmInfo))

    def restartSoftcam(self):
        self.restart(device="s")

    def restartCardServer(self):
        if hasattr(self, "cardservers"):
            self.restart(device="c")
示例#13
0
class InstallWizard(Screen, ConfigListScreen):

	STATE_UPDATE = 0
	STATE_CHOISE_CHANNELLIST = 1
	STATE_CHOISE_SOFTCAM = 2
	STATE_RUN_SOFTCAM = 3

	def __init__(self, session, args = None):
		Screen.__init__(self, session)

		self.index = args
		self.list = []
		ConfigListScreen.__init__(self, self.list)

		if self.index == self.STATE_UPDATE:
			config.misc.installwizard.hasnetwork.value = False
			config.misc.installwizard.ipkgloaded.value = False
			modes = {0: " "}
			self.enabled = ConfigSelection(choices = modes, default = 0)
			self.adapters = [(iNetwork.getFriendlyAdapterName(x),x) for x in iNetwork.getAdapterList()]
			is_found = False
			for x in self.adapters:
				if x[1] == 'eth0' or x[1] == 'eth1':
					if iNetwork.getAdapterAttribute(x[1], 'up'):
						self.ipConfigEntry = ConfigIP(default = iNetwork.getAdapterAttribute(x[1], "ip"))
						iNetwork.checkNetworkState(self.checkNetworkCB)
						if_found = True
					else:
						iNetwork.restartNetwork(self.checkNetworkLinkCB)
					break
			if is_found is False:
				self.createMenu()
		elif self.index == self.STATE_CHOISE_CHANNELLIST:
			self.enabled = ConfigYesNo(default = True)
			modes = {"19e-23e-basis": "Astra1 Astra3 basis", "19e-23e": "Astra 1 Astra 3", "19e-23e-28e": "Astra 1 Astra 2 Astra 3", "13e-19e-23e-28e": "Astra 1 Astra 2 Astra 3 Hotbird", "kabelnl": "Kabel-NL"}
			self.channellist_type = ConfigSelection(choices = modes, default = "19e-23e-basis")
			self.createMenu()
		elif self.index == self.STATE_CHOISE_SOFTCAM:
			self.enabled = ConfigYesNo(default = True)
			modes = {"mgcamd": _("default") + " (MGCamd)", "cccam": "CCam", "scam": "scam"}
			self.softcam_type = ConfigSelection(choices = modes, default = "mgcamd")
			self.createMenu()
		elif self.index == self.STATE_RUN_SOFTCAM:
			#OpenMB - dirty CODE
			modes = {"mgcamd": " "}
			self.softcams = ConfigSelection(choices = modes, default = "mgcamd")
			self.createMenu()

	def checkNetworkCB(self, data):
		if data < 3:
			config.misc.installwizard.hasnetwork.value = True
		self.createMenu()

	def checkNetworkLinkCB(self, retval):
		if retval:
			iNetwork.checkNetworkState(self.checkNetworkCB)
		else:
			self.createMenu()

	def createMenu(self):
		try:
			test = self.index
		except:
			return
		self.list = []
		if self.index == self.STATE_UPDATE:
			if config.misc.installwizard.hasnetwork.value:
				self.list.append(getConfigListEntry(_("Your internet connection is working (ip: %s)") % (self.ipConfigEntry.getText()), self.enabled))
			else:
				self.list.append(getConfigListEntry(_("Your receiver does not have an internet connection"), self.enabled))
		elif self.index == self.STATE_CHOISE_CHANNELLIST:
			self.list.append(getConfigListEntry(_("Install channel list"), self.enabled))
			if self.enabled.value:
				self.list.append(getConfigListEntry(_("Channel list type"), self.channellist_type))
		elif self.index == self.STATE_CHOISE_SOFTCAM:
			self.list.append(getConfigListEntry(_("Install softcam"), self.enabled))
			if self.enabled.value:
				self.list.append(getConfigListEntry(_("Softcam type"), self.softcam_type))
		elif self.index == self.STATE_RUN_SOFTCAM:
			self.softcam = CamControl('softcam')
			softcams = self.softcam.getList()
			for scam in softcams:  
				self.list.append(getConfigListEntry(_(scam), self.softcams))
		self["config"].list = self.list
		self["config"].l.setList(self.list)

	def keyLeft(self):
		if self.index == 0:
			return
		ConfigListScreen.keyLeft(self)
		self.createMenu()

	def keyRight(self):
		if self.index == 0:
			return
		ConfigListScreen.keyRight(self)
		self.createMenu()

	def run(self):
		if self.index == self.STATE_UPDATE:
			if config.misc.installwizard.hasnetwork.value:
				self.session.open(InstallWizardIpkgUpdater, self.index, _('Please wait (updating packages)'), IpkgComponent.CMD_UPDATE)
		elif self.index == self.STATE_CHOISE_CHANNELLIST and self.enabled.value:
			self.session.open(InstallWizardIpkgUpdater, self.index, _('Please wait (downloading channel list)'), IpkgComponent.CMD_REMOVE, {'package': 'enigma2-plugin-settings-hans-' + self.channellist_type.value})
		elif self.index == self.STATE_CHOISE_SOFTCAM and self.enabled.value:
			self.session.open(InstallWizardIpkgUpdater, self.index, _('Please wait (downloading softcam)'), IpkgComponent.CMD_INSTALL, {'package': 'enigma2-plugin-softcams-' + self.softcam_type.value})
		elif self.index == self.STATE_RUN_SOFTCAM:
			self.runSoftCam()
		return
## OpenMB    
	def runSoftCam(self):
		try:
			current = self["config"].getCurrent()[0]
		except:
			current = "None"
		self.softcam.command('stop')
		self.softcam.select(str(current))
		self.softcam.command('start')
示例#14
0
class SoftcamScript(Setup):
    def __init__(self, session):
        self.softcam = CamControl("softcam")
        self.ecminfo = GetEcmInfo()
        config.misc.softcams.value == ""
        Setup.__init__(self, session=session, setup="softcamscriptsetup")
        self["key_yellow"] = StaticText()
        self["key_blue"] = StaticText()
        self["restartActions"] = HelpableActionMap(
            self, ["ColorActions"], {
                "yellow":
                (self.restart, _("Immediately restart selected cams."))
            },
            prio=0,
            description=_("Softcam Actions"))
        self["restartActions"].setEnabled(False)
        self["infoActions"] = HelpableActionMap(
            self, ["ColorActions"],
            {"blue": (self.softcamInfo, _("Display oscam information."))},
            prio=0,
            description=_("Softcam Actions"))
        self["infoActions"].setEnabled(False)
        (newEcmFound, ecmInfo) = self.ecminfo.getEcm()
        self["info"] = ScrollLabel("".join(ecmInfo))
        self.EcmInfoPollTimer = eTimer()
        self.EcmInfoPollTimer.callback.append(self.setEcmInfo)
        self.EcmInfoPollTimer.start(1000)
        self.onShown.append(self.updateButtons)

    def selectionChanged(self):
        self.updateButtons()
        Setup.selectionChanged(self)

    def changedEntry(self):
        self.updateButtons()
        Setup.changedEntry(self)

    def keySave(self):
        camtype = ""
        print(
            "[SoftcamSetup][keySave] self.softcam.current=%s config.misc.softcams.value=%s"
            % (self.softcam.current(), config.misc.softcams.value))
        if config.misc.softcams.value != self.softcam.current():
            camtype = "s"
        if camtype:
            self.restart(camtype="e%s" % camtype)
        else:
            Setup.keySave(self)

    def keyCancel(self):
        Setup.keyCancel(self)

    def updateButtons(self):
        if config.misc.softcamrestarts.value:
            self["key_yellow"].setText(_("Restart"))
            self["restartActions"].setEnabled(True)
        else:
            self["key_yellow"].setText("")
            self["restartActions"].setEnabled(False)
        self["key_blue"].setText("")
        self["infoActions"].setEnabled(False)
        if self["config"].getCurrent(
        ) == config.misc.softcams and config.misc.softcams.value and config.misc.softcams.value.lower(
        ) != "none":
            self["key_blue"].setText(_("Info"))
            self["infoActions"].setEnabled(True)

    def softcamInfo(self):
        if "oscam" in config.misc.softcams.value.lower() and fileExists(
                '/usr/lib/enigma2/python/Screens/OScamInfo.py'):
            from Screens.OScamInfo import OscamInfoMenu
            self.session.open(OscamInfoMenu)
        elif "cccam" in config.misc.softcams.lower() and fileExists(
                '/usr/lib/enigma2/python/Screens/CCcamInfo.py'):
            from Screens.CCcamInfo import CCcamInfoMain
            self.session.open(CCcamInfoMain)

    def setEcmInfo(self):
        (newEcmFound, ecmInfo) = self.ecminfo.getEcm()
        if newEcmFound:
            self["info"].setText("".join(ecmInfo))

    def restart(self, camtype=None):
        print(
            "[SoftcamSetup][restart] config.misc.softcamrestarts.value=%s camtype=%s"
            % (config.misc.softcamrestarts.value, camtype))
        self.camtype = config.misc.softcamrestarts.value if camtype is None else camtype
        print("[SoftcamSetup][restart] self.camtype=%s" % self.camtype)
        msg = []
        if "s" in self.camtype:
            msg.append(_("softcam"))
        msg = (" %s " % _("and")).join(msg)
        self.mbox = self.session.open(MessageBox,
                                      _("Please wait, initialising %s.") % msg,
                                      MessageBox.TYPE_INFO)
        self.activityTimer = eTimer()
        self.activityTimer.timeout.get().append(self.doStop)
        self.activityTimer.start(100, False)

    def doStop(self):
        self.activityTimer.stop()
        #		if "s" in self.camtype:
        self.softcam.command("stop")
        self.oldref = self.session.nav.getCurrentlyPlayingServiceOrGroup()
        self.session.nav.stopService()
        self.activityTimer = eTimer()
        self.activityTimer.timeout.get().append(self.doStart)
        self.activityTimer.start(1000, False)

    def doStart(self):
        self.activityTimer.stop()
        print(
            "[SoftcamSetup][doStart1] self.camtype=%s config.misc.softcams.value=%s"
            % (self.camtype, config.misc.softcams.value))
        configs = self.softcam.getConfigs(config.misc.softcams.value)
        if len(configs) < 4 and config.misc.softcams.value != "None":
            msg = _("No configs for specifies softcam %s." %
                    config.misc.softcams.value)
            self.mbox = self.session.open(MessageBox, msg,
                                          MessageBox.TYPE_INFO)
            self.camtype = "None"
#		elif "s" in self.camtype:
        self.softcam.select(config.misc.softcams.value)
        if config.misc.softcams.value != "None":
            self.softcam.command("start")
            print(
                "[SoftcamSetup][doStart2] self.camtype=%s config.misc.softcams.value=%s"
                % (self.camtype, config.misc.softcams.value))
        self.activityTimer = eTimer()
        self.activityTimer.timeout.get().append(self.dofinish)
        self.activityTimer.start(1000, False)

    def dofinish(self):
        self.activityTimer.stop()
        del self.activityTimer
        if self.mbox:
            self.mbox.close()
        self.session.nav.playService(self.oldref, adjust=False)
        if self.camtype == "None" or "e" in self.camtype:
            Setup.keySave(self)

    def restartSoftcam(self):
        self.restart(device="s")