[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyKDE] KDE XML GUI ActionLists
From:       Jim Bublitz <jbublitz () nwinternet ! com>
Date:       2003-04-23 4:15:10
[Download RAW message or body]

Problem solved.

Change your KMainWindow to KParts.MainWindow and be sure to do this:

class MainWindow (KParts.MainWindow):
    def __init__ ( ... ):
        KParts.MainWindow (self, ...) <---- !!!!

I have a comment in a KParts based example that I was hacking on to
remember to change the KMainWindow ctor call to a KParts.MainWindow
call when changing the MainWindow type, and I still screwed it up
when I went back to original program I was trying to get to work. I
even went as far as modifying the PyKDE C++ code (and still crashed)
before figuring out I'd made the same dumb mistake again. Last time
I probably spent a day chasing it down, so I guess I'm improving.

All your other code (including the 'None') is correct - it's
exactly the way konqueror and other apps do it.

In addition, instead of specifying the XML file in createGUI, do

    self.setXMLFile (<path to file>)

and then

    self.createGUI (None)

(createGUI is overloaded to "void createGUI (KParts.Part *part)" )

Call the code that updates the action list actions after createGUI.
Those should be the only changes you need to make. KParts.MainWindow
is a subclass of KMainWindow, so nothing else needs to change.

Pretty cool for stuff like 'recent files' lists or modifying menus
on the fly. Thanks for bringing it up - I'll add an example to
PyKDE in the future.

It'd be nice if the KDE docs were more explicit about this - the
link you provided specifically says:

"KDE's class for toplevel windows, ***KMainWindow***, inherits
KXMLGUIClient and therefore supports XMLGUI out of the box."

which misled me at first.

All of the C++ action list examples I've looked at (mostly from
2.1.1 and KOffice) all use KParts.MainWindow too, but they all
import KParts too.


Jim

_______________________________________________
PyKDE mailing list    PyKDE@mats.gmd.de
http://mats.gmd.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic