altering a skin defined controls attributes in script
#1
If I have a ControlLabel defined in a skin.xml, is there way for the script to change its font and colour?

I ask as latest myTV has a skinned header (and footer) on which are a few labels. In the old version I'd just re-create the ControlLabel according to the font/colour picked via a settings menu, but as they're now skin predefined , skinning seems to remove this ability.


adding setFont and setColor to the python's ControlLabel might possibly be the only solution Huh

any thoughts ?

BBB
Retired from Add-on dev
Reply
#2
just use a button.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#3
good idea.
would the button background appear transparent if the textures were defined to be unknown files ?
Retired from Add-on dev
Reply
#4
Following on from Nuka's suggestion, I swapped to using a ControlButton.

But, I think there may be a potential bug in the setLabel of a ControlButton, that is:
setLabel() ignores the font parameter. Label and textColor work fine.

I thought it might be because the control was defined initially from a skin, but a simple test of creating a ControlButton in a script

ie.
Code:
self.testBtn = xbmcgui.ControlButton(10, 150, 100, 30, "I AM SOME TEXT", font='font10',textColor='0xFFFFFFFF')
  self.addControl(self.testBtn)

then do

  self.testBtn.setLabel("I AM some TEXT", font='font13',textColor='0xFFFFFF33')

You can see the text and color change, but not the font size

Has anyone else come across this ?

BBB
Retired from Add-on dev
Reply
#5
are you sure font10 exists, if it doesn't it falls back to font13
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#6
yeah, font10 exists in PMIII.

If I set the buttons font in the skin definition to font10, thats what it starts as, changing it within script to any other has no effect.

but its the same for a button created totally in a script too.
Retired from Add-on dev
Reply
#7
must be something deeper in the code, i don't see why it would fail.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#8
It fails as we don't free and reload the font at all (anywhere) to my knowledge. I may be wrong ofcourse.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#9
So, is the idea not set font in the initial ControlButton creation, but then set it in a subsequent setLabel(). otherwise I can't see why setlabel() has font param?

Could font reloading be patched into ControlButton ?
Retired from Add-on dev
Reply
#10
hey bbb, the pydocs in my signature are upto date now.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply

Logout Mark Read Team Forum Stats Members Help
altering a skin defined controls attributes in script0