[Qgis-developer] QGIS custom widgets with python plugins

Arnaud Morvan arnaud.morvan at camptocamp.com
Tue Nov 25 00:53:41 PST 2014


If you install QGIS to custom path, you should set some environment 
variables before calling pyuic4

exemple:

export QGIS_PREFIX_PATH=~/apps/qgis-master
export LD_LIBRARY_PATH=$QGIS_PREFIX_PATH/lib
export PYTHONPATH=$QGIS_PREFIX_PATH/share/qgis/python/:$PYTHONPATH

Personnally, I've added one line in
/usr/lib/python2.7/dist-packages/PyQt4/uic/widget-plugins/qgis_customwidgets.py

pluginType = MODULE
def moduleInformation():
     try:
         import qgis.gui
         return "qgis.gui", dir(qgis.gui)
     except ImportError:
*print "impossible to import qgis.gui"*
         return "", []

to detect import error

Arnaud


Le 25/11/2014 09:35, Denis Rouzaud a écrit :
> Hi Stefan,
>
> To properly compile the UI file using pyuic4, you need to have the uic 
> widget plugin installed.
>
> This is the file qgis_customwidgets.py that should be located in 
> /usr/lib/python2.7/dist-packages/PyQt4/uic/widget-plugins/
>
> This file can be either installed by the package python-qgis-common or 
> using -WITH_CUSTOM_WIDGETS=TRUE if you compile your own QGIS (I 
> suppose this requires a make install).
>
> Let me know if this helps.
>
> Best wishes,
>
> Denis
>
> On 14.11.2014 16:13, Ziegler Stefan wrote:
>> Hi
>>
>> I sucessfully used QGIS custom widgets (eg. qgscollapsiblegroupbox) 
>> in qt designer in and then with python plugins with 
>> "uic.loadUiType()". Using the "traditional" pyuic approach I get an 
>> missing module error when starting QGIS:
>>
>> ImportError: No module named qgscollapsiblegroupbox
>>
>> I'm on Ubuntu 14.04 with an own compiled QGIS master. Do I have to 
>> put "libqgis_customwidgets.so.2.7.0" somewhere specific? Or is there 
>> anything else I have to do?
>>
>> Regards
>> Stefan
>>
>> Freundliche Grüsse
>> Stefan Ziegler
>> Kantonsgeometer
>>
>> Amt für Geoinformation
>> Amtliche Vermessung
>> Rötistrasse 4
>> 4500 Solothurn
>>
>> Telefon +41 32 627 75 96
>> Telefax +41 32 627 75 98
>> stefan.ziegler at bd.so.ch
>> http://www.so.ch
>>
>>
>> _______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer

-- 
Arnaud Morvan
Ingénieur logiciel
Tél: +33 (0)4 79 26 57 95

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac Cedex
http://www.camptocamp.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20141125/0a50d4fa/attachment.html>


More information about the Qgis-developer mailing list