This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: IDLE - add "paste code" functionality
Type: enhancement Stage: patch review
Components: IDLE Versions: Python 3.10
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: terry.reedy
Priority: normal Keywords: patch

Created on 2007-09-18 22:03 by taleinat, last changed 2022-04-11 14:56 by admin.

Files
File name Uploaded Description Edit
IDLE_paste_code.070918.patch taleinat, 2007-09-18 22:03
Messages (7)
msg56017 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2007-09-18 22:03
Patch adding a 'Paste Code' item to the 'Edit' menu, as well as hotkeys.

Using 'Paste Code' instead of the normal paste will remove prompts ('>>>
' or '... ') from the code, and also remove empty lines if pasting to a
shell window.

This allows easily copy/pasting code between shell and editor windows,
as well as easily pasting code from other applications (e.g. a web
browser) into IDLE.

This patch uses IDLE's PyParse.py for parsing code, and Tk's clipboard
API for interaction with the clipboard (it changes the clipboard's
contents, generates a normal paste event, and changes the contents back).

Test only on WinXP SP2 so far, needs to be tested on other platforms,
especially the clipboard interaction.
msg116565 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-09-16 15:59
This has already been implemented.
msg122040 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2010-11-22 00:23
(Reopening as the previous message appears to be incorrect.)
msg122480 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-11-26 22:36
I would really like something like this -- for 3.2b1 next week.
I am constantly running posted interactive code and the lack of this is a major nuisance. There seems to be a glitch in how the editor deals with '>>> ' when trying to delete it.

However, as well as removing '>>> ' and '... ' from code lines,
I would like it to add '# ' to output lines. I do not see that in the patch.

Since I have XP also (and access to Win7) I would consider this working on those two sufficient reason to commit. As near as I can tell, the patch cannot possibly break other systems as long as the feature is not used. Once in the beta, it could get wider testing.
msg122481 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-11-26 22:45
An alternative approach would be to leave pasting alone but add a 
'Convert interactive code' option to the format menu, with keycode alt-v (not currently used as far as I can see).
msg209851 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-02-01 00:13
By already implemented, I presume Mark was referring to the PastePyShell.py extension that is part of the IdleX package http://idlex.sourceforge.net/. I plan to take a look.
msg371443 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-06-13 08:27
I would like to add 'Save code' to the Shell menu, but this would still be needed.  A strip_noncode function could be shared.
History
Date User Action Args
2022-04-11 14:56:27adminsetgithub: 45519
2020-06-13 08:27:41terry.reedysetversions: + Python 3.10, - Python 3.2
nosy: - ronaldoussoren, gpolo, THRlWiTi

messages: + msg371443

assignee: terry.reedy
2014-12-02 07:10:57ned.deilysetnosy: - ned.deily
2014-12-02 04:30:09THRlWiTisetnosy: + THRlWiTi
2014-02-04 12:10:06taleinatsetnosy: - taleinat
2014-02-01 00:13:41terry.reedysetmessages: + msg209851
2010-11-26 22:45:13terry.reedysetmessages: + msg122481
2010-11-26 22:36:03terry.reedysetpriority: low -> normal
nosy: + terry.reedy, - nobody
messages: + msg122480
2010-11-22 00:23:55ned.deilysetstatus: closed -> open

assignee: nobody -> (no value)
versions: + Python 3.2, - Python 3.1, Python 2.7
nosy: + ned.deily, - BreamoreBoy
messages: + msg122040
resolution: fixed ->
stage: patch review
2010-09-16 15:59:11BreamoreBoysetstatus: open -> closed

nosy: + BreamoreBoy
messages: + msg116565

resolution: fixed
2009-04-26 22:10:37ajaksu2setnosy: + gpolo

versions: + Python 3.1, Python 2.7, - Python 2.6
2007-09-18 23:46:27jafosetassignee: ronaldoussoren -> nobody
nosy: + nobody
2007-09-18 23:45:43jafosetpriority: low
assignee: ronaldoussoren
type: behavior -> enhancement
keywords: + patch
nosy: + ronaldoussoren
2007-09-18 22:03:30taleinatcreate