[PyKDE] KPart problem

David Boddie david at boddie.org.uk
Sun Jul 24 22:17:35 BST 2005


On Sun Jul 24 21:28:38 MEST 2005, Roberto Alsina wrote:

> And here's my attempt:
>
> def main(args):
>         app=kdecore.KApplication(args,'dropbear')
>         win=kparts.KParts.MainWindow()
>         app.setMainWidget(win)
>         factory = kdecore.KLibLoader.self().factory( "libkonsolepart" );
>         win.setCentralWidget(p.widget())
>         win.show()
>         app.exec_loop()
> 
> I'm getting that p has no widget member.
> 
> Any ideas?

It looks like the QObject returned from factory.create(win) isn't getting
converted to the proper subclass. Although it may be possible to implement
the correct behaviour in PyKDE, there is an alternative approach: simply
replace the lines

  factory = kdecore.KLibLoader.self().factory( "libkonsolepart" );
  p=factory.create( win)

with 

  p = kparts.createReadWritePart("libkonsolepart", win, "konsole",
                                 "KParts::Part")

The syntax for this convenience function is

  createReadWritePart(lib, parent, name, className, args)

and I think I've chosen the correct library and class names for your example.

Hope this helps,

David




More information about the PyQt mailing list