[PyQt] uic.loadUiType and promoted widgets

Giacomo Lacava g.lacava at gmail.com
Mon Oct 25 17:17:03 BST 2010


Hi,
I have a wrapped module (on which I have no control) containing a
widget under a namespace, e.g. I have to do "from MyModule import
Namespace ; Namespace.MyWidget()" to get the widget.

In this case, how would i go about defining a promotion in QtDesigner,
so that I can then use uic.loadUiType on the .ui file?

None of the following works:
1-name: MyWidget , header: MyModule.Namespace (Namespace is not a module)
2-name: Namespace.MyWidget , header: MyModule (can't import names
containing ".")

Looking at the output of pyuic4, it looks like an import statement is
generated as such:
from <header> import <name>
which would explain why it's not working -- that sort of direct import
cannot be done in my case.

So I tried to "fool" uic by further wrapping the widget, so that I
could legally do:
from WidgetWrapper import MyWidget
However, "WidgetWrapper" is never found when executing loadUiType.

Any clues?

Cheers
-- 
Giacomo Lacava


More information about the PyQt mailing list