PyQGIS Plugin Builder

February 21, 2009
By

One of the hurdles in developing a QGIS plugin with Python is just getting the basics down. Getting the plugin setup so it is recognized by QGIS and properly adds it’s menu and toolbar items can be a bit of a chore, especially the first time.

To make the process easier, I put together a web tool to generate a plugin that can be used as a starting point. The tool creates a fully functional plugin that can be loaded in QGIS 1.x. The generated plugin contains an icon and a simple dialog with Ok and Cancel buttons.

Give the PyQGIS Plugin Builder a try and feel free to provide comments and suggestions.

5 Responses to PyQGIS Plugin Builder

  1. Germán on July 1, 2009 at 7:22 am

    Hi Gary.

    I did try the tool and get a .zip, but I see this:

    * I get three main .py files:
    – miplugin.py
    – mipluginDialog.py
    – Ui_miplugin.py
    But also I get another three files:
    – MiPlugin.py
    – MiPluginDialog.py
    – Ui_MiPlugin.py

    Those files aren’t linked or loaded in the plugin, so I guess I can remove them. Also the contents doesn’t fix with the info that I put in the web form and shows test information like: “begin:2009-02-24″

    * When I try to run the plugin in QGis, by clicking the button I get a Python error:

    line 30, in __init__
    self.ui.setupUi(self)
    TypeError: unbound method setupUi() must be called with Ui_miplugin instance as first argument (got mipluginDialog instance instead)

    Thanks by the tool, it’s useful.

  2. Gary on July 1, 2009 at 9:26 pm

    There was a problem with the Plugin Builder. Give it another go.

  3. Germán on July 2, 2009 at 5:32 am

    Still getting unnecessary files.

  4. Gary on July 2, 2009 at 10:06 am

    Those are left over from a previous run of the builder. I’ve fixed it now…

  5. Germán on July 3, 2009 at 7:26 am

    Thanks Gary. It works now.

Leave a Reply

Your email address will not be published. Required fields are marked *

*