Multiple inheritance
#1
Ok, hopefully someone can solidify my fuzzy understanding of the topic.

What I'd like to do is subclass both xbmcgui.Window and xbmc.Keyboard in order to create a keyboard class that I can add controls to.

Does it even work that way? This is the first time I've actually had a use for trying to subclass two different classes at once.
Reply
#2
Nope, at least it wouldn't be automatic.

What you could attempt to do (and I don't really recommend it, but it might work) is grab the keyboard window into an xbmc.window object and add your controls to that. It needs to be done after your keyboard is loaded though, so I'm not really sure exactly how you'd go about it so it all worked nicely.

Out of interest, what are you planning to add?
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
Damn. lol

Now I have to do things the hard way
Reply
#4
For anyone else looking for a captcha here's what I ended up doing:
PHP Code:
import xbmc
import xbmcgui

class InputWindow(xbmcgui.WindowDialog):
    
def __init__(self, *args, **kwargs):
        
self.cptloc kwargs.get('captcha')
        
self.img xbmcgui.ControlImage(335,30,624,60,self.cptloc)
        
self.addControl(self.img)
        
self.kbd xbmc.Keyboard()

    
def get(self):
        
self.show()
        
self.kbd.doModal()
        if (
self.kbd.isConfirmed()):
            
text self.kbd.getText()
            
self.close()
            return 
text
        self
.close()
        return 
False

solver 
InputWindow(captcha 'C:\captchaimage.png')
solution solver.get()
if 
solution:
    
addon.log('Solution provided: %s' %solution)
else: 
addon.log('Dialog was canceled'
Reply

Logout Mark Read Team Forum Stats Members Help
Multiple inheritance0