Skip to content

Commit

Permalink
Revert "Adapt the SatIPClient plugin to the new setup features"
Browse files Browse the repository at this point in the history
This reverts commit 271f55a.

It seems more adaptions are needed as OK toggles no switches
  • Loading branch information
Littlesat committed Aug 1, 2024
1 parent 271f55a commit 5d46f07
Showing 1 changed file with 82 additions and 16 deletions.
98 changes: 82 additions & 16 deletions satipclient/src/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from Plugins.Plugin import PluginDescriptor
from Screens.MessageBox import MessageBox
from Screens.Screen import Screen
from Screens.Setup import Setup
from Screens.Console import Console
from Screens.Standby import TryQuitMainloop
from twisted.internet import reactor
Expand Down Expand Up @@ -305,20 +304,53 @@ def getUUIDFromIP(self, ip):
satipdiscovery = SATIPDiscovery()


class SATIPTuner(Setup):
class SATIPTuner(Screen, ConfigListScreen):
skin = """
<screen position="center,center" size="600,370">
<ePixmap pixmap="skin_default/buttons/red.png" position="10,0" size="140,40" alphatest="on" />
<ePixmap pixmap="skin_default/buttons/green.png" position="160,0" size="140,40" alphatest="on" />
<ePixmap pixmap="skin_default/buttons/yellow.png" position="310,0" size="140,40" alphatest="on" />
<ePixmap pixmap="skin_default/buttons/blue.png" position="460,0" size="140,40" alphatest="on" />
<widget source="key_red" render="Label" position="10,0" zPosition="1" size="140,40" font="Regular;18" halign="center" valign="center" backgroundColor="#9f1313" foregroundColor="#ffffff" transparent="1" />
<widget source="key_green" render="Label" position="160,0" zPosition="1" size="140,40" font="Regular;18" halign="center" valign="center" backgroundColor="#1f771f" foregroundColor="#ffffff" transparent="1" />
<widget source="key_yellow" render="Label" position="310,0" zPosition="1" size="140,40" font="Regular;18" halign="center" valign="center" backgroundColor="#a08500" foregroundColor="#ffffff" transparent="1" />
<widget source="key_blue" render="Label" position="460,0" zPosition="1" size="140,40" font="Regular;18" halign="center" valign="center" backgroundColor="#a08500" foregroundColor="#ffffff" transparent="1" />
<widget name="config" zPosition="2" position="20,60" size="550,50" scrollbarMode="showOnDemand" transparent="1" />
<widget source="description" render="Label" position="20,170" size="550,210" font="Regular;18" halign="left" valign="center" />
<widget source="choices" render="Label" position="20,120" size="550,40" font="Regular;18" halign="left" valign="center" />
</screen>
"""

def __init__(self, session, vtuner_idx, vtuner_uuid, vtuner_type, current_satipConfig):
self.satipconfig = ConfigSubsection()
Screen.__init__(self, session)
self.setTitle(_("SAT>IP client - auto tuner setup"))
self.skin = SATIPTuner.skin
self.vtuner_idx = vtuner_idx
self.vtuner_uuid = vtuner_uuid
self.vtuner_type = vtuner_type
self.current_satipConfig = current_satipConfig
self.autostart_client = path.exists("/etc/rc3.d/S20satipclient")

Setup.__init__(self, session, yellow_button={'function': self.DiscoveryStart, 'helptext': _("Toggle Configuration Mode or AutoDisqc"), 'text': _("Discover")},
blue_button={'function': self.AutostartClient, 'helptext': _("Set all the settings back as they were"), 'text': _("%s autostart") % (self.autostart_client and _("Disable") or _("Enable"))})
self["key_red"] = StaticText(_("Cancel"))
self["key_green"] = StaticText(_("OK"))
self["key_yellow"] = StaticText(_("Discover"))
self.autostart_client = path.exists("/etc/rc3.d/S20satipclient")
self["key_blue"] = StaticText(_("%s autostart") % (self.autostart_client and _("Disable") or _("Enable")))
self["description"] = StaticText(_("Starting..."))
self["choices"] = StaticText("")

self.setTitle(_("SAT>IP client - auto tuner setup"))
self["shortcuts"] = ActionMap(["SATIPCliActions"],
{
"ok": self.keySave,
"cancel": self.keyCancel,
"red": self.keyCancel,
"green": self.keySave,
"yellow": self.DiscoveryStart,
"blue": self.AutostartClient,
}, -2)

self.list = []
ConfigListScreen.__init__(self, self.list, session=self.session)
self.satipconfig = ConfigSubsection()
self.server_entry = None
satipdiscovery.iface = ""

Expand Down Expand Up @@ -351,16 +383,14 @@ def OnClose(self):
satipdiscovery.DiscoveryStop()

def DiscoveryStart(self):
self["configActions"].setEnabled(False)
self["key_blueActions"].setEnabled(False)
self["key_yellowActions"].setEnabled(False)
self["shortcuts"].setEnabled(False)
self["config_actions"].setEnabled(False)
self["description"].setText(_("SAT>IP server discovering for %d seconds...") % (discoveryTimeoutMS // 1000))
satipdiscovery.DiscoveryStart()

def discoveryEnd(self):
self["configActions"].setEnabled(True)
self["key_blueActions"].setEnabled(True)
self["key_yellowActions"].setEnabled(True)
self["shortcuts"].setEnabled(True)
self["config_actions"].setEnabled(True)
if not satipdiscovery.isEmptyServerData():
self.createServerConfig()
self.createSetup()
Expand Down Expand Up @@ -537,17 +567,53 @@ def keySave(self):
self.close(data)


class SATIPManualTuner(Setup):
class SATIPManualTuner(Screen, ConfigListScreen):
skin = """
<screen position="center,center" size="600,370">
<ePixmap pixmap="skin_default/buttons/red.png" position="10,0" size="140,40" alphatest="on" />
<ePixmap pixmap="skin_default/buttons/green.png" position="160,0" size="140,40" alphatest="on" />
<ePixmap pixmap="skin_default/buttons/yellow.png" position="310,0" size="140,40" alphatest="on" />
<ePixmap pixmap="skin_default/buttons/blue.png" position="460,0" size="140,40" alphatest="on" />
<widget source="key_red" render="Label" position="10,0" zPosition="1" size="140,40" font="Regular;18" halign="center" valign="center" backgroundColor="#9f1313" foregroundColor="#ffffff" transparent="1" />
<widget source="key_green" render="Label" position="160,0" zPosition="1" size="140,40" font="Regular;18" halign="center" valign="center" backgroundColor="#1f771f" foregroundColor="#ffffff" transparent="1" />
<widget source="key_yellow" render="Label" position="310,0" zPosition="1" size="140,40" font="Regular;18" halign="center" valign="center" backgroundColor="#a08500" foregroundColor="#ffffff" transparent="1" />
<widget source="key_blue" render="Label" position="460,0" zPosition="1" size="140,40" font="Regular;18" halign="center" valign="center" backgroundColor="#a08500" foregroundColor="#ffffff" transparent="1" />
<widget name="config" zPosition="2" position="20,60" size="550,200" scrollbarMode="showOnDemand" transparent="1" />
<widget source="description" render="Label" position="20,300" size="550,45" font="Regular;20" halign="left" valign="center" />
</screen>
"""

def __init__(self, session, vtuner_idx, current_satipConfig):
Screen.__init__(self, session)
self.setTitle(_("SAT>IP client - manual tuner setup"))
self.skin = SATIPManualTuner.skin
self.vtuner_idx = vtuner_idx
self.current_satipConfig = current_satipConfig

self["key_red"] = StaticText(_("Cancel"))
self["key_green"] = StaticText(_("OK"))
self["key_yellow"] = StaticText("")
self.autostart_client = path.exists("/etc/rc3.d/S20satipclient")
self["key_blue"] = StaticText(_("%s autostart") % (self.autostart_client and _("Disable") or _("Enable")))
self["description"] = StaticText("")

Setup.__init__(self, session, blue_button={'function': self.AutostartClient, 'helptext': _("Set all the settings back as they were"), 'text': _("%s autostart") % (self.autostart_client and _("Disable") or _("Enable"))})
self["shortcuts"] = ActionMap(["SATIPCliActions"],
{
"ok": self.keySave,
"cancel": self.keyCancel,
"red": self.keyCancel,
"green": self.keySave,
"yellow": self.keyYellow,
"blue": self.AutostartClient,
}, -2)

self.setTitle(_("SAT>IP client - manual tuner setup"))
self.list = []
ConfigListScreen.__init__(self, self.list, session=self.session)
self.createSetup()

def keyYellow(self):
pass

def AutostartClient(self):
client = "/etc/init.d/satipclient"
if path.exists(client):
Expand Down

0 comments on commit 5d46f07

Please sign in to comment.