Opened 5 years ago

Closed 3 years ago

#2225 closed enhancement (fixed)

Improvements python shell

Reported by: jradinger Owned by: grass-dev@…
Priority: normal Milestone: 7.0.4
Component: wxGUI Version: unspecified
Keywords: python shell, python tab, pyshell Cc:
CPU: x86-32 Platform: Linux

Description

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)

Change History (3)

comment:1 in reply to:  description Changed 5 years ago by wenzeslaus

Replying to 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?.

comment:2 Changed 3 years ago by wenzeslaus

Component: PythonwxGUI
Keywords: python shell python tab pyshell added
Milestone: 7.0.07.0.4

My Python shell tab has now Paste (Ctrl+V) and Paste Plus (Ctrl+Shift+V) options (see context menu). The second option executes the following as expected:

print "a"
print "bb"
>>> print "a"
a
>>> print "bb"
bb

Again, all depends on the wxPython version. I suggest to close this ticket as solved.

GRASS version: 7.0.4svn                                                         
...
Python: 2.7.10                                                                  
wxPython: 3.0.2.0                                                               
Platform: Linux-4.2.0-34-generic-x86_64-with-Ubuntu-15.10-wily

comment:3 Changed 3 years ago by martinl

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.