[PyQt] py2exe + QWebView + .ui files

Albert Cervera i Areny albert at nan-tic.com
Sun Jan 11 10:35:57 GMT 2009


A Dissabte 10 Gener 2009, piotr maliński va escriure:
> I have
> setup(windows=[{"script" : "run.py"}], options={"py2exe" : {"includes"
>
> : ["sip", "PyQt4", "PyQt4.QtNetwork"]}})
>
> And it works, also for a WebKit using part of the application (which
> needs extra PyQt4.QtNetwork added)

I already had QtNetwork and sip, and adding PyQt4 made no difference. I think 
the problem is that it can't find QtWebKit when it's loaded from a ui file. I 
was able to solve the problem by modifying the file manually.

Qt designer creates QWebView as a custom widget that inherits QWidget whose 
header is "QtWebKit/QWebView". I changed it to "PyQt4.QtWebKit" in my web.ui 
and now it works with and without py2exe. Note that this change can't be made 
inside Qt Designer (as the widget is shown as a normal widget, not a custom 
one), but has to be done directly with a text editor.

It should look like this:

<ui version="4.0">
.....
<customwidgets>
	<customwidget>
		<class>QWebView</class>
		<extends>QWidget</extends>
		<header>PyQt4.QtWebKit</header>
	</customwidget>
</customwidgets>
.....
</ui>

>
> 2009/1/10, Albert Cervera i Areny <albert at nan-tic.com>:
> > I'm trying to make an installer using py2exe. One of the ui files the
> >  application loads contains a QWebView widget, but I get the following
> > error:
> >
> >  ImportError: No module named QtWebKit.QWebView
> >
> >  I've added 'PyQt4.QtWebKit' to the 'includes' list but that doesn't seem
> > to solve the problem. Does anybody know how I can solve this issue?
> >
> >  Thanks!
> >
> >
> >  --
> >  Albert Cervera i Areny
> >  http://www.NaN-tic.com
> >  _______________________________________________
> >  PyQt mailing list    PyQt at riverbankcomputing.com
> >  http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt



-- 
Albert Cervera i Areny
http://www.NaN-tic.com


More information about the PyQt mailing list