msg266289 - (view) |
Author: Terry J. Reedy (terry.reedy) *  |
Date: 2016-05-24 23:26 |
On Win 10, Python 3.5 or 3.6, IDLE Shell or Editor with at least a few lines of text: hit Alt-G to open 'Goto' window. Enter a line # other than the current one. Hit <Return>. Cursor moves to line enter, though it shrinks to one pixel wide from two pixels. Line:col in status bar is updated.
Instead of hitting return, click [OK] button. Same thing happens except that status bar line:col is NOT updated. Here is relevant code in EditorWindow, about line 610
def goto_line_event(self, event):
text = self.text
lineno = tkSimpleDialog.askinteger("Goto",
"Go to line number:",parent=text)
text.mark_set("insert", "%d.0" % lineno)
text.see("insert")
Changing parent=text to parent=self.root makes no difference. I have not yet tried simulating the interaction with button.invoke and event_generate('<Key-Return>.
My guess is that one of the last two tk methods is supposed to generate a cursor moved event that is bound to a reset status bar function. But somehow the previous click instead of keypress inhibits the event. So this seems a tk bug. Sethiy, what do you think?
The workaround for IDLE is to manually invoke a status bar update.
|
msg268186 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2016-06-11 05:53 |
This is not Tkinter issue, but IDLE issue.
Other similar cases:
Open search dialog and find something. The status bar is not updated. It is updated only if you close the search dialog.
Select a text and delete it by a mouse. The status bar is not updated. Choice the Edit|Redo action by a mouse. The status bar is not updated.
|
msg268193 - (view) |
Author: Terry J. Reedy (terry.reedy) *  |
Date: 2016-06-11 06:26 |
Okay, will take a look at the status bar code and update mechanism.
|
msg268197 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2016-06-11 07:59 |
If you close the Goto dialog by pressing <Return>, the KeyRelease event is sent to the editor window. This triggers the <<set-line-and-column>> event.
|
msg294547 - (view) |
Author: Louie Lu (louielu) * |
Date: 2017-05-26 12:44 |
We can solve this problem by two ways.
One is to add set_line_and_column() to the end of goto_line_event(), but this will make Return trigger set_line_and_column twice.
Another is to change the bind event in simpledialog from "<Return>" to "<KeyRelease-Return>" to prevent editor use the KeyRelease event. But I think this will have some backward-compatibility problem, maybe we should add a parameter to control buttonbox bind on "<Return>" or "<KeyRelease-Return>".
Then we can add set_line_and_column() to the end of the goto_line_event(), and have no problem about trigging twice.
|
msg294735 - (view) |
Author: Terry J. Reedy (terry.reedy) *  |
Date: 2017-05-30 04:12 |
We should not change simpledialog.py, but we could change bindings after import.
However, since last summer, we can instead replace simpledialog.py with subclasses of ttk-using query.Query, with custom validators. editor.py uses askinterger for indent width, columns/tab, and goto line number. Iomenu uses askstring for encoding. I have already planned to use Query for the line# box.
|
msg294806 - (view) |
Author: Louie Lu (louielu) * |
Date: 2017-05-31 02:54 |
Ok, changed to query.Query will be good. But the problem still exist, query.Query use "<Key-Return>" to bind at button ok, should it re-bind to "<KeyRelease-Return>" at subclass such as AskInteger(Query) ?
|
msg294812 - (view) |
Author: Terry J. Reedy (terry.reedy) *  |
Date: 2017-05-31 05:45 |
Louie, please don't revert header corrections made by a core developer.
I see no mention of binding to press versus release in the original query issue: #27380. Since the original query code is an edited version of previous code, I suspect I left the binding as it was. The current subclasses are used with ConfigDialog, where it may not make much difference. In any case, we will make changes somewhere to fix the problem: change the base class, move the binding in the subclass, or bind "def catch_return(event): return 'break'" to return release.
Unfinished issue #27621 is about refining details of Query button behavior, especially focus, in a cross-platform manner. I would like for us both to at least review the remaining issues there before doing this one.
|
msg294814 - (view) |
Author: Louie Lu (louielu) * |
Date: 2017-05-31 06:01 |
Terry, on the original issue about goto dialog, I would like to propose another approach, instead of using query.Query or simpledialog, how about to make it as a single-window application like sublime text: http://docs.sublimetext.info/en/latest/file_management/file_navigation.html#goto-anything
I'm now doing some experience on this, and it will push forward for what #30422 want to do.
|
msg363476 - (view) |
Author: Terry J. Reedy (terry.reedy) *  |
Date: 2020-03-06 02:47 |
I changed the title to reflect the intended user-visible behavior, which was always the real issue. The original title proposed a solution that would not work. The revised title gave an alternate solution that should not work.
The discrepancy between clicking [Ok] and and pressing <Return> arises because pressing Enter in the query box leaks <KeyRelease-Return> to the text, which happens to trigger a status bar update. I regard this somewhat accidental side-effect to be a bug to be fixed. Changing the text and status bar are the responsibility of the event handler.
The line number query box should just return a positive int or None, without side-effect. So we should make sure that Query boxes do not leak key events and create a subclass to get a positive int. But such a replacement is somewhat independent of triggering <<set-line-and-column>>.
A related issue is that goto does not clear selections. #39844. I may fix that and this with one PR.
|
msg363673 - (view) |
Author: Terry J. Reedy (terry.reedy) *  |
Date: 2020-03-08 19:05 |
Since PR-18801 fixed the status issue, I am returning this to the box replacement issue.
|
msg363687 - (view) |
Author: Terry J. Reedy (terry.reedy) *  |
Date: 2020-03-08 21:50 |
The related issue is #39852. Since its PR-18801 fixed the status issue, I am returning this to the box replacement issue.
|
msg363692 - (view) |
Author: Terry J. Reedy (terry.reedy) *  |
Date: 2020-03-09 05:38 |
New changeset e53a3932cb01683b0fa8a7448ca25a2e658c39e6 by Terry Jan Reedy in branch 'master':
bpo-27115: Move IDLE Query error blanking (GH-18868)
https://github.com/python/cpython/commit/e53a3932cb01683b0fa8a7448ca25a2e658c39e6
|
msg363693 - (view) |
Author: miss-islington (miss-islington) |
Date: 2020-03-09 05:54 |
New changeset 9d5ed8355d4cb73ab13fa6094c9ab57798dff3be by Miss Islington (bot) in branch '3.7':
bpo-27115: Move IDLE Query error blanking (GH-18868)
https://github.com/python/cpython/commit/9d5ed8355d4cb73ab13fa6094c9ab57798dff3be
|
msg363694 - (view) |
Author: miss-islington (miss-islington) |
Date: 2020-03-09 05:56 |
New changeset f3f0c7a108cd2a5071592e77e2f4b14ca35d4fcc by Miss Islington (bot) in branch '3.8':
bpo-27115: Move IDLE Query error blanking (GH-18868)
https://github.com/python/cpython/commit/f3f0c7a108cd2a5071592e77e2f4b14ca35d4fcc
|
msg363771 - (view) |
Author: Terry J. Reedy (terry.reedy) *  |
Date: 2020-03-09 20:51 |
New changeset 363fab83b8a0e6d924c7a7c577feec6a2812bb8c by Terry Jan Reedy in branch 'master':
bpo-27115: Use Query subclass for IDLE editor Goto (GH-18871)
https://github.com/python/cpython/commit/363fab83b8a0e6d924c7a7c577feec6a2812bb8c
|
msg363793 - (view) |
Author: miss-islington (miss-islington) |
Date: 2020-03-09 23:45 |
New changeset cadfe52a006abb46ea0948c6ae2e006064b4a091 by Miss Islington (bot) in branch '3.8':
bpo-27115: Use Query subclass for IDLE editor Goto (GH-18871)
https://github.com/python/cpython/commit/cadfe52a006abb46ea0948c6ae2e006064b4a091
|
msg363794 - (view) |
Author: miss-islington (miss-islington) |
Date: 2020-03-09 23:45 |
New changeset f8345358bcdd276eb470778daf05d343da9f1290 by Miss Islington (bot) in branch '3.7':
bpo-27115: Use Query subclass for IDLE editor Goto (GH-18871)
https://github.com/python/cpython/commit/f8345358bcdd276eb470778daf05d343da9f1290
|
|
Date |
User |
Action |
Args |
2022-04-11 14:58:31 | admin | set | github: 71302 |
2020-03-10 01:07:06 | terry.reedy | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
2020-03-09 23:45:40 | miss-islington | set | messages:
+ msg363794 |
2020-03-09 23:45:22 | miss-islington | set | messages:
+ msg363793 |
2020-03-09 20:51:41 | miss-islington | set | pull_requests:
+ pull_request18244 |
2020-03-09 20:51:34 | miss-islington | set | pull_requests:
+ pull_request18243 |
2020-03-09 20:51:28 | terry.reedy | set | messages:
+ msg363771 |
2020-03-09 07:18:55 | terry.reedy | set | stage: test needed -> patch review pull_requests:
+ pull_request18229 |
2020-03-09 06:34:41 | terry.reedy | set | dependencies:
- Finish IDLE Query dialog appearance and behavior. stage: patch review -> test needed |
2020-03-09 05:56:32 | miss-islington | set | messages:
+ msg363694 |
2020-03-09 05:54:37 | miss-islington | set | messages:
+ msg363693 |
2020-03-09 05:38:28 | miss-islington | set | pull_requests:
+ pull_request18228 |
2020-03-09 05:38:22 | miss-islington | set | nosy:
+ miss-islington pull_requests:
+ pull_request18227
|
2020-03-09 05:38:13 | terry.reedy | set | messages:
+ msg363692 |
2020-03-09 05:14:47 | terry.reedy | set | keywords:
+ patch stage: test needed -> patch review pull_requests:
+ pull_request18226 |
2020-03-08 21:50:38 | terry.reedy | set | messages:
+ msg363687 |
2020-03-08 19:05:13 | terry.reedy | set | messages:
+ msg363673 title: IDLE goto should always update status bar line & column -> IDLE goto should use query.Query subclass |
2020-03-06 02:47:51 | terry.reedy | set | messages:
+ msg363476 title: IDLE: replace uses of tkinter simpledialog with query.Query -> IDLE goto should always update status bar line & column |
2017-05-31 06:01:43 | louielu | set | messages:
+ msg294814 |
2017-05-31 05:45:16 | terry.reedy | set | dependencies:
+ Finish IDLE Query dialog appearance and behavior. messages:
+ msg294812 versions:
+ Python 3.7, - Python 3.5 |
2017-05-31 02:54:04 | louielu | set | messages:
+ msg294806 versions:
+ Python 3.5, - Python 3.7 |
2017-05-30 04:14:35 | terry.reedy | set | title: IDLE: replace used of tkinter simpledialog with query.Query -> IDLE: replace uses of tkinter simpledialog with query.Query |
2017-05-30 04:12:58 | terry.reedy | set | title: IDLE/tkinter: in simpledialog, <Return> != [OK] click -> IDLE: replace used of tkinter simpledialog with query.Query messages:
+ msg294735 versions:
+ Python 3.7, - Python 3.5 |
2017-05-26 12:44:15 | louielu | set | nosy:
+ louielu messages:
+ msg294547
|
2016-06-11 07:59:05 | serhiy.storchaka | set | messages:
+ msg268197 |
2016-06-11 06:26:14 | terry.reedy | set | assignee: terry.reedy messages:
+ msg268193 |
2016-06-11 05:53:04 | serhiy.storchaka | set | messages:
+ msg268186 components:
- Tkinter |
2016-05-24 23:26:29 | terry.reedy | create | |