diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-03-09 23:45:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-09 23:45:19 (GMT) |
commit | cadfe52a006abb46ea0948c6ae2e006064b4a091 (patch) | |
tree | 046e81a90a6663a3eb3ae4612a9825464077e6a8 /Lib/idlelib/editor.py | |
parent | 5854d451cb35ac38bc07b95afeb077e8a35d5c7d (diff) | |
download | cpython-cadfe52a006abb46ea0948c6ae2e006064b4a091.zip cpython-cadfe52a006abb46ea0948c6ae2e006064b4a091.tar.gz cpython-cadfe52a006abb46ea0948c6ae2e006064b4a091.tar.bz2 |
bpo-27115: Use Query subclass for IDLE editor Goto (GH-18871)
Replace tkinter tkSimpleDialog.askinteger with a standard IDLE query dialog.
The new box checks for positivity before returning.
(cherry picked from commit 363fab83b8a0e6d924c7a7c577feec6a2812bb8c)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Diffstat (limited to 'Lib/idlelib/editor.py')
-rw-r--r-- | Lib/idlelib/editor.py | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/Lib/idlelib/editor.py b/Lib/idlelib/editor.py index 5194190..b0f88b5 100644 --- a/Lib/idlelib/editor.py +++ b/Lib/idlelib/editor.py @@ -672,18 +672,16 @@ class EditorWindow(object): def goto_line_event(self, event): text = self.text - lineno = tkSimpleDialog.askinteger("Goto", - "Go to line number:",parent=text) - if lineno is None: - return "break" - if lineno <= 0: - text.bell() - return "break" - - text.tag_remove("sel", "1.0", "end") - text.mark_set("insert", f'{lineno}.0') - text.see("insert") - self.set_line_and_column() + lineno = query.Goto( + text, "Go To Line", + "Enter a positive integer\n" + "('big' = end of file):" + ).result + if lineno is not None: + text.tag_remove("sel", "1.0", "end") + text.mark_set("insert", f'{lineno}.0') + text.see("insert") + self.set_line_and_column() return "break" def open_module(self): |