bpo-27115: Move IDLE Query error blanking (GH-18868)

Move required blanking of error text to non-overridden entry_ok().
(Omit news item.)
This commit is contained in:
Terry Jan Reedy 2020-03-09 01:38:07 -04:00 committed by GitHub
parent d7a04a8425
commit e53a3932cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 5 deletions

View File

@ -108,6 +108,7 @@ class Query(Toplevel):
exists=True, root=self.parent)
self.entry_error = Label(frame, text=' ', foreground='red',
font=self.error_font)
# Display or blank error by setting ['text'] =.
entrylabel.grid(column=0, row=0, columnspan=3, padx=5, sticky=W)
self.entry.grid(column=0, row=1, columnspan=3, padx=5, sticky=W+E,
pady=[10,0])
@ -132,7 +133,6 @@ class Query(Toplevel):
def entry_ok(self): # Example: usually replace.
"Return non-blank entry or None."
self.entry_error['text'] = ''
entry = self.entry.get().strip()
if not entry:
self.showerror('blank line.')
@ -144,6 +144,7 @@ class Query(Toplevel):
Otherwise leave dialog open for user to correct entry or cancel.
'''
self.entry_error['text'] = ''
entry = self.entry_ok()
if entry is not None:
self.result = entry
@ -173,7 +174,6 @@ class SectionName(Query):
def entry_ok(self):
"Return sensible ConfigParser section name or None."
self.entry_error['text'] = ''
name = self.entry.get().strip()
if not name:
self.showerror('no name specified.')
@ -198,7 +198,6 @@ class ModuleName(Query):
def entry_ok(self):
"Return entered module name as file path or None."
self.entry_error['text'] = ''
name = self.entry.get().strip()
if not name:
self.showerror('no name specified.')
@ -311,7 +310,6 @@ class HelpSource(Query):
def entry_ok(self):
"Return apparently valid (name, path) or None"
self.entry_error['text'] = ''
self.path_error['text'] = ''
name = self.item_ok()
path = self.path_ok()
@ -362,7 +360,6 @@ class CustomRun(Query):
def entry_ok(self):
"Return apparently valid (cli_args, restart) or None"
self.entry_error['text'] = ''
cli_args = self.cli_args_ok()
restart = self.restartvar.get()
return None if cli_args is None else (cli_args, restart)