[Qgis-developer] pyuic4 and ui files in subfolder

G. Allegri giohappy at gmail.com
Wed Mar 5 07:25:48 PST 2014

This is a limit of the pyuic4 compiler. When it parses resources it doesn't
consider relative paths.
I generally keep a "proxy" module inside the ui folder, named as the ui
compiled module wants (e.g. resources_rc). In this module a do all my
imports from other packages/modules.


2014-03-05 16:01 GMT+01:00 Denis Rouzaud <denis.rouzaud at gmail.com>:

>  Hi all,
> I have been annoyed by a small problem for a while without finding a
> solution for it.
> In my plugins, I place all the ui files in a subfolder named ui.
> The resources file is at the root folder.
> So, in the ui file I have
> <iconset resource="../resources.qrc">
> But when I compile, I got in the python file (also located in ui folder):
> import resources_rc
> which gives an error, because it can't find the resource files.
> What would be the solution to this (something else than moving the file)?
> My makefile is like this:
> UI_SOURCES=$(wildcard ui/*.ui)
> UI_FILES=$(join $(dir $(UI_SOURCES)), $(notdir $(UI_SOURCES:%.ui=%.py)))
> RC_SOURCES=$(wildcard *.qrc)
> RC_FILES=$(join $(dir $(RC_SOURCES)), $(notdir
> $(RC_SOURCES:%.qrc=%_rc.py)))
> $(UI_FILES): ui/%.py: ui/%.ui
>     pyuic4 -o $@ $<
> $(RC_FILES): %_rc.py: %.qrc
>     pyrcc4 -o $@ $<
> Is it a problem of my rules or a pyuic problem?
> Thanks,
> Denis
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer

Giovanni Allegri
Twitter: https://twitter.com/_giohappy_
blog: http://blog.spaziogis.it
GEO+ geomatica in Italia http://bit.ly/GEOplus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20140305/e3bc2915/attachment.html>

More information about the Qgis-developer mailing list