Jump to content


Photo

Button() and Label(), PLi opinion.


  • Please log in to reply
465 replies to this topic

Re: Button() and Label(), PLi opinion. #121 littlesat

  • PLi® Core member
  • 57,122 posts

+698
Excellent

Posted 19 January 2018 - 10:11

You point to this one...

 

https://github.com/O...3d0886a5241e010

 

But you also tell when removing these lines it does not work either...


WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: Button() and Label(), PLi opinion. #122 Huevos

  • PLi® Contributor
  • 4,644 posts

+161
Excellent

Posted 19 January 2018 - 10:47

Without that commit it is now completely broken. So obviously there have been commits since that commit that rely on that commit.

 

With the fake source:

Attached File  1.jpg   68.7KB   3 downloads

 

Attached File  2.jpg   66.86KB   3 downloads

 

Without fake source:

Attached File  3.jpg   82.23KB   3 downloads

 

Attached File  4.jpg   107.35KB   3 downloads


Edited by Huevos, 19 January 2018 - 10:47.


Re: Button() and Label(), PLi opinion. #123 littlesat

  • PLi® Core member
  • 57,122 posts

+698
Excellent

Posted 19 January 2018 - 10:52

That was exectly what I expect.... As far I understood it never worked....

 

But you do not want have 2 widgets (name and source)... So couldn't this be an idea...(in skin.py)? so you can ensure there is only one widget with text created....

                                               conditional = w.attrib.get('conditional')
                                               if conditional and not [i for i in conditional.split(",") if i in screen.keys()]:
                                                               continue
                                               onlyclasses = w.attrib.get('onlyclasses')
                                               if onlyclasses and not [i for i in onlyclasses.split(",") if i in [screen[x].__class__.__name__ for x in screen.keys()]
                                                               continue


Edited by littlesat, 19 January 2018 - 11:04.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: Button() and Label(), PLi opinion. #124 littlesat

  • PLi® Core member
  • 57,122 posts

+698
Excellent

Posted 19 January 2018 - 11:10

<screen name="ButtonTemplate">
<panel name="ButtonRed"/>
<widget conditional="key_red" onlyclasses="Label,Button" name="key_red" position="242,1030" size="370,38" backgroundColor="black" zPosition="1" transparent="1" font="Regular;34" halign="left"/>
<widget conditional="key_red" onlyclasses="StaticText" source="key_red" render="Label" position="242,1030" size="370,38" backgroundColor="darkgrey" zPosition="2" transparent="1" foregroundColor="grey" font="Regular;34" halign="left"/>
<widget conditional="red"  onlyclasses="Label,Button" name="red" position="242,1030" size="370,38" backgroundColor="black" zPosition="1" transparent="1" font="Regular;34" halign="left"/>
<widget conditional="red" onlyclasses="StaticText" source="red" render="Label" position="242,1030" size="370,38" backgroundColor="darkgrey" zPosition="2" transparent="1" foregroundColor="grey" font="Regular;34" halign="left"/>
 
<panel name="ButtonGreen"/>
<widget conditional="key_green" onlyclasses="Label,Button" name="key_green" position="678,1030" size="370,38" backgroundColor="black" zPosition="1" transparent="1" font="Regular;34" halign="left"/>
<widget conditional="key_green" onlyclasses="StaticText" source="key_green" render="Label" position="678,1030" size="370,38" backgroundColor="darkgrey" zPosition="2" transparent="1" foregroundColor="grey" font="Regular;34" halign="left"/>
<widget conditional="green" onlyclasses="Label,Button" name="green" position="678,1030" size="370,38" backgroundColor="black" zPosition="1" transparent="1" font="Regular;34" halign="left"/>
<widget conditional="green" onlyclasses="StaticText" source="green" render="Label" position="678,1030" size="370,38" backgroundColor="darkgrey" zPosition="2" transparent="1" foregroundColor="grey" font="Regular;34" halign="left"/>
 
<panel name="ButtonYellow"/>
<widget conditional="key_yellow" onlyclasses="Label,Button" name="key_yellow" position="1114,1030" size="370,38" backgroundColor="black" zPosition="1" transparent="1" font="Regular;34" halign="left"/>
<widget conditional="key_yellow" onlyclasses="StaticText" source="key_yellow" render="Label" position="1114,1030" size="370,38" backgroundColor="darkgrey" zPosition="2" transparent="1" foregroundColor="grey" font="Regular;34" halign="left"/>
<widget conditional="yellow" onlyclasses="Label,Button" name="yellow" position="1114,1030" size="370,38" backgroundColor="black" zPosition="1" transparent="1" font="Regular;34" halign="left"/>
<widget conditional="yellow" onlyclasses="StaticText" source="yellow" render="Label" position="1114,1030" size="370,38" backgroundColor="darkgrey" zPosition="2" transparent="1" foregroundColor="grey" font="Regular;34" halign="left"/>
 
<panel name="ButtonBlue"/>
<widget conditional="key_blue" onlyclasses="Label,Button" name="key_blue" position="1550,1030" size="370,38" backgroundColor="black" zPosition="1" transparent="1" font="Regular;34" halign="left"/>
<widget conditional="key_blue" onlyclasses="StaticText" source="key_blue" render="Label" position="1550,1030" size="370,38" backgroundColor="darkgrey" zPosition="2" transparent="1" foregroundColor="grey" font="Regular;34" halign="left"/>
<widget conditional="blue" onlyclasses="Label,Button" name="blue" position="1550,1030" size="370,38" backgroundColor="black" zPosition="1" transparent="1" font="Regular;34" halign="left"/>
<widget conditional="blue" onlyclasses="StaticText" source="blue" render="Label" position="1550,1030" size="370,38" backgroundColor="darkgrey" zPosition="2" transparent="1" foregroundColor="grey" font="Regular;34" halign="left"/>
</screen>

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: Button() and Label(), PLi opinion. #125 Huevos

  • PLi® Contributor
  • 4,644 posts

+161
Excellent

Posted 19 January 2018 - 11:45

Let me try it.



Re: Button() and Label(), PLi opinion. #126 Huevos

  • PLi® Contributor
  • 4,644 posts

+161
Excellent

Posted 19 January 2018 - 13:31

Something not right. Still superimposed.

<widget name="label_text" onlyclasses="Label,Button" position="150,290" size="140,50" valign="center" halign="center" zPosition="4" foregroundColor="yellow" backgroundColor="#9f1313" font="Regular;18" transparent="1"/>
<widget source="label_text" onlyclasses="StaticText" render="Label" position="150,290" size="140,50" valign="center" halign="center" zPosition="4" foregroundColor="yellow" backgroundColor="#9f1313" font="Regular;18" transparent="1"/>
			
<194695.791> onlyclasses -> Label,Button
<194695.791> screen.keys() -> ['actions2', 'Title', 'button_text', 'label_text', 'key_green', 'key_red', 'static_text']
<194695.791> [screen[x].__class__.__name__ for x in screen.keys()] -> ['ActionMap', 'StaticText', 'Button', 'Label', 'StaticText', 'StaticText', 'StaticText']
<194695.791> onlyclasses -> StaticText
<194695.791> screen.keys() -> ['actions2', 'Title', 'button_text', 'label_text', 'key_green', 'key_red', 'static_text']
<194695.792> [screen[x].__class__.__name__ for x in screen.keys()] -> ['ActionMap', 'StaticText', 'Button', 'Label', 'StaticText', 'StaticText', 'StaticText']


Edited by Huevos, 19 January 2018 - 13:34.


Re: Button() and Label(), PLi opinion. #127 littlesat

  • PLi® Core member
  • 57,122 posts

+698
Excellent

Posted 19 January 2018 - 13:49

Oeps.... stuped me... that's happen when you type 'drie' code///

 

You should only check for the current 'client' not the others.... So the check for the __class__.__name should be done on a different place....Y

maybe something like this... So it checks for the class of what is given at conditional.... 

conditional = w.attrib.get('conditional')
if conditional:
  if not [i for i in conditional.split(",") if i in screen.keys()]:
    continue
  onlyclasses = w.attrib.get('onlyclasses')
  if onlyclasses and not [i for i in onlyclasses.split(",") if i == screen[conditional].__class__.__name__]:
    continue

Edited by littlesat, 19 January 2018 - 14:14.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: Button() and Label(), PLi opinion. #128 Huevos

  • PLi® Contributor
  • 4,644 posts

+161
Excellent

Posted 19 January 2018 - 14:54

You have written a new attribute for the widget. Why does it have to depend on conditional. Why can't it function alone?



Re: Button() and Label(), PLi opinion. #129 littlesat

  • PLi® Core member
  • 57,122 posts

+698
Excellent

Posted 19 January 2018 - 15:25

conditional indicates the 'key' that should have a specific class....  That is why I make it depended that way...

 

So when there is a condition="key_red"  and "key_red" exists... "key_red" ALSO need to be the class "StaticText" when it is a source -or- "Button" or "Label" when it is a name... condition gives me the 'key' to compare against.... and the check is only needed when we have a "condition"...

 

But of course we could also consider to obtain the 'key' from name -or- source.... (which I thought is more complicated -but- of course then it could be used on more places...)

 

 

onlyclasses = w.attrib.get('name') or w.attrib.get('source')

Edited by littlesat, 19 January 2018 - 15:30.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: Button() and Label(), PLi opinion. #130 littlesat

  • PLi® Core member
  • 57,122 posts

+698
Excellent

Posted 19 January 2018 - 15:31

Something like this???

conditional = w.attrib.get('conditional')
if conditional and not [i for i in conditional.split(",") if i in screen.keys()]:
   continue
onlyclasses = w.attrib.get('onlyclasses ')
key = w.attrib.get('name') or w.attrib.get('source')
if onlyclasses and key and not [i for i in onlyclasses.split(",") if i == screen[key].__class__.__name__]:
   continue

Edited by littlesat, 19 January 2018 - 15:34.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: Button() and Label(), PLi opinion. #131 littlesat

  • PLi® Core member
  • 57,122 posts

+698
Excellent

Posted 19 January 2018 - 15:35

But still I think having the condition mandatory when you need onlyclases does not harm...  When the key does not exist you do not need the check. And it avoids too many checks while building the screen...


Edited by littlesat, 19 January 2018 - 15:36.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: Button() and Label(), PLi opinion. #132 Huevos

  • PLi® Contributor
  • 4,644 posts

+161
Excellent

Posted 19 January 2018 - 16:28

Ha ha. I just wrote the same piece of code and came back and found you wrote exactly the same.

 

 

It must not depend because the conditional may be being call on a different widget... So cannot be made conditional. Also having it depend is just another behaviour skinners would need to know about.

 

Anyway just testing now.

 

Also can we change "onlyclasses" to "objecttypes"?


Edited by Huevos, 19 January 2018 - 16:30.


Re: Button() and Label(), PLi opinion. #133 littlesat

  • PLi® Core member
  • 57,122 posts

+698
Excellent

Posted 19 January 2018 - 16:31

Sure.... I just took a name that was too technical... ;)

 

I'm happy we finally at-up to the same frequency... ;)

 

When you want to 'autohide' buttons you need to use StaticText...

 

I hoped I could test this evening... but I suggest I can better do other things... Just waiting on your 'fix'...


Edited by littlesat, 19 January 2018 - 16:33.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: Button() and Label(), PLi opinion. #134 littlesat

  • PLi® Core member
  • 57,122 posts

+698
Excellent

Posted 19 January 2018 - 20:27

FYI:

 

https://github.com/O...98eb303387dc650

 

https://github.com/l...94db9766221977d

 

Here key = w.attrib.get('name') or w.attrib.get('source') did not work as expected... under investigation... And still some standard skins needs to be adjusted...

(please note I'm considering to remove HD1 and HD2)


Edited by littlesat, 19 January 2018 - 20:27.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: Button() and Label(), PLi opinion. #135 Huevos

  • PLi® Contributor
  • 4,644 posts

+161
Excellent

Posted 19 January 2018 - 21:17

How did it not work as expected?

 

Forcing this new object to depend on "conditional" severely limits its use.

 

I created a PR but that was before reading your comment.

https://github.com/O...99ac8ef3eddacc1



Re: Button() and Label(), PLi opinion. #136 littlesat

  • PLi® Core member
  • 57,122 posts

+698
Excellent

Posted 19 January 2018 - 21:30

It did not had the effect.... And I notice something else... When we want to autohide buttons and change the class to StaticText... Old skins are broken...


WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: Button() and Label(), PLi opinion. #137 littlesat

  • PLi® Core member
  • 57,122 posts

+698
Excellent

Posted 19 January 2018 - 21:33

It seems with this it always shows all pngs... see currently in FlashImage and Hotkey....

 


How did it not work as expected?

 

Forcing this new object to depend on "conditional" severely limits its use.

 

I created a PR but that was before reading your comment.

https://github.com/O...99ac8ef3eddacc1


Edited by littlesat, 19 January 2018 - 21:34.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: Button() and Label(), PLi opinion. #138 Huevos

  • PLi® Contributor
  • 4,644 posts

+161
Excellent

Posted 19 January 2018 - 22:54

That is a problem in the skin. I'm going to do some experimenting and report back. Anyway why would it affect old skins if they don't have the variable in the skin. Must be mixing code from old and updated skins.


Edited by Huevos, 19 January 2018 - 22:56.


Re: Button() and Label(), PLi opinion. #139 Huevos

  • PLi® Contributor
  • 4,644 posts

+161
Excellent

Posted 19 January 2018 - 23:27

Also, one potential problem I noticed with your commit is that there is no sanity check for "key in screen".

https://github.com/H...fe11dfdc8aR1057



Re: Button() and Label(), PLi opinion. #140 littlesat

  • PLi® Core member
  • 57,122 posts

+698
Excellent

Posted 20 January 2018 - 00:20

As far I can see I have that included. And key needs only be checked and collected aanthe attribute is checked

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W



13 user(s) are reading this topic

0 members, 13 guests, 0 anonymous users