Subclassing xbmcgui classes
#1
i have been trying to create my own classes that are derived from the xbmcgui control* classes. the reason for doing this is so that i can add in pixel height, width checking so that labels don't render outside of the control area. i have run into a problem... here is a high level overview of what i'm trying to do:

Quote:class label( xbmcgui.controllabel ):
...

label = label( x, y, w, h, text, font )
win.addcontrol( label )

the label class implements setlabel() and it does extra checking and formatting of the label so that it fits within the dimensions of the control before calling the xbmcgui.controllabel.setlabel() method. this all seems to work fine when i test against my stubbed out version of xbmc.py and xbmcgui.py using python 2.3.3. however, when the same code runs in xbmc, i get an error like the following in the xbmc.log:

Quote:11-04-2004 23:13:20 self.addcontrol( self.bgctl )
11-04-2004 23:13:20 <.recordedwin object at 0x006fd030>
11-04-2004 23:13:20 :
11-04-2004 23:13:20 object should be of type control

any ideas? is there a way to cast the instance down when calling addcontrol()? it seems like python does not realize that the class hierarchy is:

label is-a xbmcgui.controllabel is-a xbmcgui.control

just out of curiosity which version of the python interpreter is embedded in xbmc?
Reply
#2
Quote:any ideas?  is there a way to cast the instance down when calling addcontrol()?  it seems like python does not realize that the class hierarchy is:
seems like a bug in my implementation of addcontrol() Smile
will try to fix it.
Quote:just out of curiosity which version of the python interpreter is embedded in xbmc?
2.3
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
#3
ok, there was a bug in the code when adding your own control type to a window.
but, the error you get was already fixed a few days ago.
with current cvs and your script, xbmc would just crash atm :d.

anyway, it is fixed now.
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
#4
thanks darkie... i thought i was going crazy. Smile
Reply

Logout Mark Read Team Forum Stats Members Help
Subclassing xbmcgui classes0