Re: [Qgis-developer] Compiling ui files with custom widgets creates wrong imports

2015-09-29 Thread saverior
A trick is modifing the line in .ui file changing the "header" tag e.g. (for QgsDateTimeEdit widget) original is: QgsDateTimeEdit QDateTimeEdit qgsdatetimeedit.h <---python error looking for "qgsdatetimeedit" module modified is: QgsDateTimeEdit QDateTimeEdit

Re: [Qgis-developer] Compiling ui files with custom widgets creates wrong imports

2015-09-26 Thread Lauri Kajan
I filed a bug http://hub.qgis.org/issues/13428 -Lauri On Thu, Sep 24, 2015 at 7:06 PM, Luigi Pirelli wrote: > Hi Anita > > right click on sourceLayerCombo, in the contextual menu there is > "Promoted Widgets" or "Promote to", there will open the menu with >

Re: [Qgis-developer] Compiling ui files with custom widgets creates wrong imports

2015-09-24 Thread Lauri Kajan
Hi Denis, Unfortunately this seems not to be enough. If pythonpath is set pyuic4 still produces wrong import. Here's my environment and command to compile ui file with QgsMapLayerComboBox. -- C:\OSGeo4W64>echo %PATH%

Re: [Qgis-developer] Compiling ui files with custom widgets creates wrong imports

2015-09-24 Thread Denis Rouzaud
Hi Lauri, hi Jürgen, I think you're right and \apps\qgis-dev\python\PyQt4\uic\widget-plugins\qgis_customwidgets.py should be moved to \apps\Python27\Lib\site-packages\PyQt4\uic\widget-plugins. This file is not intended to change over QGIS versions and is totally generic. In fact, it will load

Re: [Qgis-developer] Compiling ui files with custom widgets creates wrong imports

2015-09-24 Thread Luigi Pirelli
Hi Anita right click on sourceLayerCombo, in the contextual menu there is "Promoted Widgets" or "Promote to", there will open the menu with QgsMapLayerComboBox listed. You can find it's name in "Promoted class"... the error is that in the Line text "header file" have to write the python module

Re: [Qgis-developer] Compiling ui files with custom widgets creates wrong imports

2015-09-21 Thread Denis Rouzaud
Hi all, The path that must be specified as PYTHONPATH is QGIS_PREFIX_PATH/share/qgis/python All the custom widgets have their classes in qgis gui. Therefore, you just need to add the QGIS python path to PYTHONPATH to be able to define properly their import. As Jürgen said there might be

Re: [Qgis-developer] Compiling ui files with custom widgets creates wrong imports

2015-09-21 Thread Anita Graser
Thanks for you reply Luigi! On Sat, Sep 19, 2015 at 10:30 PM, Luigi Pirelli wrote: > I imagine that the fix would be in the QT Creator ui project setting > correctly the include for the promoted widgets (the widget promoted to > a QgsFieldComboBox)... so the error should be in

Re: [Qgis-developer] Compiling ui files with custom widgets creates wrong imports

2015-09-19 Thread Luigi Pirelli
I imagine that the fix would be in the QT Creator ui project setting correctly the include for the promoted widgets (the widget promoted to a QgsFieldComboBox)... so the error should be in the cartogram_dialog_base.ui project let us know regards, Luigi Pirelli

Re: [Qgis-developer] Compiling ui files with custom widgets creates wrong imports

2015-09-19 Thread Lauri Kajan
Hi all, I found this same problem. pyuic4 on osgeo4w environment doesn't fix this. Still the compiled py file tries to import QgsFieldComboBox from qgsfieldcombobox. Is this an error in osgeo4w environment? Possibly some paths are missing from PYTHONPATH or PATH? At least qgis package and its

Re: [Qgis-developer] Compiling ui files with custom widgets creates wrong imports

2015-09-19 Thread Jürgen E . Fischer
Hi Lauri, On Sat, 19. Sep 2015 at 12:11:11 +0300, Lauri Kajan wrote: > The actual problem might be that > C:\OSGeo4W64\apps\qgis-dev\python\PyQt4\uic\widget-plugins\qgis_customwidgets.py > file is not found by pyuic4. > After I copied that file > to

Re: [Qgis-developer] Compiling ui files with custom widgets creates wrong imports

2015-09-19 Thread Lauri Kajan
Hi Jürgen! I think that this can't be fixed by just setting the PYTHONPATH. If I have understood right the problem is that PyQt and its uic module can't find qgis_customwidgets.py or better said 'qgis-dev\python\PyQt4\uic\widget-plugins' directory because it is not told to do so. It is not that

Re: [Qgis-developer] Compiling ui files with custom widgets creates wrong imports

2015-08-06 Thread Anita Graser
On Thu, Aug 6, 2015 at 9:44 AM, Denis Rouzaud denis.rouz...@gmail.com wrote: Well, how is compiled the UI file? ​The plugin builder creates a template that uses uic.loadUiType FORM_CLASS, _ = uic.loadUiType(os.path.join( os.path.dirname(__file__), 'cartogram_dialog_base.ui')) ​ ​So the UI is

Re: [Qgis-developer] Compiling ui files with custom widgets creates wrong imports

2015-08-06 Thread Denis Rouzaud
Never used, I would think it would work directly. But why not adding a new rule to the makefile to compile the ui? On 08/06/2015 10:06 AM, Anita Graser wrote: On Thu, Aug 6, 2015 at 9:44 AM, Denis Rouzaud denis.rouz...@gmail.com mailto:denis.rouz...@gmail.com wrote: Well, how is

Re: [Qgis-developer] Compiling ui files with custom widgets creates wrong imports

2015-08-06 Thread Anita Graser
On Thu, Aug 6, 2015 at 10:10 AM, Denis Rouzaud denis.rouz...@gmail.com wrote: Never used, I would think it would work directly. ​According to the plugin author the plugin with uic.loadUiTypes works on Linux but it certainly does not work on Windows.​ ​ But why not adding a new rule to the

Re: [Qgis-developer] Compiling ui files with custom widgets creates wrong imports

2015-08-06 Thread Denis Rouzaud
You need to have qgis lib in your python path. On windows, that would be C:\OSGeo4W\apps\qgis-dev\python\qgis To check this, just do from qgis.gui import * in python. If you don't have an error, then pyuic4 will work properly. Best wishes, Denis On 08/05/2015 11:27 PM, Anita Graser wrote:

Re: [Qgis-developer] Compiling ui files with custom widgets creates wrong imports

2015-08-06 Thread Anita Graser
On Thu, Aug 6, 2015 at 9:24 AM, Denis Rouzaud denis.rouz...@gmail.com wrote: You need to have qgis lib in your python path. On windows, that would be C:\OSGeo4W\apps\qgis-dev\python\qgis To check this, just do from qgis.gui import * in python. If you don't have an error, then pyuic4 will work

Re: [Qgis-developer] Compiling ui files with custom widgets creates wrong imports

2015-08-06 Thread Anita Graser
On Thu, Aug 6, 2015 at 10:54 AM, Denis Rouzaud denis.rouz...@gmail.com wrote: Here is an example of a Makefile compiling ui files https://github.com/3nids/quickfinder/blob/master/Makefile#L52 it's the line with pyuic4 which does the job! ​Thanks Denis! I'll try that on Win later. I'd

Re: [Qgis-developer] Compiling ui files with custom widgets creates wrong imports

2015-08-06 Thread Denis Rouzaud
Well, how is compiled the UI file? Usually, it is done prior to deployment using pyuic4 If pyuic4 was run without the proper python path, you won't have any error at compilation but the plugin won't work if it contains QGIS widgets. Was pyuic4 run in an Osgeo shell? On 08/06/2015 09:39 AM,

Re: [Qgis-developer] Compiling ui files with custom widgets creates wrong imports

2015-08-06 Thread Denis Rouzaud
Here is an example of a Makefile compiling ui files https://github.com/3nids/quickfinder/blob/master/Makefile#L52 it's the line with pyuic4 which does the job! On 08/06/2015 10:33 AM, Anita Graser wrote: On Thu, Aug 6, 2015 at 10:10 AM, Denis Rouzaud denis.rouz...@gmail.com

[Qgis-developer] Compiling ui files with custom widgets creates wrong imports

2015-08-05 Thread Anita Graser
Hi, There seems to be an issue with custom widgets in Python. For example this plugin bug: ImportError: No module named qgsfieldcombobox ( https://github.com/informeren/qgis-cartogram/issues/2) Compiling with pyuic4 -o cartogram_dialog_base.py cartogram_dialog_base.ui results in from