[Qgis-developer] Newbie plugin developer question

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Tue Sep 29 03:12:23 EDT 2009


On Tue, Sep 29, 2009 at 12:10 AM, Jeff Hamann
<jeff.hamann at forestinformatics.com> wrote:

> 1) I've never written a python program in my life, but given a decent IDE
> I'm sure I can manage it in no time. I've been developing  C/C++ code for 20
> years.

I've never written a C++ program in my life, but pretty much in no
time I figured out how to convert Qt C++ programs into python. Most of
the OO paradigms from C++ map to python very simply. I think I spent
most of the time just converting "foo->bar()" from C++  into
"foo.bar()", and removing semicolons - but you don't even need to
remove the semicolons.

> 3) Users will have local copies of the data(base) and need to sync the data
> with the server (once a week? once a day?)

 Depending on your application you might want to keep the local copy
in an SpatiaLite database. That way there's no need to run PostGIS on
your users machines. Then your sync system would pull out of
SpatiaLite and sync to PostGIS. Obviously if you need all the heavy
geo-lifting that PostGIS does then that's not an option. Just a
thought.

> My question is this:
> Can I develop this plugin using an IDE (Eclipse or Dev Studio)?

 I've never understood IDE's :) With python there's no 'build' step to
speak of, so all I need is a text editor.

> If I go with Python, what gotchas am I running into? Single level menus
> under Plugins or anywhere in menu tree?

 Plugin menu items can go anywhere - you can create a new top-level
menu or squeeze them into any of the existing menu items. This is all
controlled by Qt. Python plugins use the PyQt4 library and so can call
99% of the Qt library methods.

 The only problems you'll get are when Qgis API calls haven't been
implemented in the python interface, but asking nicely on #qgis on IRC
sometimes gets that done. Learning how to do it yourself with SIP (and
as a C++ programmer, you might understand that better than I do!) will
win you massive points.

 There are some things you can't do with C++ or Python plugins because
the behaviour isn't exposed in the API. For example I don't think you
can change the right-click menu in the layer list.

> If I use C++ do I need to build all of QGIS an any platform I want to run
> the plugin on from source?

 Not sure - I suspect that once you've got everything to compile your
plugin then building Qgis would be trivial.

> So far, I've assumed the user will download the OSGEO4W for QGIS, so I've
> assumed they can connect to my repository and install it that way. Is that
> rational regardless of how it's built?

 That's how the repositories are supposed to work!

Barry


More information about the Qgis-developer mailing list