[Qgis-developer] Python bindings
Tim Sutton
tim at linfiniti.com
Wed Jul 16 16:46:42 EDT 2008
Hi Carson
In fact when I changed the plugin interface to remove the deprecated
getToolBox and replace it with addDockWidget, I included sip interface
definitions for it too.
see python/gui/qgisinterface.sip lines 85 & 86
However I found that I needed to do a clean build before they built
again. Try remove your build dir, recreate it and build everything
again. I'm not a python programmer so other than adding the sip stub
there I havent tried it out with any python code yet - I'd be
interested to get some feedback if it works as expected or not.
Also in case it wasnt obvious the change is only in SVN trunk and not
in any released version yet (it also wont be in 0.11.0, only 1.0.0).
Thanks for the additional hints Stefanie. The division between gui and
app is was made really provide a minimal qtgui dependent library that
will support the creation of spatially enabled applications. We had to
choose realistic goals - what we have implemented thus far is the
product of nearly 6 years of work and trying to build a stable set of
pyhon libs around every class would have no doubt lengthened the
process considerably. Be assured we will carry out the planning and
design of version 2.0 of QGIS completely openly and these
considerations are something you should bring to the table when the
time comes.
Regards
Tim Sutton
2008/7/16 Stefanie Tellex <stefie10 at media.mit.edu>:
> Hi Carson,
>
> I'm not a QGIS developer, but I have submitted a couple of patches now
> that add new functions to the python bindings. Here is what I know.
>
> The bindings are generated with SIP, a Qt tool. The best documentation
> I've found for it is here:
> http://www.riverbankcomputing.com/static/Docs/sip4/sipref.html I've
> found SIP fairly intimidating, and I've made the most progress by
> copying examples from functions that already have a python interface.
>
> SIP requires templates that tell it how to convert C++ functions and
> classes to python and vice versa. The code for all that lives in the
> python subdirectory in subversion. Most of that is just specifying
> wrappers for QGIS classes. The scariest part that I've run into so far
> is conversions.sip, that provides wrappers for template-based types in
> the QT container classes.
>
> The other kind of weird thing is that only the stuff in the qgis core
> and gui libraries have python equivalents, and not stuff in the
> application itself. For things like building an editor in python, I had
> to write native python re-implementations of classes like
> qgsmaptoolcapture to draw new objects in the UI. This wasn't too hard,
> but it was annoying. I think some of that code should be moved to the
> gui library...
>
> Thanks for contributing! (And thanks to all the QGIS developers for
> that matter.)
>
> Stefanie
>
> Carson Farmer wrote:
>>
>> Hi all (and Martin),
>>
>> Recently I was working on a plugin and wanted to use some of the functions
>> added in the latest svn, only to find that there were no python bindings
>> available for that function yet (it was QgisInferface's new addDockWidget
>> function). Then it occurred to me, is there anywhere that I can look up what
>> has and has not had bindings completed for it yet? If there is, great, where
>> is it? If not, is this something that would be simple to create?
>>
>> Also, I would like to volunteer to help with the creation of python
>> bindings etc (or some other related task that currently needs attention).
>> Unfortunately, I don't have any real experience with this (just python
>> mostly), so is there some recommended documentation that might help get me
>> started?
>>
>> Cheers,
>>
>> Carson
>> _______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
--
Tim Sutton
QGIS Project Steering Committee Member - Release Manager
Visit http://qgis.org for a great open source GIS
openModeller Desktop Developer
Visit http://openModeller.sf.net for a great open source ecological
niche modelling tool
Home Page: http://tim.linfiniti.com
Skype: timlinux
Irc: timlinux on #qgis at freenode.net
More information about the Qgis-developer
mailing list