classification
Title: idle help is modal
Type: enhancement Stage: resolved
Components: IDLE Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: doko, eric.araujo, gpolo, kbk, ned.deily, python-dev, roger.serwy, terry.reedy
Priority: normal Keywords: patch

Created on 2004-06-01 18:05 by doko, last changed 2012-02-05 20:48 by roger.serwy. This issue is now closed.

Files
File name Uploaded Description Edit
help_nonmodal.diff gpolo, 2008-03-22 21:35 review
help_nonmodal_updated.patch roger.serwy, 2012-02-04 19:28 review
help_nonmodal_updated2.patch roger.serwy, 2012-02-04 22:39 review
help_nonmodal_revision.patch roger.serwy, 2012-02-05 04:24 review
Messages (16)
msg54173 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2004-06-01 18:05
[forwarded from http://bugs.debian.org/252130]

the idle online help is unfortunately modal so that one cannot have the 
help window open and read it, and at the same time work in idle. One 
must close the help window before continuing in idle which is a 
nuisance. 
msg54174 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2004-06-04 05:19
Logged In: YES 
user_id=149084

Making this an RFE.  If you have time to work up a patch,
that would be a big help.
msg54175 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2004-06-17 23:58
Logged In: YES 
user_id=149084

Raymond, I'm not planning on working on this now.
Please don't assign it to me again.
msg64340 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2008-03-22 21:35
Hi,

This patch makes Help dialog executes as nonmodal. I added a new button
at textView.py to demonstrate the behavior, also, I created a decorator
called _singledialog at EditorWindow so just one Help window executes at
a time, trying to start a new brings the current one to the front.

I hope this issue is not totally dead, so someone could review and
possible apply.
msg122631 - (view) Author: √Čric Araujo (eric.araujo) * (Python committer) Date: 2010-11-28 05:18
Making the help window non-modal sounds like a great change to me.
msg151425 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2012-01-17 02:46
I agree that modal is a nuisance. Another problem with the help text window is that, on my system, it opens too narrow -- about 2/3rds the width of a shell or edit window. So many line are wrapped. Is this easy to fix and include with this patch, or does it need a new issue?

This patch fails to apply to 2.7 or 3.2: (t)hg messages are:
applying F:\Python\dev\help_nonmodal.diff
unable to find 'idlelib/textView.py' for patching
patching file idlelib/textView.py
6 out of 6 hunks FAILED -- saving rejects to file idlelib/textView.py.rej
abort: patch failed to apply
I redownloaded and tried again with same result.
msg152641 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2012-02-04 19:28
Attached is an updated version of Guilherme's patch against 3.3a0. It does make the help window non-modal.
msg152646 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-02-04 22:16
Thanks, Roger.  I did a quick smoke test of the patch on OS X 10.7 with Cocoa Tk.  I didn't see any obvious problems.  Of course, it needs to be tested on Windows and with X11 on a Unix platform.  Note, that there are some spurious spaces at a few ends-of-lines.  The main repositories on hg.python.org have whitespace prehooks that check for and reject patches with extra whitespace.  There's a script (reindent.py) included in Tools/scripts that will check for this and other problems.
    http://docs.python.org/devguide/committing.html
msg152647 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2012-02-04 22:39
I ran reindent and resubmitted the patch.

The patch works fine on Ubuntu 11.04. One very subtle design issue with the patch is that the help window is tied to the calling EditorWindow instance. If the editor (or shell) closes, so does the help window, even if other editors are open.
msg152651 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2012-02-05 01:06
Download, tested on W7, 3.2.2. Started help, brought to front, stopped, restarted, in both shell and edit window and all fine *except* when I closed edit window with help attached, which closes help also, and tried to open help in shell, idle 'silently' crashes. Reproduced same after restart idle. If I reopen an edit window, and reopen help from an edit window, it works ok. So the side-effect close seems to leave something behind that is a problem for reopening from shell but not from another edit window.

I am also still curious why window opens too narrow and if that can be fixed.
msg152659 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2012-02-05 04:24
Attached is a reworked patch to handle the nonmodal help dialog.

It replaces the decorator _singledialog with a call to a singleton HelpDialog class. The class creates the textView widget using as its parent the root Tk window instance instead of the EditorWindow's Toplevel.
Any EditorWindow instance calling "help_dialog" will cause the existing help dialog to be repositioned on top of it.
msg152663 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2012-02-05 07:04
I retried and get same behavior: help closes with closing of edit window and trying to reopen from shell closes idle with about 2 second delay.
Does this
+        if self.root:
+            parent = self.root
+        else:
+            parent = self.top
really do what you claimed? (always attach to root rather than toplevel)?
msg152695 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2012-02-05 16:35
Those four lines are present just in case self.root is not initialized. 
Even if you short-circuit the behavior and set parent=self.top, the patch still works, only that closing the calling EditorWindow instance also closes the help dialog. 

I tested the patch against 3.3a0 on Ubuntu and 3.2.2 on Vista and it does attach to root, not self.top. 

It sounds like remnants of "_singledialog" are present in EditorWindow.py. Did you back out of the previous patch before applying help_nonmodal_revision.patch?
msg152704 - (view) Author: Roundup Robot (python-dev) Date: 2012-02-05 20:25
New changeset 5452c881bd2d by Terry Jan Reedy in branch '2.7':
Issue 964437 Make IDLE help window non-modal.
http://hg.python.org/cpython/rev/5452c881bd2d

New changeset a949956a80cc by Terry Jan Reedy in branch '3.2':
Issue 964437 Make IDLE help window non-modal.
http://hg.python.org/cpython/rev/a949956a80cc

New changeset 2b841adbae81 by Terry Jan Reedy in branch 'default':
Merge with 3.2 #964437
http://hg.python.org/cpython/rev/2b841adbae81
msg152705 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2012-02-05 20:33
I was sure I had reverted, but did again, redownloaded, applied, and tested, and all well, so committed and pushed. 2.7 required hand-patching of ', modal' for chunk 5 due to 3rd argument being 'textFile.read()' instead of 'contents'. I presume I got it right, though could not test.
msg152708 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2012-02-05 20:48
I pulled the latest repo with the patch for 2.7. It works.
History
Date User Action Args
2012-02-05 20:48:44roger.serwysetmessages: + msg152708
2012-02-05 20:33:49terry.reedysetstatus: open -> closed
versions: + Python 2.7, Python 3.2
messages: + msg152705

resolution: fixed
stage: patch review -> resolved
2012-02-05 20:25:58python-devsetnosy: + python-dev
messages: + msg152704
2012-02-05 16:35:26roger.serwysetmessages: + msg152695
2012-02-05 07:04:51terry.reedysetmessages: + msg152663
2012-02-05 04:24:01roger.serwysetfiles: + help_nonmodal_revision.patch

messages: + msg152659
2012-02-05 01:06:52terry.reedysetmessages: + msg152651
2012-02-04 22:39:48roger.serwysetfiles: + help_nonmodal_updated2.patch

messages: + msg152647
2012-02-04 22:16:51ned.deilysetnosy: + ned.deily
messages: + msg152646
2012-02-04 19:28:42roger.serwysetfiles: + help_nonmodal_updated.patch

messages: + msg152641
2012-01-17 02:46:24terry.reedysetpriority: low -> normal
nosy: + roger.serwy
messages: + msg151425

2011-11-15 19:41:49ezio.melottisetnosy: + terry.reedy
stage: patch review

versions: + Python 3.3, - Python 3.2
2010-11-28 05:18:39eric.araujosetnosy: + eric.araujo

messages: + msg122631
versions: + Python 3.2
2008-03-22 21:35:53gpolosetfiles: + help_nonmodal.diff
keywords: + patch
messages: + msg64340
nosy: + gpolo
2004-06-01 18:05:03dokocreate