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.
This commit is contained in:
Terry Jan Reedy 2020-03-09 16:51:20 -04:00 committed by GitHub
parent e7cab7f780
commit 363fab83b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 74 additions and 12 deletions

View file

@ -223,6 +223,22 @@ class ModuleName(Query):
return file_path
class Goto(Query):
"Get a positive line number for editor Go To Line."
# Used in editor.EditorWindow.goto_line_event.
def entry_ok(self):
try:
lineno = int(self.entry.get())
except ValueError:
self.showerror('not a base 10 integer.')
return None
if lineno <= 0:
self.showerror('not a positive integer.')
return None
return lineno
class HelpSource(Query):
"Get menu name and help source for Help menu."
# Used in ConfigDialog.HelpListItemAdd/Edit, (941/9)