[PyQt] Multiple inheritance involving KXMLGUIClient does not work?

Adeodato Simó dato at net.com.org.es
Sat Aug 11 19:48:45 BST 2007


Hello.

I'm having problems with KXMLGUIClient; in particular, it seems
subclassing from it does not work when multiple inheritance is involved.
See the script below. If this gets fixed, the attached example should
work as well.

(I seem to be pushing PyKDE to its limits, and I've already found three
non-working features which I need for my application. As I've said
before, I understand that you're not very inclined to fix them for KDE 3, 
but what are the odds that they'll work in KDE 4? I guess my application
can live without them until then, but I'd like to know if the future
will indeed be better. I'm afraid all I can provide is working/non-working
C++/Python examples.)

-------------------------------------------------------------------------
#! /usr/bin/env python

"""This script demonstrates that multiple inheritance with KXMLGUIClient does not work."""

import qt
import kdeui

class MyClient1(kdeui.KXMLGUIClient):
    def __init__(self):
        super(MyClient1, self).__init__()

class MyClient2(kdeui.KXMLGUIClient, qt.QObject):
    def __init__(self):
        super(MyClient2, self).__init__()

class MyClient3(qt.QObject, kdeui.KXMLGUIClient):
    def __init__(self):
        super(MyClient3, self).__init__()

print hasattr(MyClient1(), 'actionCollection') # True

print hasattr(MyClient2(), 'actionCollection') # True
print hasattr(MyClient2(), 'connect')          # False

print hasattr(MyClient3(), 'actionCollection') # False
print hasattr(MyClient3(), 'connect')          # True
-------------------------------------------------------------------------

-- 
Adeodato Simó                                     dato at net.com.org.es
Debian Developer                                  adeodato at debian.org
 
We're happy, we have boyfriends! This is infinitely better than any mood
stabilizer I have ever been on.
                -- Paris Geller
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xml_toolbar.py
Type: text/x-python
Size: 1518 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070811/1b617098/xml_toolbar.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xml_toolbar.cc
Type: text/x-c++src
Size: 1745 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070811/1b617098/xml_toolbar.bin
-------------- next part --------------
<!DOCTYPE kpartgui>
<kpartgui name="test" version="1">
  <ToolBar name="toolbar" fullWidth="true">
    <Text>Toolbar</Text>

    <Action name="action1" />
    <Action name="action2" />
    <Action name="action3" />
  </ToolBar>
</kpartgui>


More information about the PyQt mailing list