|
msg50765 - (view) |
Author: Tal Einat (taleinat) *  |
Date: 2006-07-27 00:13 |
Here is my improved version of Squeezer - the IDLE
extension to end all of your
oh-no-I-just-printed-War-and-Peace-in-the-interpreter
troubles!
Changes:
* Fixed line counting logic
* Line counting is done according to current window
width and current tab width
* Fixed configHandler to enable reading of raw data
from config files (100% backwards compatible) - needed
by Squeezer to enable configuration of text viewers in
config-extensions
I've been working this vesion without a hitch for
several weeks, but that's hardly enough testing is it?
Attached:
* the original Squeezer.py by Noam Raphael
* a diff against Noam's original Squeezer.py
* a diff of configHandler.py against the current SVN
version (revision 46863)
* fixed 'middle click to copy' - now works on Windows
One minor note - the 'middle click to copy' didn't work
on Windows because it simply called selection_own()
which doesn't affect the clipboard. I added
clipboard_clear() and clipboard_append() and it now
works on Windows. This should be tested on Linux, Unix,
OSX etc. to check compatibility.
For more info on the clipboard issue, see:
http://groups.google.com/group/comp.lang.python/browse_thread/thread/647feeef55625733/bc08421d8aea9928?lnk=st&q=&rnum=2#bc08421d8aea9928
|
|
msg50766 - (view) |
Author: Kurt B. Kaiser (kbk) *  |
Date: 2006-07-27 02:49 |
Logged In: YES
user_id=149084
OK, thanks. Please take a look at the two diffs you
uploaded, they seem corrupted. Squeezer.py looks ok.
|
|
msg50767 - (view) |
Author: Tal Einat (taleinat) *  |
Date: 2006-07-30 11:09 |
Logged In: YES
user_id=1330769
Uploaded unified diffs instead of standard diffs. Probably
the first diffs had bad newlines because I'm working on Win.
Also 2 changes:
* minor fix - end case when clicking at beginning of text block
* Allow squeezing of stderr (tracebacks...)
|
|
msg50768 - (view) |
Author: Kurt B. Kaiser (kbk) *  |
Date: 2006-07-30 14:20 |
Logged In: YES
user_id=149084
Ah, that's better. Thanks.
|
|
msg50769 - (view) |
Author: Kurt B. Kaiser (kbk) *  |
Date: 2007-02-05 06:05 |
Delete the patch to configHandler.py, implemented with Patch 1650174.
|
|
msg84637 - (view) |
Author: Tal Einat (taleinat) *  |
Date: 2009-03-30 20:24 |
"Test needed"? I'll need a bit of guidance on this.
Has there been a change of policy of which I'm not aware, that patches
to IDLE not going to be accepted unless comprehensive tests are included?
Much of IDLE doesn't include tests, e.g. the RPC code. There's a comment
by K.B.K. in the end of rpc.py from September '03 saying we need a
proper test suite for it, and testing that should be simple compared to
testing GUI related functionality.
In any case, if someone can suggest a simple approach to test Squeezer
I'll gladly work it up. As it is, I can think of ways to test certain
functions, but I'm not sure how to approach testing GUI related
functionality (or if I should approach this at all).
|
|
msg84645 - (view) |
Author: Daniel Diniz (ajaksu2) |
Date: 2009-03-30 20:48 |
Tal,
There is no such policy AFAIK. The stage field is a tool to help us
handle the issues, sorry to give you a wrong impression. If IDLE has no
tests, 'test needed' doesn't apply here, so we can set this to 'patch
review'.
If someone is already working on adding tests for IDLE, please revert
this to 'test needed'.
|
|
msg84657 - (view) |
Author: Tal Einat (taleinat) *  |
Date: 2009-03-30 21:36 |
Daniel, Thanks for clearing that up :)
|
|
msg210296 - (view) |
Author: Tal Einat (taleinat) *  |
Date: 2014-02-05 10:01 |
Ping?
Can this please go in? It's such a great improvement to user experience!
I've seen too many novice users print a ton of output by accident and have IDLE hang as a result, losing their interactive session. This simple extension avoid those issues completely, while still allowing access to the output if needed.
I'd even be willing to do any extra work required, such as testing on Windows, Linux and OSX. Just tell me what's holding this up!
|
|
msg210310 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2014-02-05 13:23 |
Could you please provide a patch which applies to default branch?
There is other proposed solution for the problem of large output: issue1442493.
|
|
msg211027 - (view) |
Author: Tal Einat (taleinat) *  |
Date: 2014-02-11 21:58 |
Here's a completely re-written patch!
The patch is against current 3.3 (changeset 360976a6d8b9), since that's what Terry requested recently on issue3068. It also applies cleanly to the current default branch (changeset 360976a6d8b9).
This patch has cleaner, modern code, with doc-strings everywhere and informative comments where appropriate. It also uses "import tkinter as tk" as Terry recently requested on issue3068.
Furthermore, I've added a very complete set of tests for the new extension, which tests everything I could think of and achieves 100% coverage (!) of Squeezer.py. These are modern tests which make extensive use of mocking via the awesome unittest.mock module. I've included extensive in-code comments with the tests. Hopefully these will be useful as a reference for writing additional tests for IDLE code (at least other extensions).
Finally, this patch includes a minor change to ToolTip.py, adding the ability to specify the delay after which a tooltip is displayed (was hard-coded to 1.5 seconds). This change is required by the extension (I prefer that it uses tooltips with no delay).
|
|
msg211068 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2014-02-12 09:43 |
Expanded text still makes IDLE unresponsible. Try print('a'*10000000).
I think it will be better to output first 100 lines and a button "More", pressing on which expands next 100 lines.
|
|
msg211071 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2014-02-12 09:55 |
During experiments I got following message on terminal:
Exception in Tkinter callback
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/tkinter/__init__.py", line 1482, in __call__
return self.func(*args)
File "/home/serhiy/py/cpython/Lib/tkinter/__init__.py", line 534, in callit
func(*args)
File "/home/serhiy/py/cpython/Lib/idlelib/ToolTip.py", line 44, in showtip
x = self.button.winfo_rootx() + 20
File "/home/serhiy/py/cpython/Lib/tkinter/__init__.py", line 845, in winfo_rootx
self.tk.call('winfo', 'rootx', self._w))
_tkinter.TclError: bad window path name ".3066068076.3066068332.text.3048812460"
May be it is unrelated.
|
|
msg211075 - (view) |
Author: Tal Einat (taleinat) *  |
Date: 2014-02-12 10:07 |
Regarding the tooltip traceback, seems like that could be related. I added a tooltip to the "squeezed text" buttons, with no delay, so perhaps there's some kind of race condition?
Could you try changing "delay=0" in the code to "delay=50" and see if the issue goes away?
I would test this myself if you could specify how to reproduce that error.
|
|
msg211076 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2014-02-12 10:26 |
I'm not able to reproduce the problem after the first time (even with
"delay=0").
|
|
msg211083 - (view) |
Author: Tal Einat (taleinat) *  |
Date: 2014-02-12 11:18 |
Indeed, expanding very long texts still degrades the performance of IDLE. But the user has to explicitly expand the text (by double-clicking the button) and can easily squeeze the text again.
As for your suggestion to show just the first several lines and a "more..." button, that would be a significantly more complex solution. It is already easy to preview the squeezed text, either by launching an external viewer or by copying the text to the clipboard.
Yes, a user could still get large amount of text in the shell by expanding large squeezed text. In other words, a user can still shoot himself in the foot; but now he'd have to purposefully aim the shotgun at his foot first.
|
|
msg211643 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2014-02-19 18:51 |
The test emits a lot of warnings.
|
|
msg211645 - (view) |
Author: Tal Einat (taleinat) *  |
Date: 2014-02-19 18:53 |
Serhiy, which warnings?
Some of the tests use Tk GUI elements, so they include "requires('gui')". You need to run the tests with a proper environment so that these tests are run; otherwise you get a warning that the 'gui' resource in unavailable.
|
|
msg211646 - (view) |
Author: Tal Einat (taleinat) *  |
Date: 2014-02-19 18:54 |
See related issue6143 "IDLE - an extension to clear the shell window", where special support for Squeezer is required in that extension (patch included there).
|
|
msg211647 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2014-02-19 19:00 |
Mainly deprecation warnings about assertEquals(). Run
./python -Wall -b -m test.regrtest -vuall test_idle
|
|
msg212021 - (view) |
Author: Tal Einat (taleinat) *  |
Date: 2014-02-23 18:52 |
See msg212020 for a Python-style explanation of the utility of the Squeezer extension.
|
|
msg212061 - (view) |
Author: Tal Einat (taleinat) *  |
Date: 2014-02-24 06:39 |
Added screenshot of what working with the IDLE shell with the Squeezer extension looks like (on Windows).
Note that the second squeezed text is the very long "Max recursion depth" exception traceback, which I manually squeezed after it was printed.
|
|
| Date |
User |
Action |
Args |
| 2014-02-24 06:39:59 | taleinat | set | files:
+ Squeezer_Screenshot.PNG
messages:
+ msg212061 |
| 2014-02-23 18:52:56 | taleinat | set | messages:
+ msg212021 |
| 2014-02-19 19:00:27 | serhiy.storchaka | set | messages:
+ msg211647 |
| 2014-02-19 18:54:37 | taleinat | set | messages:
+ msg211646 |
| 2014-02-19 18:53:35 | taleinat | set | messages:
+ msg211645 |
| 2014-02-19 18:51:10 | serhiy.storchaka | set | messages:
+ msg211643 |
| 2014-02-12 11:18:16 | taleinat | set | messages:
+ msg211083 |
| 2014-02-12 10:26:28 | serhiy.storchaka | set | messages:
+ msg211076 |
| 2014-02-12 10:07:22 | taleinat | set | messages:
+ msg211075 |
| 2014-02-12 09:55:05 | serhiy.storchaka | set | messages:
+ msg211071 |
| 2014-02-12 09:43:47 | serhiy.storchaka | set | messages:
+ msg211068 |
| 2014-02-12 08:56:02 | taleinat | set | nosy:
+ terry.reedy, roger.serwy
|
| 2014-02-11 21:58:22 | taleinat | set | files:
+ taleinat.20140211.IDLE_Squeezer.patch
messages:
+ msg211027 |
| 2014-02-05 13:23:13 | serhiy.storchaka | set | messages:
+ msg210310 stage: patch review -> needs patch |
| 2014-02-05 10:01:40 | taleinat | set | messages:
+ msg210296 |
| 2012-10-16 20:43:57 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka
versions:
+ Python 3.4, - Python 3.2 |
| 2010-08-22 01:57:30 | BreamoreBoy | set | versions:
+ Python 3.2, - Python 3.1, Python 2.7 |
| 2009-03-30 21:36:31 | taleinat | set | messages:
+ msg84657 |
| 2009-03-30 20:48:30 | ajaksu2 | set | nosy:
+ ajaksu2
messages:
+ msg84645 stage: test needed -> patch review |
| 2009-03-30 20:24:44 | taleinat | set | messages:
+ msg84637 |
| 2009-03-30 04:35:33 | ajaksu2 | set | nosy:
+ gpolo versions:
+ Python 3.1, Python 2.7, - Python 2.6
type: enhancement stage: test needed |
| 2009-03-21 00:45:51 | ajaksu2 | link | issue1442493 dependencies |
| 2008-01-06 12:08:08 | christian.heimes | set | assignee: kbk versions:
+ Python 2.6 |
| 2006-07-27 00:13:56 | taleinat | create | |