You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Tuesday, August 2nd 2005, 12:13pm

KDE widgets problem

I get errors if I use kde widgets in a form(through PyQt).

I converted the .ui file to .py and then used another .py file to act as a wrapper to provide the main function. When i run the wrapper file, i get errors like:

Source code

1
2
3
File "/home/ani/form1.py", line 36, in __init__
    self.kLed2 = KLed(self,"kLed2")
NameError: global name 'KLed' is not defined

This happens for KLed. I have tried many kde widgets and still get the similar errors.
I cant install PyKDE( i cant find a version for KDE 3.4.2).
Is PyKDE the issue? or should i do something else?

Help is greatly appreciated.

Thank you.

Posts: 2,162

Location: Graz, Austria

Occupation: Student

  • Send private message

2

Tuesday, August 2nd 2005, 4:08pm

Yes, KLed is a KDE widget, thus it is implemented in libkdeui, thus you need the Python bindings for KDE

Cheers,
_
Qt/KDE Developer
Debian User

3

Tuesday, August 2nd 2005, 4:50pm

Thank you for replying.... but....
You know of any other way i can get through this?
There apparently is no version of PyKDE for KDE>=3.4(heard i could use kdebindings). But kdebindings asks me for Portable.NET's csant tool. kdebindinding has microsoft dependencies????lol.

There must be some other way... please help.

4

Thursday, August 4th 2005, 4:03am

OK, I managed to get PyKDE installed, but that does not seem to be the problem; I still get the error messages. eg.

Source code

1
2
3
File "/home/ani/form1.py", line 36, in __init__
    self.kPasswordEdit1 = KPasswordEdit(self,"kPasswordEdit1")
NameError: global name 'KPasswordEdit' is not defined

Somebody pls. help ;(.

Posts: 2,162

Location: Graz, Austria

Occupation: Student

  • Send private message

5

Thursday, August 4th 2005, 11:36am

Maybe you are missing some kind of include or import or whatever Python calls this.

Maybe the names are namespaced or in a Module and you didn't use that name correctly.

For example in Ruby the KDE classes are in the KDE module so their full name is
KDE::classname

Cheers,
_
Qt/KDE Developer
Debian User

6

Thursday, August 4th 2005, 3:09pm

You mean something like

Source code

1
import kdeui
???
I made the form using Qt Designer, since the KDE widgets are available there, shouldnt it automatically create the necessary import statements. For eg., for the regular widgets, i dont have to meddle with any import statements, Qt Designer does everything. So shouldnt the same happen for KDE widgets too. ?(

However, PyKDE has some example programs(that work) so i'll try mixing up the import statements of the two files. :)

Posts: 2,162

Location: Graz, Austria

Occupation: Student

  • Send private message

7

Friday, August 5th 2005, 1:27pm

Very likely the Python UIC doesn't know that automatically, much like you have to manually add include and library paths when doing a C++ project.

Cheers,
_
Qt/KDE Developer
Debian User

8

Friday, August 5th 2005, 2:15pm

I managed to get it working, added 'import kdeui' and had to modify some function calls a bit(was getting segmentation faults).
I have been wanting to post back, but got deeply engrossed into the wold of Qt :D .
Thanks for your help!!!