2

I have written a PyQGIS processing script that can be used from Toolbox. I would like to convert this to plugin and publish. The script is taking input and output from the user through processing algorithm built-in parameter Ccasses.

enter image description here

If I convert this to plugin using the Plugin Builder 3 plugin. Will it generate the same user interface? If not what is the right way of converting a toolbox script to plugin?

Vince
20.5k16 gold badges49 silver badges65 bronze badges
asked May 24, 2020 at 4:17

1 Answer 1

4

You can create a skeleton for processing plugin from the "QGIS plugin builder".

You should more or less use the instructions from this tutorial https://www.qgistutorials.com/sl/docs/3/processing_python_plugin.html You will need to adapt them due to your own plugin particularities.

By default, the generated plugin does not contain the help part (right content) but by adding in your own plugin the method shortHelpString, it works fine (see the ScriptTemplate.py file from the QGIS repo for an ilustration). See below screen capture as a proof :)

capture plugin with processing algorithm

answered May 24, 2020 at 4:30
4
  • Thank you. It looks like this is pretty much all that I need. Do you know if we can tweak the interface as well if we use this approach? For example, I would like to group all my output parameters under the heading of Output Parameters and put them at the bottom? Commented Jun 3, 2020 at 13:25
  • 1
    Not to my knowledge, no GUI reference in the plugin itself (so I don't see how you could tweak). GUI generated by the config from the provider and internal to QGIS (if not, I'm not aware) Commented Jun 3, 2020 at 14:01
  • 1
    Do you know If I have some layer styles files and a table file referenced in my script, how can I publish along that embedded with the plugin so that plugin can work at any machine? Currently, the files are at my C drive and are referenced by the script. Commented Jun 5, 2020 at 3:09
  • 1
    Search string self.plugin_dir and locale_path = in your generated plugin files for an example (relative path already used for locale e.g translation) Commented Jun 5, 2020 at 19:44

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.