Re: [QGIS-Developer] Processing Script addLayerToLoadOnCompletion

2018-09-03 Thread matteo
Hi Håvard,

I knew that param has been replaced with parameters..

Anyway, removing parameters is not solving the problem

Thanks

Matteo

On 09/03/2018 06:07 PM, Havard Tveite wrote:
> "parameters=" should be removed in the run method.
> 
> Håvard
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] Processing Script addLayerToLoadOnCompletion

2018-09-04 Thread Luigi Pirelli
are you reloading processing plugin? the temporary path of processing are
statically set once (c++ static var in QgsProcessingUtils) for qgis session
=> if you reload the processing plugin without exitig processing (e.g. to
update the list of scripts), the oldtemp folder is no more available but
still referenced => generating strange errors at the end of any process.
Just rerun qgis to check if this is the problem.

There is no easy fix other that avoid static variable end method (e.g.
refactoring) of QgsProcessignUtils, bts is not a common use case errors,
but only happens to script developers => no fix is necessary.

Luigi Pirelli

**
* LinkedIn: https://www.linkedin.com/in/luigipirelli
* Stackexchange: http://gis.stackexchange.com/users/19667/luigi-pirelli
* GitHub: https://github.com/luipir
* Mastering QGIS 2nd Edition:
*
https://www.packtpub.com/big-data-and-business-intelligence/mastering-qgis-second-edition
* Hire me: http://goo.gl/BYRQKg
**


On Mon, 3 Sep 2018 at 16:52, matteo  wrote:

> Hi all,
>
> I was thinking to add a small example of addLayerToLoadOnCompletion
> function to the ScriptTemplate of Processing. The code is the following:
>
> buffered_layer = processing.run("native:buffer", parameters={
> 'INPUT': dest_id,
> 'DISTANCE': 1,
> 'SEGMENTS': 5,
> 'END_CAP_STYLE': 0,
> 'JOIN_STYLE': 0,
> 'MITER_LIMIT': 2,
> 'DISSOLVE': False,
> 'OUTPUT': 'memory:'
> }, context=context, feedback=feedback)['OUTPUT']
>
> feedback.pushDebugInfo(str(dest_id))
>
> context.addLayerToLoadOnCompletion(buffered_layer.source(),
> context.LayerDetails(
> name='new_layer',
> project=context.project()
> ))
>
> but Processing always throws this error:
>
> The following layers were not correctly
>
> generated.Polygon?crs=EPSG:3003&field=ID:long(10)&field=fk:string(254)&field=ROTAZ:long(10)&field=DIMENS:long(10)&field=ETICHETTA:string(254)&field=VALORE:long(10)&field=T_MIN:double(20,5)&field=T_MAX:double(20,5)&field=PIOGGIA:double(20,5)&field=LARGH:double(20,5)&field=LUNG:double(20,5)&field=assex:string(254)&field=assey:string(254)&field=colore:string(38)&field=xlab:double(10,2)&field=ylab:double(10,2)&field=raster:double(23,15)&field=raster_1:double(23,15)&field=raster_2:double(23,15)&uid={685540af-711d-462b-a9d0-9b00af4c2f6a}You
> can check the 'Log Messages Panel' in QGIS main window to find more
> information about the execution of the algorithm.
>
>
> Am I missing something?
>
> Thanks for any suggestion
>
> Matteo
>
>
>
> ___
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] Processing Script addLayerToLoadOnCompletion

2018-09-04 Thread matteo
Hi Ginetto,

well actually this is a simple script and not Processing plugin, so I
think no reloading is needed

Cheers

Matteo
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer