[PyKDE] KXMLGUIFactory.container()

Jim Bublitz jbublitz at nwinternet.com
Mon Apr 14 02:38:01 BST 2003


On 13-Apr-03 Gordon Tyler wrote:
> On April 13, 2003 04:55 pm, Phil Thompson wrote:
>> > Okay, I'll give that a try. Does it matter where in the sip
>> > file I define the %ConvertToSubClassCode block?

>> It must be part of a class definition, but it doesn't matter
>> which one. I use the "main" class of the module, ie. QObject
>> for qt, QCanvas for qtcanvas, QTable for qttable etc.
 
> I used KMainWindow as the "main" class for the kdeui module. I've
> attached a patch which fixes my particular situation. I'm not
> sure how it should be extended to the rest of PyKDE. I think
> I'll leave that one for Jim to figure out ;)

Just got back in town. I'll take a look at this and see if I can
figure out what needs to be done. I'm sure the patch will help - I
wasn't aware of any problems in this area. There are a only a few
cases where KMainWindow wouldn't be the "main" class - using KParts
and (maybe) KSystemTray stuff. The other case would be with some
kind of Python plugin (as in panel applets discussed recently),
where Python doesn't do the KApplication or KMainWindow.
 
>> > That's not the case here I think. The function is returning
>> > instances managed by another class so Python doesn't need
>> > to call their destructor.

>> Then I'm surprised, because the KDE docs talk of factory
>> functions.

I'm just guessing here, but I believe KDE runs the factory method
itself internally in the case of the KXMLGUI stuff - KXMLGUI mostly
deals with merging menus, actions, toolbars, etc.
 
> I may be misunderstanding the KDE docs and source code but it
> doesn't look like it's just creating an instance and then
> throwing it away, leaving the client to manage the lifetime of
> the instance. There's what appears to be a tree-like structure
> containing the various widgets created from the XML document.
> And the container function just finds a widget in that tree and 
> returns it.
> 
> And my Python code does work now ;)
 
> Thanks for all your help, Phil.

Ditto.

Jim




More information about the PyQt mailing list