2004-04-12, 07:29
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:
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:
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?
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?