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.
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?
1 Answer 1
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 :)
-
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?ar-siddiqui– ar-siddiqui2020年06月03日 13:25:26 +00:00Commented Jun 3, 2020 at 13:25
-
1Not 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)ThomasG77– ThomasG772020年06月03日 14:01:31 +00:00Commented Jun 3, 2020 at 14:01
-
1Do 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.ar-siddiqui– ar-siddiqui2020年06月05日 03:09:25 +00:00Commented Jun 5, 2020 at 3:09
-
1Search string
self.plugin_dir
andlocale_path =
in your generated plugin files for an example (relative path already used for locale e.g translation)ThomasG77– ThomasG772020年06月05日 19:44:42 +00:00Commented Jun 5, 2020 at 19:44
Explore related questions
See similar questions with these tags.