Skip to content

Commit

Permalink
[ChannelsImporter] remove redundant code
Browse files Browse the repository at this point in the history
  • Loading branch information
Huevos committed Oct 8, 2022
1 parent 6a21aa9 commit 453d474
Showing 1 changed file with 4 additions and 27 deletions.
31 changes: 4 additions & 27 deletions ChannelsImporter/src/plugin.py
Expand Up @@ -57,24 +57,14 @@ class ChannelsImporterScreen(Setup):
<widget name="description" position="50,385" size="500,80" font="Regular;18" halign="center" valign="top" transparent="0" zPosition="1"/>
</screen>"""

def __init__(self, session, setup, plugin=None, menu_path=None, PluginLanguageDomain=None):
try:
Setup.__init__(self, session, setup, plugin, menu_path, PluginLanguageDomain)
except TypeError:
Setup.__init__(self, session, setup, plugin)
def __init__(self, session, setup, plugin, PluginLanguageDomain):
Setup.__init__(self, session, setup, plugin, PluginLanguageDomain)

self["actions2"] = ActionMap(["SetupActions", "ColorActions", "MenuActions"],
self["actions2"] = ActionMap(["ColorActions"],
{
"ok": self.keySave,
"cancel": self.keyCancel,
"menu": self.keyCancel,
"red": self.keyCancel,
"green": self.keySave,
"yellow": self.keyGo,
}, -2)

self["key_red"] = StaticText(_("Exit"))
self["key_green"] = StaticText(_("Save"))
self["key_yellow"] = StaticText(_("Import"))

def keySave(self):
Expand All @@ -94,18 +84,6 @@ def saveConfig(self):
config.usage.remote_fallback.save()
configfile.save()

def keyCancel(self):
if self["config"].isChanged():
self.session.openWithCallback(self.cancelCallback, MessageBox, _("Really close without saving settings?"))
else:
self.cancelCallback(True)

def cancelCallback(self, answer):
if answer:
for x in self["config"].list:
x[1].cancel()
self.close(False)

def startImporter(self):
self.session.openWithCallback(self.startImporterCallback, ChannelsImporter)

Expand All @@ -125,8 +103,7 @@ def ChannelsImporterStart(menuid, **kwargs):


def ChannelsImporterMain(session, **kwargs):
menu_path = _("Main menu") + ' / ' + _("Setup") + ' / ' + _('Service searching')
session.open(ChannelsImporterScreen, 'channelsimporter', 'SystemPlugins/ChannelsImporter', menu_path, PluginLanguageDomain)
session.open(ChannelsImporterScreen, 'channelsimporter', 'SystemPlugins/ChannelsImporter', PluginLanguageDomain)


def Plugins(**kwargs):
Expand Down

0 comments on commit 453d474

Please sign in to comment.