putting a script that doesn't involve GUI in scripts toolbox

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

putting a script that doesn't involve GUI in scripts toolbox

Reginald
Hello,

In QGIS 2.18 I made a script that created a feature from the selected
Cadastral Parcels. That way I didn't have to draw them manualy.
I want to use this script in QGIS 3 and put it in the Toolbox Processing.
I did some changes to the script like replacing MapLayerRegistry with
QgsProject and such, but at a point when I wanted to test my script I only
get a notice saying "There seems to be no valid script in the file".
I looked at the Python Errors and Warnings dialog but could not find any
log.
How can I put this script in the toolbox? I know there is a template for a
script available but I want to use a script that doesn't open a window: just
click on the script so it executes.
Is this still posible in QGIS 3?

Regards,




--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-User-f4125267.html
_______________________________________________
Qgis-user mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
Reply | Threaded
Open this post in threaded view
|

Re: putting a script that doesn't involve GUI in scripts toolbox

Havard Tveite-3
Hi Reginald,

Python (Processing) scripts in QGIS 3 are much more complicated
than in QGIS 2.  I recently learned that you will get an example
script by choosing "Create new script from template..." under
the "Scripts" icon that is located at the top of the Processing
Toolbox.
Use that script as a starting point.

Håvard

On 28. aug. 2018 09:49, Reginald wrote:

> Hello,
>
> In QGIS 2.18 I made a script that created a feature from the selected
> Cadastral Parcels. That way I didn't have to draw them manualy.
> I want to use this script in QGIS 3 and put it in the Toolbox Processing.
> I did some changes to the script like replacing MapLayerRegistry with
> QgsProject and such, but at a point when I wanted to test my script I only
> get a notice saying "There seems to be no valid script in the file".
> I looked at the Python Errors and Warnings dialog but could not find any
> log.
> How can I put this script in the toolbox? I know there is a template for a
> script available but I want to use a script that doesn't open a window: just
> click on the script so it executes.
> Is this still posible in QGIS 3?
>
> Regards,
>
>
>
>
> --
> Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-User-f4125267.html
> _______________________________________________
> Qgis-user mailing list
> [hidden email]
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>

--
Håvard Tveite
Faculty of Science and Technology, NMBU
Drøbakveien 31, POBox 5003, N-1432 Ås, NORWAY
Phone: +47 67231548   Web: http://www.nmbu.no
_______________________________________________
Qgis-user mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
Reply | Threaded
Open this post in threaded view
|

Re: putting a script that doesn't involve GUI in scripts toolbox

Reginald
Thanks Havard,

So I guess this means that it is impossible to use python scripts without
opening a dialog?
As my script doesn't fit in the template I pasted it in the editor of the
pythonconsole and there it works :-)

Regards,




--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-User-f4125267.html
_______________________________________________
Qgis-user mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
Reply | Threaded
Open this post in threaded view
|

Re: putting a script that doesn't involve GUI in scripts toolbox

Nyall Dawson
On Tue, 28 Aug 2018 at 18:43, Reginald <[hidden email]> wrote:
>
> Thanks Havard,
>
> So I guess this means that it is impossible to use python scripts without
> opening a dialog?

That's not correct - the dialog is shown if your algorithm defines any
input parameters which require user interaction. If you remove all the
input parameters from your algorithm, then no dialog is shown and the
algorithm/script is run immediately.

Nyall
_______________________________________________
Qgis-user mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
Reply | Threaded
Open this post in threaded view
|

Re: putting a script that doesn't involve GUI in scripts toolbox

Reginald

Thanks Nyall,

 

This will get me on the right track. J

 

Regards,

 

Reginald Carlier
Deskundige GIS
Gemeente IngelmunsterOostrozebekestraat 48770 Ingelmunster
T<a href="tel:+32%2051%2033%2074%2039" target="_blank" id="LPlnk689713" style="text-decoration:none;color:#5C676D;">+32 51 33 74 39
www.ingelmunster.be
Facebookinstagrampinteresttwitter
Raadpleeg onze disclaimer 
Van: Nyall Dawson [via OSGeo.org] [mailto:ml+[hidden email]]
Verzonden: dinsdag 28 augustus 2018 11:45
Aan: Reginald Carlier
Onderwerp: Re: putting a script that doesn't involve GUI in scripts toolbox

 

On Tue, 28 Aug 2018 at 18:43, Reginald <[hidden email]> wrote:
>
> Thanks Havard,
>
> So I guess this means that it is impossible to use python scripts without
> opening a dialog?

That's not correct - the dialog is shown if your algorithm defines any
input parameters which require user interaction. If you remove all the
input parameters from your algorithm, then no dialog is shown and the
algorithm/script is run immediately.

Nyall
_______________________________________________
Qgis-user mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


If you reply to this email, your message will be added to the discussion below:

http://osgeo-org.1560.x6.nabble.com/putting-a-script-that-doesn-t-involve-GUI-in-scripts-toolbox-tp5375911p5375927.html

To start a new topic under QGIS - User, email ml+[hidden email]
To unsubscribe from QGIS, click here.
NAML


_______________________________________________
Qgis-user mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user