Re: [Qgis-developer] New Python Console

2013-04-03 Thread Jeremy Palmer
No problem at all.

Would be nice though!

From: Salvatore Larosa [mailto:lrssv...@gmail.com]
Sent: Thursday, 4 April 2013 12:37 p.m.
To: Jeremy Palmer
Cc: qgis-developer
Subject: Re: [Qgis-developer] New Python Console

Hi Jeremy,
I was aware, sorry for that.
I am trying to solve this issue although I don't know if this is related to the 
Qsci module.
Thanks.

Regards,
-SL

Il giorno 03/apr/2013 00:01, "Jeremy Palmer" 
mailto:jpal...@linz.govt.nz>> ha scritto:
Hi QGIS devs!

I'm just been playing with the new python console and it's a great improvement 
-many thanks to Salvatore Larosa.

One feature that seems to be missing is the ability for auto-completion to work 
on runtime objects using automatic type inference.

e.g. currently:

>>> iface.activeLayer().

does not bring up autocompletion list for the QgsMaplayer object

Or:

>>> layer = iface.activeLayer()
>>> layer.

does not bring up the autocomplete for the layer object.

Is this a hard thing to implement? Or is it limited by the Qsci module?

Cheers,
Jeremy

This message contains information, which is confidential and may be subject to 
legal privilege. If you are not the intended recipient, you must not peruse, 
use, disseminate, distribute or copy this message. If you have received this 
message in error, please notify us immediately (Phone 0800 665 463 or 
i...@linz.govt.nz<mailto:i...@linz.govt.nz>) and destroy the original message. 
LINZ accepts no responsibility for changes to this email, or for any 
attachments, after its transmission from LINZ. Thank You.
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org<mailto:Qgis-developer@lists.osgeo.org>
http://lists.osgeo.org/mailman/listinfo/qgis-developer
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] New Python Console

2013-04-03 Thread Salvatore Larosa
Hi Jeremy,
I was aware, sorry for that.
I am trying to solve this issue although I don't know if this is related to
the Qsci module.
Thanks.

Regards,

-SL

Il giorno 03/apr/2013 00:01, "Jeremy Palmer"  ha
scritto:

> Hi QGIS devs!
>
> I'm just been playing with the new python console and it's a great
> improvement -many thanks to Salvatore Larosa.
>
> One feature that seems to be missing is the ability for auto-completion to
> work on runtime objects using automatic type inference.
>
> e.g. currently:
>
> >>> iface.activeLayer().
>
> does not bring up autocompletion list for the QgsMaplayer object
>
> Or:
>
> >>> layer = iface.activeLayer()
> >>> layer.
>
> does not bring up the autocomplete for the layer object.
>
> Is this a hard thing to implement? Or is it limited by the Qsci module?
>
> Cheers,
> Jeremy
>
> This message contains information, which is confidential and may be
> subject to legal privilege. If you are not the intended recipient, you must
> not peruse, use, disseminate, distribute or copy this message. If you have
> received this message in error, please notify us immediately (Phone 0800
> 665 463 or i...@linz.govt.nz) and destroy the original message. LINZ
> accepts no responsibility for changes to this email, or for any
> attachments, after its transmission from LINZ. Thank You.
> ___
> Qgis-developer mailing list
> Qgis-developer@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] New Python Console

2013-04-03 Thread Alexander Bruy
Hi Jeremy,

this was already reported some time ago. See http://hub.qgis.org/issues/6333

On Wed, 3 Apr 2013 10:55:34 +1300
Jeremy Palmer  wrote:

> Hi QGIS devs!
> 
> I'm just been playing with the new python console and it's a great 
> improvement -many thanks to Salvatore Larosa.
> 
> One feature that seems to be missing is the ability for auto-completion to 
> work on runtime objects using automatic type inference.
> 
> e.g. currently:
> 
> >>> iface.activeLayer().
> 
> does not bring up autocompletion list for the QgsMaplayer object
> 
> Or:
> 
> >>> layer = iface.activeLayer()
> >>> layer.
> 
> does not bring up the autocomplete for the layer object.
> 
> Is this a hard thing to implement? Or is it limited by the Qsci module?

-- 
Alexander Bruy
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] new python console: nice

2012-11-11 Thread Richard Duivenvoorde

On 11/11/2012 08:13 PM, Salvatore Larosa wrote:


No problem to change it,
do you have any need particular ?


Hi Salvatore,

maybe wait a little before serving me :-)

if I'm correct there will be some initiative to harmonize all the 
different types of help buttons/dialogs and methods to create and show 
them. So QGIS has a more consistent way of serving/giving help :-)


Eg. the choice for bootstrap for the documentation gives us the 
'responsive design' stuff, so the docs/help does easily fit into smaller 
dialogs or even sidebars.


Thanks for the console work!

Richard

___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] new python console: nice

2012-11-11 Thread Salvatore Larosa
Hi,

2012/11/11 Richard Duivenvoorde 

> Hi Devs,
>
> I just compiled master here, and had a look at the new scintilla2 based
> python console.
>
> Really really cool!!!
>
> Thanks so much!
>
> One little wish: I really like the help. But it is a fixed modal dialog,
> what about a floating non modal dialog for that?
>
>
No problem to change it,
do you have any need particular ?

Regards,

-SL



> Regards,
>
> Richard Duivenvoorde
> __**_
> Qgis-developer mailing list
> Qgis-developer@lists.osgeo.org
> http://lists.osgeo.org/**mailman/listinfo/qgis-**developer
>



-- 
Salvatore Larosa
linkedIn: http://linkedin.com/in/larosasalvatore
twitter: @lrssvt
skype: s.larosa
IRC: lrssvt on freenode
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] New Python console: missing icons?

2012-10-05 Thread Giuseppe Sucameli
Hi Salvatore,

On Fri, Oct 5, 2012 at 10:24 AM, Salvatore Larosa  wrote:
> 2012/10/5 Giuseppe Sucameli 
>> we agree that console icons and help should be moved in
>> the proper folders, i.e. respectively images and resources
>> located in the source root.
>
> I agree, regardless of the problem !
> What the right place should be ?

you can move the iconConsole folder to
/images/theme/default/consoleicons

and the helpConsole folder to
/resources/console_help

In you code you can get an icon by using
QgsApplication.getThemeIcon( "/consoleicons/myicon.png" )
which also takes care the theme.

To get the location of the help files use instead
QgsApplication.pkgDataPath() + "/resources/console_help/";

Regards.

>> Salvatore, please could you fix it making a such change?
>> Thanks.
>>
>
> I hope to do as soon as possible !
>
> Regards,
>
> -SL
>
>
>>
>> Regards.
>>
>> [1] http://hub.qgis.org/issues/6456
>>
>> > On Thu, Oct 4, 2012 at 5:49 PM, Paolo Cavallini 
>> > wrote:
>> >> Il 04/10/2012 15:15, Nathan Woodrow ha scritto:
>> >>> Yeah I have both those issues here too.
>> >>>
>> >>>
>> >> Glad I'm not the only one. Just recompiled from master, the issue
>> >> remains.
>> >> Thanks.
>> >>
>> >> --
>> >> Paolo Cavallini - Faunalia
>> >> www.faunalia.eu
>> >> Full contact details at www.faunalia.eu/pc
>> >> Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario
>> >>
>> >> ___
>> >> Qgis-developer mailing list
>> >> Qgis-developer@lists.osgeo.org
>> >> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>> > ___
>> > Qgis-developer mailing list
>> > Qgis-developer@lists.osgeo.org
>> > http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
>>
>>
>> --
>> Giuseppe Sucameli
>
>
>
>
> --
> Salvatore Larosa
> linkedIn: http://linkedin.com/in/larosasalvatore
> twitter: @lrssvt
> skype: s.larosa
> IRC: lrssvt on freenode
>



-- 
Giuseppe Sucameli
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] New Python console: missing icons?

2012-10-05 Thread Salvatore Larosa
Hi,

2012/10/5 Giuseppe Sucameli 

> Hi all, hi Salvatore,
>
> On Thu, Oct 4, 2012 at 6:01 PM, Werner Macho 
> wrote:
> > Not confirmed here .. everything looks fine .. compiled from latest
> > master 5min ago ..
>
> the problem [1] is confirmed: it's present in all the QGis
> installations that uses packages, both self-compiled or
> from repository (nightly).
>
> The issue is due to the current location of the console icons
> in the QGis source tree.
>
> I discussed together with Tim about the better way to fix it,
> we agree that console icons and help should be moved in
> the proper folders, i.e. respectively images and resources
> located in the source root.
>

I agree, regardless of the problem !
What the right place should be ?


>
> Salvatore, please could you fix it making a such change?
> Thanks.
>
>
I hope to do as soon as possible !

Regards,

-SL



> Regards.
>
> [1] http://hub.qgis.org/issues/6456
>
> > On Thu, Oct 4, 2012 at 5:49 PM, Paolo Cavallini 
> wrote:
> >> Il 04/10/2012 15:15, Nathan Woodrow ha scritto:
> >>> Yeah I have both those issues here too.
> >>>
> >>>
> >> Glad I'm not the only one. Just recompiled from master, the issue
> remains.
> >> Thanks.
> >>
> >> --
> >> Paolo Cavallini - Faunalia
> >> www.faunalia.eu
> >> Full contact details at www.faunalia.eu/pc
> >> Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario
> >>
> >> ___
> >> Qgis-developer mailing list
> >> Qgis-developer@lists.osgeo.org
> >> http://lists.osgeo.org/mailman/listinfo/qgis-developer
> > ___
> > Qgis-developer mailing list
> > Qgis-developer@lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>
>
> --
> Giuseppe Sucameli
>



-- 
Salvatore Larosa
linkedIn: http://linkedin.com/in/larosasalvatore
twitter: @lrssvt
skype: s.larosa
IRC: lrssvt on freenode
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] New Python console: missing icons?

2012-10-04 Thread Giuseppe Sucameli
Hi all, hi Salvatore,

On Thu, Oct 4, 2012 at 6:01 PM, Werner Macho  wrote:
> Not confirmed here .. everything looks fine .. compiled from latest
> master 5min ago ..

the problem [1] is confirmed: it's present in all the QGis
installations that uses packages, both self-compiled or
from repository (nightly).

The issue is due to the current location of the console icons
in the QGis source tree.

I discussed together with Tim about the better way to fix it,
we agree that console icons and help should be moved in
the proper folders, i.e. respectively images and resources
located in the source root.

Salvatore, please could you fix it making a such change?
Thanks.

Regards.

[1] http://hub.qgis.org/issues/6456

> On Thu, Oct 4, 2012 at 5:49 PM, Paolo Cavallini  wrote:
>> Il 04/10/2012 15:15, Nathan Woodrow ha scritto:
>>> Yeah I have both those issues here too.
>>>
>>>
>> Glad I'm not the only one. Just recompiled from master, the issue remains.
>> Thanks.
>>
>> --
>> Paolo Cavallini - Faunalia
>> www.faunalia.eu
>> Full contact details at www.faunalia.eu/pc
>> Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario
>>
>> ___
>> Qgis-developer mailing list
>> Qgis-developer@lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
> ___
> Qgis-developer mailing list
> Qgis-developer@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer



-- 
Giuseppe Sucameli
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] New Python console: missing icons?

2012-10-04 Thread Werner Macho
Not confirmed here .. everything looks fine .. compiled from latest
master 5min ago ..



On Thu, Oct 4, 2012 at 5:49 PM, Paolo Cavallini  wrote:
> Il 04/10/2012 15:15, Nathan Woodrow ha scritto:
>> Yeah I have both those issues here too.
>>
>>
> Glad I'm not the only one. Just recompiled from master, the issue remains.
> Thanks.
>
> --
> Paolo Cavallini - Faunalia
> www.faunalia.eu
> Full contact details at www.faunalia.eu/pc
> Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario
>
> ___
> Qgis-developer mailing list
> Qgis-developer@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] New Python console: missing icons?

2012-10-04 Thread Paolo Cavallini
Il 04/10/2012 15:15, Nathan Woodrow ha scritto:
> Yeah I have both those issues here too.
>
>
Glad I'm not the only one. Just recompiled from master, the issue remains.
Thanks.

-- 
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario

___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] New Python console: missing icons?

2012-10-04 Thread Nathan Woodrow
Yeah I have both those issues here too.

- Nathan

On Thu, Oct 4, 2012 at 8:46 PM, Paolo Cavallini  wrote:
> Il 04/10/2012 12:31, Paolo Cavallini ha scritto:
>> Hi all.
>> Just compiled, the icons in the python console aremissing: a local
>> problem, or other have the same?
>> Thanks.
>>
> Also help is a blank window here.
> Anyone confirms?
> Thanks.
>
> --
> Paolo Cavallini - Faunalia
> www.faunalia.eu
> Full contact details at www.faunalia.eu/pc
> Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario
>
> ___
> Qgis-developer mailing list
> Qgis-developer@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] New Python console: missing icons?

2012-10-04 Thread Paolo Cavallini
Il 04/10/2012 12:31, Paolo Cavallini ha scritto:
> Hi all.
> Just compiled, the icons in the python console aremissing: a local
> problem, or other have the same?
> Thanks.
>
Also help is a blank window here.
Anyone confirms?
Thanks.

-- 
Paolo Cavallini - Faunalia
www.faunalia.eu
Full contact details at www.faunalia.eu/pc
Nuovi corsi QGIS e PostGIS: http://www.faunalia.it/calendario

___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


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

2011-06-17 Thread Barry Rowlingson
On Fri, Jun 17, 2011 at 1:55 PM, Nathan Woodrow  wrote:

> Function MyFunction(someStringVar) as String
>    Return "Foo Bar " + someStringVar
> End Function
> And then in the SQL statement.
> UPDATE table SET column = MyFunction("Hello World") where column > 100
> This would call MyFunction() for each feature and call a update.  However
> one shortfall of this is that you couldn't define functions in the
> interactive Mapbasic shell inside MapInfo, meaning that you had to write a
> custom script just to do the above.

 Yes, but I think once you get beyond three-liners you are going to
want to save these things in a file anyway. In python you'd just stuck
them in a .py file and import them. I don't really see typing at the
console as a good place for doing program development to any great
amount.

> Like you said we should just have to find way to say "this is a python
> variable" and "this is part of the string to send to the DSL".   You might
> be able to use something like %%variableName or %%functionName. The console
> would parse the string that goes to the DSL and build a dictionary with
> %%variableName = realPythonVariable and then sends the string and the
> dictionary to the DSL which at that point it's up it to worry about
> evaluating and replacing the values and functions.
> Thoughts?


Yup, if you restrict yourself to putting python variable values into
other languages then that's a possibility. Not sure how you'll be
evaluating python functions with SQL variable argument though? Are you
expecting to be able to do:

 import math
 SQL: select years,months from foo where years > %%math.sqrt(months)

 - since that would mean getting SQL values (months) passed to Python...

 Even simple replacement of python variables us going to be tricky
since python variables can evaluate to all sorts of things - are you
just going to use the 'str' representation?

 A nice list of use cases would be interesting.

 Of course if you are willing to develop this then you can do what you
want :) There doesn't seem to be a lot of interest from the devs...

B
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


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

2011-06-17 Thread Nathan Woodrow
Barry,

I think it could be a pretty powerful and cool thing to at least try out
with the prototype.   I'm a ex MapInfo user and in MapBasic we were able to
call a user defined function in SQL for a update, insert, etc etc.   So you
could do:

Function MyFunction(someStringVar) as String
   Return "Foo Bar " + someStringVar
End Function

And then in the SQL statement.

UPDATE table SET column = MyFunction("Hello World") where column > 100

This would call MyFunction() for each feature and call a update.  However
one shortfall of this is that you couldn't define functions in the
interactive Mapbasic shell inside MapInfo, meaning that you had to write a
custom script just to do the above.

If we could do something like this in the python console and pass functions
and variables to custom DSLs I think it would be quite handy.  Of course the
DSL would have to know how to handle the variables or it would just return a
error.

I know it might not be a easy thing to do but I'm willing to give it a go in
my prototype to flesh it out.

Like you said we should just have to find way to say "this is a python
variable" and "this is part of the string to send to the DSL".   You might
be able to use something like %%variableName or %%functionName. The console
would parse the string that goes to the DSL and build a dictionary with
%%variableName = realPythonVariable and then sends the string and the
dictionary to the DSL which at that point it's up it to worry about
evaluating and replacing the values and functions.

Thoughts?

On Fri, Jun 17, 2011 at 5:27 PM, Barry Rowlingson <
b.rowling...@lancaster.ac.uk> wrote:

> On Fri, Jun 17, 2011 at 4:36 AM, Nathan Woodrow 
> 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
>
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


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

2011-06-17 Thread Yves Jacolin
Hello,

Le vendredi 17 juin 2011 09:27:19, Barry Rowlingson a écrit :
>  > 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...

why not allow the user to force the contents of the console with a python mode 
and other one called DSL via a checkbox or a combo box?

Y.
-- 
Yves Jacolin

http://yjacolin.gloobe.org
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


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

2011-06-17 Thread Barry Rowlingson
On Fri, Jun 17, 2011 at 4:36 AM, Nathan Woodrow  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
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


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

2011-06-16 Thread Nathan Woodrow
I was just thinking about this:

People might think they can mix python variables with variables in
> other DSLs. Which would be tricky.


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


Just a thought.

- Nathan

On Thu, Jun 16, 2011 at 10:27 PM, Barry Rowlingson <
b.rowling...@lancaster.ac.uk> wrote:

> People might think they can mix python variables with variables in
> other DSLs. Which would be tricky.
>
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


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

2011-06-16 Thread Vincent Picavet
Hi,
Le jeudi 16 juin 2011 21:24:21, Charlie Sharpsteen a écrit :
> You may want to look at the IPython console---they have a very nice
> syntax for adding new domain-specific commands which they call "magic
> commands":
> 

Currently Ipython is not compatible with any programe importing Qt stuff. It is 
related to the way they manage threads if I remember well. But everything I 
read regarding this issue lead to a deadend.
So you would have to run it outside of QGIS main program, which in turns leads 
to more issues.
If someone has got some hints about this, they are welcome !
Vincent

>
> http://ipython.org/ipython-doc/dev/interactive/reference.html#magic-comman
> d-system
> 
> For example, say you want to run a Python function as a command:
> 
> def say_hello(self, arg):
>   print("Hello, world!")
> 
> # Grab a hook to the currently running IPython instance:
> import IPython.ipapi
> ip = IPython.ipapi.get()
> 
> # Register a new magic function:
> ip.expose_magic("hello", say_hello)
> 
> 
> Users can they run magic commands directly at the console level using
> a "%command" syntax:
> 
> In [1]: %hello
> Hello, world!
> 
> 
> IPython 0.11 is scheduled to be released at the end of this month and
> has a slightly different api for registering new magic functions:
> 
> # Grab a hook to the currently running IPython instance
> ip = get_ipython()
> 
> # Register a new magic function
> ip.define_magic("hello", say_hello)
> 
> 
> I have always thought IPython would be a good replacement for the
> current QGIS console as it has a lot of features such as
> tab-completion, inline help and interactive object inspection that
> saves users a lot of running back and forth between manual pages and
> their workspace. The 0.11 version even has a frontend that is built in
> PyQt which would make it easy to integrate into QGIS as a plugin.
> IPython 0.11 also provides a parallel and distributed computing
> framework that could have very interesting applications for GIS
> algorithms. I was even working on such a plugin a couple of months
> ago.
> 
> Unfortunately I had to shelve the project as IPython decided to
> migrate to Version 2 of the SIP API in order to be compatible with
> PySide as well as PyQt and to be compatible with the rest of the
> Enthought tools for scientific computing in Python. QGIS uses Version
> 1 of the SIP API which is incompatible with Version 2. QGIS could
> migrate to Version 2, but all plugins that use QString or QVariant in
> their Python code would need to replace these with plain Python
> strings and objects as the QString and QVariant classes are no longer
> needed or defined with the Version 2 API.
> 
> Migrating QGIS to the latest version of the SIP API might be a good
> idea in the long run as I think it may have better support for Python
> 3.  Some of the issues were discussed when PySide decided which API to
> support:
> 
> http://www.pyside.org/docs/pseps/psep-0101.html
> 
> 
> -Charlie
> ___
> Qgis-developer mailing list
> Qgis-developer@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


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

2011-06-16 Thread Charlie Sharpsteen
On Thu, Jun 16, 2011 at 5:27 AM, Barry Rowlingson
 wrote:
> On Thu, Jun 16, 2011 at 12:33 PM, Nathan Woodrow  wrote:
>
>> I would appreciated any feedback anyone has.  I'm not a python expert so the
>> code could be done better if done for real but at the moment it's just rough
>> to get the idea out there.
>
>  I like the idea of supplying console functionality for plugins.
>
>  I don't like the idea of piggybacking via "PREFIX: foo" syntax onto Python.
>
>  People might think they can mix python variables with variables in
> other DSLs. Which would be tricky.
>
>  What might be nice would be if the Python console could exist in a
> tabbed window, and plugins could have an 'open console' option, which
> would add a tab to the python console. This would provide standard
> console functionality and then feed the lines to a handler registered
> by the plugin.
>
>  Maybe you could even have seventeen python console tabs open at once
> next to four SQL command tabs and one interface to the QGIS API
> written in perl?
>
> Barry

You may want to look at the IPython console---they have a very nice
syntax for adding new domain-specific commands which they call "magic
commands":


http://ipython.org/ipython-doc/dev/interactive/reference.html#magic-command-system

For example, say you want to run a Python function as a command:

def say_hello(self, arg):
  print("Hello, world!")

# Grab a hook to the currently running IPython instance:
import IPython.ipapi
ip = IPython.ipapi.get()

# Register a new magic function:
ip.expose_magic("hello", say_hello)


Users can they run magic commands directly at the console level using
a "%command" syntax:

In [1]: %hello
Hello, world!


IPython 0.11 is scheduled to be released at the end of this month and
has a slightly different api for registering new magic functions:

# Grab a hook to the currently running IPython instance
ip = get_ipython()

# Register a new magic function
ip.define_magic("hello", say_hello)


I have always thought IPython would be a good replacement for the
current QGIS console as it has a lot of features such as
tab-completion, inline help and interactive object inspection that
saves users a lot of running back and forth between manual pages and
their workspace. The 0.11 version even has a frontend that is built in
PyQt which would make it easy to integrate into QGIS as a plugin.
IPython 0.11 also provides a parallel and distributed computing
framework that could have very interesting applications for GIS
algorithms. I was even working on such a plugin a couple of months
ago.

Unfortunately I had to shelve the project as IPython decided to
migrate to Version 2 of the SIP API in order to be compatible with
PySide as well as PyQt and to be compatible with the rest of the
Enthought tools for scientific computing in Python. QGIS uses Version
1 of the SIP API which is incompatible with Version 2. QGIS could
migrate to Version 2, but all plugins that use QString or QVariant in
their Python code would need to replace these with plain Python
strings and objects as the QString and QVariant classes are no longer
needed or defined with the Version 2 API.

Migrating QGIS to the latest version of the SIP API might be a good
idea in the long run as I think it may have better support for Python
3.  Some of the issues were discussed when PySide decided which API to
support:

http://www.pyside.org/docs/pseps/psep-0101.html


-Charlie
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


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

2011-06-16 Thread Nathan Woodrow
That sounds like a pretty good idea too.  Shoudn't be too hard to whip up a
prototype for that.

On Thu, Jun 16, 2011 at 10:27 PM, Barry Rowlingson <
b.rowling...@lancaster.ac.uk> wrote:

> On Thu, Jun 16, 2011 at 12:33 PM, Nathan Woodrow 
> wrote:
>
> > I would appreciated any feedback anyone has.  I'm not a python expert so
> the
> > code could be done better if done for real but at the moment it's just
> rough
> > to get the idea out there.
>
>  I like the idea of supplying console functionality for plugins.
>
>  I don't like the idea of piggybacking via "PREFIX: foo" syntax onto
> Python.
>
>  People might think they can mix python variables with variables in
> other DSLs. Which would be tricky.
>
>  What might be nice would be if the Python console could exist in a
> tabbed window, and plugins could have an 'open console' option, which
> would add a tab to the python console. This would provide standard
> console functionality and then feed the lines to a handler registered
> by the plugin.
>
>  Maybe you could even have seventeen python console tabs open at once
> next to four SQL command tabs and one interface to the QGIS API
> written in perl?
>
> Barry
>
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


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

2011-06-16 Thread Barry Rowlingson
On Thu, Jun 16, 2011 at 12:33 PM, Nathan Woodrow  wrote:

> I would appreciated any feedback anyone has.  I'm not a python expert so the
> code could be done better if done for real but at the moment it's just rough
> to get the idea out there.

 I like the idea of supplying console functionality for plugins.

 I don't like the idea of piggybacking via "PREFIX: foo" syntax onto Python.

 People might think they can mix python variables with variables in
other DSLs. Which would be tricky.

 What might be nice would be if the Python console could exist in a
tabbed window, and plugins could have an 'open console' option, which
would add a tab to the python console. This would provide standard
console functionality and then feed the lines to a handler registered
by the plugin.

 Maybe you could even have seventeen python console tabs open at once
next to four SQL command tabs and one interface to the QGIS API
written in perl?

Barry
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer