Outdated version of the documentation. Find the latest one here.

Scrivere un plugin di Processing

In funzione del tipo di plugin che andrai a sviluppare, la migliore opzione sarebbe quella di aggiungerlo come algoritmo di Processing (o un set di essi). Ciò consentirebbe una migliore integrazione all’interno di QGIS, funzionalità aggiuntive (poiché può essere eseguito nei moduli di Processing, come il modellatore o l’interfaccia di processing in serie), e tempistiche di sviluppo più rapide (siccome Processing farà gran parte del lavoro).

This document describes how to create a new plugin that adds its functionality as Processing algorithms.

There are two main mechanisms for doing that:

  • Creating a plugin that adds an algorithm provider: This options is more complex, but provides more flexibility
  • Creating a plugin that contains a set of processing scripts: The simplest solution, you just need a set of Processing script files.

Creating a plugin that adds an algorithm provider

To create an algorithm provider, follow these steps:

  • Installa il plugin Plugin Builder

  • Crea un nuovo plugin usando il Plugin Builder. Quando il Plugin Builder ti chiederà il modello da usare, seleziona “Sorgente di Processing”.

  • Il plugin creato contiene una sorgente con un singolo algoritmo. Il file della sorgente e dell’algoritmo sono entrambi commentati e contengono informazioni su come modificare la sorgente e gli algoritmi aggiuntivi. Fai riferimento ad essi per maggiori informazioni.

Creating a plugin that contains a set of processing scripts

To create a set of processing scripts, follow these steps:

  • Create your scripts as described in the PyQGIS cookbook. All the scripts that you want to add, you should have them available in the Processing toolbox.
  • In the Scripts/Tools group in the Processing toolbox, double-click on the Create script collection plugin item. You will see a window where you should select the scripts to add to the plugin (from the set of available ones in the toolbox), and some additional information needed for the plugin metadata.
  • Click on OK and the plugin will be created.
  • You can add additional scripts to the plugin by adding scripts python files to the scripts folder in the resulting plugin folder.