bpo-36152: IDLE: Remove unused parameter from colorizer (GH-12109)

Remove colorizer.ColorDelegator.close_when_done and the corresponding argument of .close().  In IDLE, both have always been None or False since 2007.
This commit is contained in:
Cheryl Sabella 2019-03-01 05:19:40 -05:00 committed by GitHub
parent d60a79a101
commit b9f0354efc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 18 deletions

View File

@ -66,8 +66,6 @@ class ColorDelegator(Delegator):
colorizing: Boolean flag when colorizing is in process. colorizing: Boolean flag when colorizing is in process.
stop_colorizing: Boolean flag to end an active colorizing stop_colorizing: Boolean flag to end an active colorizing
process. process.
close_when_done: Widget to destroy after colorizing process
completes (doesn't seem to be used by IDLE).
""" """
def __init__(self): def __init__(self):
@ -157,9 +155,7 @@ class ColorDelegator(Delegator):
self.after_id = self.after(1, self.recolorize) self.after_id = self.after(1, self.recolorize)
return return
close_when_done = None # Window to be closed when done colorizing. def close(self):
def close(self, close_when_done=None):
if self.after_id: if self.after_id:
after_id = self.after_id after_id = self.after_id
self.after_id = None self.after_id = None
@ -167,11 +163,6 @@ class ColorDelegator(Delegator):
self.after_cancel(after_id) self.after_cancel(after_id)
self.allow_colorizing = False self.allow_colorizing = False
self.stop_colorizing = True self.stop_colorizing = True
if close_when_done:
if not self.colorizing:
close_when_done.destroy()
else:
self.close_when_done = close_when_done
def toggle_colorize_event(self, event=None): def toggle_colorize_event(self, event=None):
"""Toggle colorizing on and off. """Toggle colorizing on and off.
@ -205,9 +196,7 @@ class ColorDelegator(Delegator):
process is not already running. process is not already running.
After colorizing is complete, some cleanup is done to After colorizing is complete, some cleanup is done to
make sure that all the text has been colorized and to close make sure that all the text has been colorized.
the window if the close event had been called while the
process was running.
""" """
self.after_id = None self.after_id = None
if not self.delegate: if not self.delegate:
@ -232,10 +221,6 @@ class ColorDelegator(Delegator):
if self.allow_colorizing and self.tag_nextrange("TODO", "1.0"): if self.allow_colorizing and self.tag_nextrange("TODO", "1.0"):
if DEBUG: print("reschedule colorizing") if DEBUG: print("reschedule colorizing")
self.after_id = self.after(1, self.recolorize) self.after_id = self.after(1, self.recolorize)
if self.close_when_done:
top = self.close_when_done
self.close_when_done = None
top.destroy()
def recolorize_main(self): def recolorize_main(self):
"Evaluate text and apply colorizing tags." "Evaluate text and apply colorizing tags."

View File

@ -1033,7 +1033,7 @@ class EditorWindow(object):
self.io = None self.io = None
self.undo = None self.undo = None
if self.color: if self.color:
self.color.close(False) self.color.close()
self.color = None self.color = None
self.text = None self.text = None
self.tkinter_vars = None self.tkinter_vars = None

View File

@ -0,0 +1,3 @@
Remove colorizer.ColorDelegator.close_when_done and the
corresponding argument of .close(). In IDLE, both have
always been None or False since 2007.