QGIS Python Integration (Was Re: [Qgis-developer] Re: [Qgis-user] Atlas plugin - create map books)

Martin Dobias wonder.sk at gmail.com
Fri Feb 10 14:29:19 EST 2012


Hi Tim

On Thu, Feb 9, 2012 at 9:50 AM, Tim Sutton <lists at linfiniti.com> wrote:
>
> Still in the context of trying to understand what Martin proposes
> without necessarily endorsing the idea...
>
> Martin how would you see python integration working in the context of
> keeping our existing C++ code base for src/app and extending it with
> python? I assume you are thinking to provide a way to add e.g. a new
> dialog, etc to the app without having to write a plugin? So how did
> you see that working? Would the python layer load after the main app
> is loaded and python elements of the app just attach themselves to the
> mainwindow as a plugin would?

The integration of python with c++ within application code would be
very simple: there would be a qgis.app python module containing
various parts of application functionality. Stuff implemented in
python would have access to qgis.utils.iface (instance of
QgisInterface) like python plugins and console do. Such code would be
triggered directly from c++ code, e.g. slot responsible for showing a
dialog would do just something like
QgisApp::featureXYZ() { runPythonCode("qgis.app.featureXYZ"); }

The only difference from python plugins would be that such
functionality would be always enabled and impossible to remove by user
(just like with other code from src/app).

Martin


More information about the Qgis-developer mailing list