[Qgis-developer] New Python console idea: Expanding the Python console to handle DSLs for plugins eg CADTools

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Fri Jun 17 03:27:19 EDT 2011


On Fri, Jun 17, 2011 at 4:36 AM, Nathan Woodrow <madmanwoo at gmail.com> wrote:

> Well would that be such a bad thing? The DSLs can return a object from the
> evaluated string so why not let them be mixed.  This would mean you can do
> things like:
>
> mypythonVar = (SQL:Select Sum(column) From Table)
> #Some more python code to assign the value to a QgsFeature

 Oh I didnt say it was bad, just tricky! Done right it would be good -
Python in Qgis is getting variable values from C++ all the time.

 For example, someone might think they can do:

 > foo = 1 + 2 # python
 > SQL: select * from table where x=foo

In fact, I'd be quite frustrated if I couldn't do that in a single
console. So to implement this, you've got to have some way of getting
variables from one interpreter into another, so you might end up with:

 > SQL: select * from table where x=PYTHON:foo

but now you are parsing everything before it gets to the destination
parser, but that could be ambiguous with the destination language. So
then the console becomes a macro language all of its own...

Barry


More information about the Qgis-developer mailing list