From e53a3932cb01683b0fa8a7448ca25a2e658c39e6 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Mon, 9 Mar 2020 01:38:07 -0400 Subject: [PATCH] bpo-27115: Move IDLE Query error blanking (GH-18868) Move required blanking of error text to non-overridden entry_ok(). (Omit news item.) --- Lib/idlelib/query.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Lib/idlelib/query.py b/Lib/idlelib/query.py index 097e6e61e35..57616de4fe0 100644 --- a/Lib/idlelib/query.py +++ b/Lib/idlelib/query.py @@ -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)