[PyKDE] PyQt4 custom widgets

Andreas Pakulat apaku at gmx.de
Mon Jan 9 21:19:25 GMT 2006

On 09.01.06 20:05:09, Andreas Pakulat wrote:
> pyuic4 refuses to generate .py's for Forms that include non-standard
> widgets:
> andreas at morpheus:~/projects/pyfilmdbsimpleui/widgets/ui>pyuic4 versionwidget.ui
> DEBUG:root:UI version is 4.0
> DEBUG:root:uiname is VersionWidget
> Traceback (most recent call last):
>   File "/home/andreas/python2.4/lib/python2.4/site-packages/PyQt4/uic/pyuic.py", line 44, in ?
>     sys.exit(Compiler.compileUi(args[1], options))
>   File "/home/andreas/python2.4/lib/python2.4/site-packages/PyQt4/uic/Compiler/__init__.py", line 44, in compileUi
>     widget = ui_compiler.compileUi(input_file)
>   File "/home/andreas/python2.4/lib/python2.4/site-packages/PyQt4/uic/Compiler/compiler.py", line 59, in compileUi
>     return self.parse(filename)
>   File "/home/andreas/python2.4/lib/python2.4/site-packages/PyQt4/uic/uiparser.py", line 379, in parse
>     actor(elem)
>   File "/home/andreas/python2.4/lib/python2.4/site-packages/PyQt4/uic/uiparser.py", line 350, in customWidgets
>     custom_widget.findtext("header"))
>   File "/home/andreas/python2.4/lib/python2.4/site-packages/PyQt4/uic/Compiler/qobjectcreator.py", line 14, in addCustomWidget
>     type(classname, (getattr(qtproxies, baseclass),),
> AttributeError: 'module' object has no attribute ''
> I think it should be possible to get this working as pyuic4 could just
> assume that the needed custom widgets are placed in the same directory.
> If somebody needs the possibility to spread ui-files around an option
> could be added to put the path to the generated .py-files into pythons
> module-search-path.

Ok, I got beyond that point. The .ui-files didn't have the
extends-element set. I don't know wether this is a bug in Qt Designer or
my custom-widget-C++-Code but I'll check that.

However this still doesn't completely solve my problem:

andreas at morpheus:~/projects/pyfilmdbsimpleui/widgets/ui>python Ui_versionwidget.py
  File "Ui_versionwidget.py", line 14
    from widgets/pictureformatwidget.h import PictureFormatWidget
SyntaxError: invalid syntax

As you can see pyuic4 generates totally nonsense import statements (or
is python able to parse C++ header files?). I guess Phil you didn't
invest much time on pyuic4 regarding this, did you?


A visit to a fresh place will bring strange work.

More information about the PyQt mailing list