Kodi Community Forum
Multiple inheritance - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Multiple inheritance (/showthread.php?tid=127971)



Multiple inheritance - Bstrdsmkr - 2012-04-06

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.


RE: Multiple inheritance - jmarshall - 2012-04-07

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?


RE: Multiple inheritance - Bstrdsmkr - 2012-04-07

Damn. lol

Now I have to do things the hard way


RE: Multiple inheritance - Bstrdsmkr - 2012-04-07

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'