[GRASS-dev] [GRASS GIS] #2225: Improvements python shell

#2225: Improvements python shell
-------------------------+--------------------------------------------------
Reporter: jradinger | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: Python | Version: unspecified
Keywords: | Platform: Linux
      Cpu: x86-32 |
-------------------------+--------------------------------------------------
There are 3 small issues where the GUI python shell (tested in G7) can be
greatly improved:

1) Unlike other command shells it is possible to move the cursor to
positions even before the first position (indicated by the ">>>" symbol. I
don't know if this is a desired effect or is useful in any case?

2) When copy-pasting two python command into the shell, only one (the
first) one is processed. E.g.:

grass.read_command("g.version")
grass.read_command("g.version", flags="e")
GRASS 7.0.svn (2014)

3) At the moment it is not possible to get past commands (command history
like in the Terminal) with the arrow up key. Using the arrow key causes
the cursor moving up (see issue 1)

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2225&gt;
GRASS GIS <http://grass.osgeo.org>

#2225: Improvements python shell
-------------------------+--------------------------------------------------
Reporter: jradinger | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: Python | Version: unspecified
Keywords: | Platform: Linux
      Cpu: x86-32 |
-------------------------+--------------------------------------------------

Comment(by wenzeslaus):

Replying to [ticket:2225 jradinger]:
> There are 3 small issues where the GUI python shell (tested in G7) can
be greatly improved:
>
> 1) Unlike other command shells it is possible to move the cursor to
positions even before the first position (indicated by the ">>>" symbol. I
don't know if this is a desired effect or is useful in any case?

At least you cannot write there. I think it is a bug, I don't see any use
case.

>
> 2) When copy-pasting two python command into the shell, only one (the
first) one is processed. E.g.:
>
> grass.read_command("g.version")
> grass.read_command("g.version", flags="e")
> GRASS 7.0.svn (2014)

True, this is strange behavior. Pasting
{{{
print "a"
print "bb"
}}}
prints just `a`. Note that second command is not really executed (tested
with a = 1 and a += 1). While pasting
{{{
for a in [1, 2, 3]:
     print a
}}}
works as expected.

>
> 3) At the moment it is not possible to get past commands (command
history like in the Terminal) with the arrow up key. Using the arrow key
causes the cursor moving up (see issue 1)

You can use Ctrl and arrows, this will move you thought history. The
question is if just arrow key wouldn't be better.

I'm afraid that most of these problems are in the underlying wxPython
PyShell.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2225#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>