Hi,

Thank you for your answer as I think that has got me in the right direction. It 
will either be execAlgorithmDialog or the createAlgorithmDialog you reference.

Unfortunately I’m having a little trouble getting it to find the algorithm I’m 
trying to run at present but that led me to notice what might be a bug. Of 
course it might be intentional but execAlgorithmDialog returns False instead of 
None if it doesn’t find the algorithm. That in turn leads to an error message 
which appears accidental when you run the createAlgorithmDialog function.

I’ve created (probably badly) a pull request 
(https://github.com/qgis/QGIS/pull/31899) to show the line I’m referring to.

It would be good to know how to actually setup and create that pull request 
correctly really but I never have time to get my head around all the processes 
involved. We work on Windows machines which Visual Studio so I never full trust 
the formatting etc but who knows it might be safe on such a small change.

Anyway, it would be useful to know if that is a bug or not and I’m sure I’ll 
work out why it didn’t find my script shortly so thanks for your help 😊

Paul

From: Luigi Pirelli <[email protected]>
Sent: 20 September 2019 07:31
To: Paul Wittle <[email protected]>
Cc: [email protected]
Subject: Re: [QGIS-Developer] Running vs triggering/opening a custom process 
via Python

you can get the dialog of the processing algorithm you want and use that... 
hereafter a snippet


    dialog = processing.createAlgorithmDialog("model:AjustarRasterGCP",

                    {'puntosgcp':zeroDeltaHeighPoints,

                     'rastermdsuav':'',

                     'rastermdtlidar':'',

                     'grass7:r.mapcalc.simple_1:Raster MDS_UAV 
Ajustado':QgsProcessing.TEMPORARY_OUTPUT,

                     
'saga:thinplatesplinetin_1:ErrorSurface':QgsProcessing.TEMPORARY_OUTPUT})

    dialog.show()

Luigi Pirelli

**************************************************************************************************
* LinkedIn: https://www.linkedin.com/in/luigipirelli
* Stackexchange: http://gis.stackexchange.com/users/19667/luigi-pirelli
* GitHub: https://github.com/luipir
* Book: Mastering QGIS3 - 3rd 
Edition<https://www.packtpub.com/eu/application-development/mastering-geospatial-development-qgis-3x-third-edition>
* Hire a team: http://www.qcooperative.net
**************************************************************************************************


On Thu, 19 Sep 2019 at 12:49, Paul Wittle 
<[email protected]<mailto:[email protected]>> 
wrote:
Hi,

Sorry if this is a bit of a simple question.

I have created a script in the processing toolbox and it opens a dialogue box 
when you double click on it (as you would expect). Given that many users may 
not understand or even open the processing toolbox I want to trigger the script 
using a button in my custom plugin.

I know you can use processing.run(script/model, parameters) but I don't know 
the parameters and I don't want to recreate the dialogue box in my plugin.

Is there a python command to simply trigger/open a process to run (replicate 
clicking on it in the toolbox)?

Thanks,
Paul
This e-mail and any files transmitted with it are intended solely for the use 
of the individual or entity to whom they are addressed. It may contain 
unclassified but sensitive or protectively marked material and should be 
handled accordingly. Unless you are the named addressee (or authorised to 
receive it for the addressee) you may not copy or use it, or disclose it to 
anyone else. If you have received this transmission in error please notify the 
sender immediately. All traffic may be subject to recording and/or monitoring 
in accordance with relevant legislation. Any views expressed in this message 
are those of the individual sender, except where the sender specifies and with 
authority, states them to be the views of Dorset Council. Dorset Council does 
not accept service of documents by fax or other electronic means. Virus 
checking: Whilst all reasonable steps have been taken to ensure that this 
electronic communication and its attachments whether encoded, encrypted or 
otherwise supplied are free from computer viruses, Dorset Council accepts no 
liability in respect of any loss, cost, damage or expense suffered as a result 
of accessing this message or any of its attachments. For information on how 
Dorset Council processes your information, please see 
www.dorsetcouncil.gov.uk/416433<http://www.dorsetcouncil.gov.uk/416433>
_______________________________________________
QGIS-Developer mailing list
[email protected]<mailto:[email protected]>
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
This e-mail and any files transmitted with it are intended solely for the use 
of the individual or entity to whom they are addressed. It may contain 
unclassified but sensitive or protectively marked material and should be 
handled accordingly. Unless you are the named addressee (or authorised to 
receive it for the addressee) you may not copy or use it, or disclose it to 
anyone else. If you have received this transmission in error please notify the 
sender immediately. All traffic may be subject to recording and/or monitoring 
in accordance with relevant legislation. Any views expressed in this message 
are those of the individual sender, except where the sender specifies and with 
authority, states them to be the views of Dorset Council. Dorset Council does 
not accept service of documents by fax or other electronic means. Virus 
checking: Whilst all reasonable steps have been taken to ensure that this 
electronic communication and its attachments whether encoded, encrypted or 
otherwise supplied are free from computer viruses, Dorset Council accepts no 
liability in respect of any loss, cost, damage or expense suffered as a result 
of accessing this message or any of its attachments. For information on how 
Dorset Council processes your information, please see 
www.dorsetcouncil.gov.uk/416433
_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to