Again... As far I understand when you want to update texts after the screen is 'made' it is mandatory to use a
<widget source="key_red" render="Label"... structure in the skin....
Nope, wrong again.
Posted 18 January 2018 - 17:04
There is nothing wrong in the first place... I struggled with the same thing years and years ago,....
I have no permission to open the attached file.... Mayby put it here between... So i see the trick you invented.... (and probably I see... oh yes!!!)
and
?
And still we end op with 3 types of making those buttons.... Which is actually the onlything that is wrong in the first place....
Edited by littlesat, 18 January 2018 - 17:08.
WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W
Posted 18 January 2018 - 17:28
T[...]..
I [...] And still we end op with 3 types of making those buttons.... Which is actually the onlything that is wrong in the first place....
Yes 3 object that do the same job using different processes.
Somehow we need a backwards compatible solution that moves forward from today and doesn't include hacks or self control.
My suggestion is write a new function in CPP and link all 3 of these python objects to it. So they all update on name and source.
Posted 18 January 2018 - 17:36
Edited by littlesat, 18 January 2018 - 17:40.
WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W
Posted 18 January 2018 - 17:42
here are the py files.
These are to just show the problem.
from Plugins.Plugin import PluginDescriptor from Screens.Screen import Screen from Components.ActionMap import ActionMap from Components.Button import Button from Components.Label import Label from Components.Sources.StaticText import StaticText class ButtonTextsScreen(Screen): skin = """ <screen position="340,170" size="600,400"> <widget source="key_red" render="Label" position="0,0" size="140,40" valign="center" halign="center" zPosition="4" foregroundColor="white" backgroundColor="#9f1313" font="Regular;18" transparent="1"/> <widget source="key_green" render="Label" position="150,0" size="140,40" valign="center" halign="center" zPosition="4" foregroundColor="white" backgroundColor="#1f771f" font="Regular;18" transparent="1"/> <ePixmap name="red" position="0,0" zPosition="2" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on"/> <ePixmap name="green" position="150,0" zPosition="2" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on"/> <eLabel text="Button()" position="150, 80" size="140,50" font="Regular;20" transparent="0" valign="center" halign="center" /> <eLabel text="Label()" position="300, 80" size="140,50" font="Regular;20" transparent="0" valign="center" halign="center" /> <eLabel text="StaticText()" position="450, 80" size="140,50" font="Regular;20" transparent="0" valign="center" halign="center" /> <eLabel text="Name" position="0, 150" size="140,50" font="Regular;20" transparent="0" valign="center" halign="center" /> <eLabel text="Source" position="0, 220" size="140,50" font="Regular;20" transparent="0" valign="center" halign="center" /> <widget name="button_text" position="150,150" size="140,50" valign="center" halign="center" zPosition="4" foregroundColor="yellow" backgroundColor="#9f1313" font="Regular;18" transparent="1"/> <widget source="button_text" render="Label" position="150,220" size="140,50" valign="center" halign="center" zPosition="4" foregroundColor="yellow" backgroundColor="#9f1313" font="Regular;18" transparent="1"/> <widget name="label_text" position="300,150" size="140,50" valign="center" halign="center" zPosition="4" foregroundColor="yellow" backgroundColor="#9f1313" font="Regular;18" transparent="1"/> <widget source="label_text" render="Label" position="300,220" size="140,50" valign="center" halign="center" zPosition="4" foregroundColor="yellow" backgroundColor="#9f1313" font="Regular;18" transparent="1"/> <widget name="static_text" position="450,150" size="140,50" valign="center" halign="center" zPosition="4" foregroundColor="yellow" backgroundColor="#9f1313" font="Regular;18" transparent="1"/> <widget source="static_text" render="Label" position="450,220" size="140,50" valign="center" halign="center" zPosition="4" foregroundColor="yellow" backgroundColor="#9f1313" font="Regular;18" transparent="1"/> </screen>""" def __init__(self, session): Screen.__init__(self, session) self["actions2"] = ActionMap(["SetupActions", "ColorActions", "MenuActions"], { "cancel": self.keyCancel, "menu": self.keyCancel, "red": self.keyCancel, "green": self.keyGo, }, -2) self["key_red"] = StaticText(_("Exit")) self["key_green"] = StaticText(_("Send SetText")) creation_text = _("Initial text") self["button_text"] = Button(creation_text) self["label_text"] = Label(creation_text) self["static_text"] = StaticText(creation_text) Screen.setTitle(self, _("Button texts")) self.update = 1 def keyGo(self): update_text = _("Update %d") % self.update self.update += 1 self["button_text"].setText(update_text) self["label_text"].setText(update_text) self["static_text"].setText(update_text) def keyCancel(self): self.close(False) def ButtonTextsStart(menuid, **kwargs): if menuid == "scan": return [(_("Button Texts"), ButtonTextsMain, "ButtonTextsScreen", 80)] return [] def ButtonTextsMain(session, **kwargs): session.open(ButtonTextsScreen) def Plugins(**kwargs): pList = [] # pList.append( PluginDescriptor(name=_("ButtonTexts"), description= _("For testing buttons objects"), where = PluginDescriptor.WHERE_MENU, fnc=ButtonTextsStart, needsRestart=False) ) pList.append( PluginDescriptor(name = "ButtonTexts", description = _("For testing button objects"), where = PluginDescriptor.WHERE_PLUGINMENU, fnc=ButtonTextsMain)) return pList
Edited by Abu Baniaz, 18 January 2018 - 17:43.
Posted 18 January 2018 - 21:58
Edited by littlesat, 18 January 2018 - 22:01.
WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W
Posted 18 January 2018 - 23:34
Edited by littlesat, 18 January 2018 - 23:36.
WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W
Posted 19 January 2018 - 07:53
Edited by littlesat, 19 January 2018 - 07:55.
WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W
Posted 19 January 2018 - 09:04
S [...] and source does not show in name... that’s what it should donas it is made that way...
When you have name you should not have source...
What does that mean? Source was deliberately added to Label and Button 5 years ago. That is why the fake source methods exist. The only problem is that it is non updating. So when source was added only half the job was done. And now 5 years later we are left with a backwards compatibility problem because of that thoughtless change.
Edited by Huevos, 19 January 2018 - 09:04.
0 members, 24 guests, 0 anonymous users