Hi,
I've got some function (lets name it: def doSomethink).
For my program I need that this function should be called during __init__ of main program (that is simple), and always (automatically and imeditly) when I came back from configure menu.
My code looks like this (but without automatic calling function after closing Config menu):
Python
class MainClass(Screen):
skin = """
<screen position="center,80" size="1180,590" title="Subtitle downloader" >
.................
.................
.................
</screen>"""
def __init__(self, session, args = 0):
............
............
............
self["myActionMap"] = ActionMap(["ChannelSelectBaseActions","WizardActions", "DirectionActions","MenuActions","NumberActions","ColorActions"],
{
"ok": ..........
"back": ..........
"menu": self.showConfigScreen,
......
......
......,
}, -1)
sefl.doSomethink() #THIS FUNCTION SHOULD BE AUTOMATICALLY CALLED DURING INIT (so it is) AND AFTER \
CAMEING BACK FROM CONFIG TO THIS PROGRAM PART
def showConfigScreen(self):
............
............
............
self.session.open(Configmenue)
def doSomthink(self):
...........
...........
class Configmenue(Screen):
def __init__():
............
............
self["setupActions"] = ActionMap(["SetupActions","DirectionActions"],
{
.............
.............
"ok": self.saveConfig,
.............
.............
}, -1)
.............
.............
def saveConfig(self):
for x in self["config"].list:
x[1].save()
self.close ()
Alles anzeigen
How to achieve automatic function call off after closing config menu (self.sesion.open(....)?