[PyKDE] PyQt4 custom widgets
Phil Thompson
phil at riverbankcomputing.co.uk
Mon Jan 9 22:24:57 GMT 2006
On Monday 09 January 2006 9:19 pm, Andreas Pakulat wrote:
> 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/c
> >ompiler.py", line 59, in compileUi return self.parse(filename)
> > File
> > "/home/andreas/python2.4/lib/python2.4/site-packages/PyQt4/uic/uiparser.p
> >y", line 379, in parse actor(elem)
> > File
> > "/home/andreas/python2.4/lib/python2.4/site-packages/PyQt4/uic/uiparser.p
> >y", line 350, in customWidgets custom_widget.findtext("header"))
> > File
> > "/home/andreas/python2.4/lib/python2.4/site-packages/PyQt4/uic/Compiler/q
> >objectcreator.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?
Not a lot - seeing as Torsten wrote it. I'm sure he'll appreciate a patch to
fix it.
Phil
More information about the PyQt
mailing list