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 docstrings to grep.py
Type: enhancement Stage: resolved
Components: IDLE Versions: Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: cheryl.sabella, louielu, terry.reedy
Priority: normal Keywords:

Created on 2017-06-15 12:27 by cheryl.sabella, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 2213 merged cheryl.sabella, 2017-06-15 12:29
PR 2434 merged terry.reedy, 2017-06-27 06:43
Messages (8)
msg296199 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-06-16 15:18
On PR 2213, Cheryl said "One other question -- when I run this, the dialog box always opens way on the bottom of my screen. Has anyone requested a change to this before? Or would it be worth mentioning on idle-dev?"  Louie sees top left on Mac, I see same on Windows.

Same is true for me for all search boxes.  Cheryl, only grep box or others?  I would find bottom surprising and likely annoying.  Feel free to open issue with detail.  Louie, what do you see on Linux?
msg296200 - (view) Author: Louie Lu (louielu) * Date: 2017-06-16 15:22
On Linux, it stick to the top-right of the IDLE, that says I can't reproduce the bump-out at the bottom :(
msg296206 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-06-16 15:38
Are you two using different Linux distributions with different graphics managers?  Could tk act different on different distributions?
msg296211 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2017-06-16 16:46
Thanks.  It seems like my windows pop-up all over the place.  It's probably a Ubuntu thing.  

I was used to looking at help_about and textview, which cascade over the current window (I think because of self.geometry) and that's what prompted my initial question.  But, the search dialogs aren't even all the same.  

If IDLE is in the middle of the screen,
- 'Find' and 'replace' pin to the top left of my screen, as far top and as far left as it could go.
- 'Find in files' pins to the bottom left, as far to the bottom as possible.

If I move the IDLE window, it generally stays the same as above, but if IDLE is in the top left, then the find and replace are to the right of it and find in files is still at the bottom.

I was going to ask this anyway, but help_about and those dialogs inherit from Toplevel and have a parent, but searchbase doesn't.  I don't understand why there's a difference.  The search dialogs are modal, even though the Output Window isn't.  Maybe it would help to control where they display in relation to a parent window?
msg296217 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-06-16 19:09
Since all three search boxes call the same open, they use the same hidden placement algorithm.  On Windows, the last position when closed is re-used for the next open for the duration of the IDLE session.  When IDLE is closed and reopened, the initial position is reset to a 'cascade' position.  What about Ubuntu?  Is it remembering across IDLE sessions? 

The 'difference' you noticed concerns 'is-a' relationships (via inheritance) versus 'has-a' relationships (via composition).  It is a perennial debate among some in the OOP community, with no resolution.  Python allows both.

IDLE uses both.  Different people? Same person, different times? Some perceived specific reason for each? I slightly prefer 'is-a' because it seems simpler, and inheritance does not bother me.  When we 'framify' the search widgets, I expect to use Frame subclasses.

Perhaps more important is grab-bag or kitchen-sink classes versus focused classes.  EditorWindow has a TopLevel, a Frame placed within the Toplevel, and, among other things, a Multicall-wrapped Text placed within the frame.  A method can be about any of them, and there are methods not about any of them, or about editing (open turtledemo).  There should be separate window, frame, and text classes with the methods appropriate to each.  I am sure that this would make the editor easier to learn, test and patch.

Modal or not is a separate debate.  Most recent opinions have been to make fewer things modal.  #24813 would make About IDLE non-modal. #24039 and #24760 include search dialogs.
msg296220 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2017-06-16 23:03
Thanks, Terry.  It seems that it *is* the hidden placement algorithm and I just never noticed it before.  I opened a bunch of terminal windows and they opened top left, bottom left, top right, bottom right, then continuing to follow a pattern.  IDLE did the same thing.  However, it isn't always opening the search dialogs in the same place even when I open the three in a row.  Maybe it's the size of the windows or something else that is causing the algorithm to render them differently.  Even though I can now understand the behavior, it's still frustrating because I'd expect the search box to pop up where I'm looking and not somewhere else on the screen entirely.

I have Windows 7 on my work laptop with 2 monitors and behavior was better.  The search dialogs opened more in the middle of the screen, near the IDLE window.  Although, if I put IDLE on the left monitor, the search dialog still opened in the same place on the right monitor, but it was easy to notice.

Thanks for explaining all that about the windows and dialogs.  At this point, I would say that consitency within the app would make it easier to understand for me as a newcomer.  If everything followed the pattern of window, frame, and text, then I wouldn't wonder about the differences, especially if there really isn't any intended difference.  And thank you for the links to those other issues and discussions.
msg297013 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-06-27 06:41
New changeset 65474b9d7a230943d4d3f1d7d51f77bb141240f0 by terryjreedy (csabella) in branch 'master':
bpo-30674: IDLE: add docstrings to grep.py (#2213)
https://github.com/python/cpython/commit/65474b9d7a230943d4d3f1d7d51f77bb141240f0
msg297017 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-06-27 07:02
New changeset 39e501a2913eff047f7a644e2b20eb4278f97d50 by terryjreedy in branch '3.6':
[3.6] bpo-30674: IDLE: add docstrings to grep.py (GH-2213) (#2434)
https://github.com/python/cpython/commit/39e501a2913eff047f7a644e2b20eb4278f97d50
History
Date User Action Args
2022-04-11 14:58:47adminsetgithub: 74859
2017-06-27 07:03:19terry.reedysetstatus: open -> closed
resolution: fixed
stage: commit review -> resolved
2017-06-27 07:02:00terry.reedysetmessages: + msg297017
2017-06-27 06:43:22terry.reedysetpull_requests: + pull_request2482
2017-06-27 06:41:11terry.reedysetmessages: + msg297013
2017-06-16 23:03:54cheryl.sabellasetmessages: + msg296220
2017-06-16 19:09:04terry.reedysetmessages: + msg296217
2017-06-16 16:46:55cheryl.sabellasetmessages: + msg296211
2017-06-16 15:38:38terry.reedysetmessages: + msg296206
2017-06-16 15:22:19louielusetnosy: + louielu
messages: + msg296200
2017-06-16 15:18:27terry.reedysetstage: commit review
versions: + Python 3.6
2017-06-16 15:18:03terry.reedysetmessages: + msg296199
2017-06-15 12:29:25cheryl.sabellasetpull_requests: + pull_request2257
2017-06-15 12:27:17cheryl.sabellacreate