moohaad / pyscripter

Automatically exported from code.google.com/p/pyscripter
0 stars 0 forks source link

Copy..Paste To and From Interpreter like wxPython's PyShell #183

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Two features that seem very handy from wxPython's
PyShell interpreter: It treats code pasted into the interpreter as if
was typed in, and code coped from the interpreter is stripped of the
the prompts so it can be used as is in module. Examples and contrasts
with PyScripter below:

1) Treats code pasted to the interpreter as if it was typed in. Such
that a snippit can be taken from a web page, whatever, and tried out
interactively. For example, the code:

class A(object):
     pass

When pasted into PyCrust looks like:

>>> class A(object):

...     pass
...

And then you can interact with it:

>>> a = A()
>>> a

<__main__.A object at 0x01C44950>

Contrasted with the result in PyScripter:

>>> class A(object):
     pass
>>> a = A()

Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
NameError: name 'A' is not defined

Note that in PyShell 'Paste' is not 'Paste and Run'. There is a
separate command, Ctrl-Shift-V, for that. Sort of like Alt-F7, but
from ^any^ source.

2) Interpreter prompts are stripped from code copied from the
interpreter. Then pasted code is usable in a module. Say you work
something out in the interpreter, and want to incorporate it back into
the code. So if this is copied from the interpreter:

>>> class A(object):

...     pass

And then pasted into (any) editor, the result is:

class A(object):
     pass

Where from PyScriptor, the prompts are left to be cleaned up as a
separate step:

>>> class A(object):

...     pass

Block copy won't work because even with 'allow cursor past end of
line' because the selected column won't go past the last column on the
last line.

'Copy History' does not help because i have interpreter history set to 200
lines so I can look back at longer results, and 'Copy History' always
copies ^all^ this history, not what's highlighted. 

Original issue reported on code.google.com by thyn...@gmail.com on 2 Jan 2008 at 12:25

GoogleCodeExporter commented 9 years ago
Will try to improve things in a future version.

Original comment by pyscripter on 2 Jan 2008 at 7:01

GoogleCodeExporter commented 9 years ago

Original comment by pyscripter on 3 Jan 2008 at 3:07

GoogleCodeExporter commented 9 years ago
Fixed in Version Control.
Two new interpreter commands added:  Copy (No Prompts) and Paste (With Prompts).

Original comment by pyscripter on 7 Mar 2008 at 3:03