I'm doing tests on a plugin , but I can't find a way of changing text twice on a function.
When pressing blue button, I want to get a specific text, and after 3 seconds, another one.
I only get the last one.
I press blue button, and after 3 secons I get "Finished!". I don't get the first one.
What I'm doing wrong ???
# -*- coding: iso-8859-1 -*- from Plugins.Plugin import PluginDescriptor from Screens.Screen import Screen from Components.ActionMap import ActionMap from Components.Label import Label import time class AAAA(Screen): skin = """ <screen name="MyTests" position="240,240" size="300,300" flags="wfNoBorder" backgroundColor="#40000000"> <eLabel position="20,25" size="200,30" text="MyTests" foregroundColor="#00ffffff" font="Regular; 24" valign="center" backgroundColor="#40000000" transparent="1" halign="center" /> <eLabel position="20,100" size="5,40" backgroundColor="#00ff0000" /> <eLabel position="120,100" size="5,40" backgroundColor="#000000ff" /> <eLabel font="Regular; 20" foregroundColor="#00ffffff" backgroundColor="#40000000" halign="left" position="35,100" size="250,33" text="Cancel" transparent="1" /> <eLabel font="Regular; 20" foregroundColor="#00ffffff" backgroundColor="#40000000" halign="left" position="135,100" size="250,33" text="Start" transparent="1" /> <widget name="results" position="20,200" size="200,100" zPosition="2" font="Regular;25" halign="left" valign="center" backgroundColor="#40000000" /> </screen> """ def __init__(self, session): Screen.__init__(self, session) self.session = session self["results"] = Label() self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], { "red": self.exit, "blue": self.mainfunc, "cancel": self.exit }, -1) def exit(self): self.close() def ChangeText(self, text): self["results"].setText(text) def mainfunc(self): self.ChangeText("waiting 3 seconds") time.sleep(3) self.ChangeText("Finished!") def main(session, **kwargs): session.open(AAAA) def Plugins(**kwargs): return PluginDescriptor(name="AAAA", description=_("Silly Tests"), where = PluginDescriptor.WHERE_PLUGINMENU, icon="icon.png", fnc=main)