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

List:       pykde
Subject:    [PyQt] [pykde3] Loading arbitrary kparts
From:       jbd <jbdenis () dental-on-line ! fr>
Date:       2008-02-22 10:06:27
Message-ID: fpm6r4$a03$1 () ger ! gmane ! org
[Download RAW message or body]

Hello,

I'm saw the following post :
http://www.riverbankcomputing.com/pipermail/pyqt/2007-October/017367.html

I'm sorry to post for the same subject again, but I still don't know how
to load an arbitraty kparts depending on the URL.

=======
import sys
from kdecore import KCmdLineArgs, KApplication, KLibLoader
from kio import KTrader
from qt import QLabel
from kparts import KParts

KCmdLineArgs.init(sys.argv, "test", "test", "test")
app = KApplication()

trader = KTrader()
offers = trader.query("text/html", "'KParts/ReadOnlyPart' in ServiceTypes")

loader  = KLibLoader()
factory = loader.factory(offers[0].library().ascii())
part = factory.create(None, offers[0].name().ascii(),
"KParts::ReadOnlyPart")

# The type of part is QObject

button = QLabel(str(part), None)
button.show()
app.setMainWidget(button)

sys.exit(app.exec_loop())
======

The type of part is QObject, so i can't do anything with it.

I'm doing things wrong here. What is the python way to achieve arbitrary
KPart ?

Regards.

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

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