From: Guido van Rossum Date: Fri, 25 Jun 1999 16:02:22 +0000 (+0000) Subject: Add close() method that breaks a cycle. X-Git-Tag: v1.6a1~1154 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e689f0087ed3db8a5102ac4afdf147b50cd971e0;p=thirdparty%2FPython%2Fcpython.git Add close() method that breaks a cycle. --- diff --git a/Tools/idle/CallTips.py b/Tools/idle/CallTips.py index 413d211ca868..04eccde0b401 100644 --- a/Tools/idle/CallTips.py +++ b/Tools/idle/CallTips.py @@ -32,6 +32,9 @@ class CallTips: else: self._make_calltip_window = self._make_tk_calltip_window + def close(self): + self._make_calltip_window = None + # Makes a Tk based calltip window. Used by IDLE, but not Pythonwin. # See __init__ above for how this is used. def _make_tk_calltip_window(self): diff --git a/Tools/idle/FormatParagraph.py b/Tools/idle/FormatParagraph.py index 671b30303167..76c52f55d186 100644 --- a/Tools/idle/FormatParagraph.py +++ b/Tools/idle/FormatParagraph.py @@ -36,6 +36,9 @@ class FormatParagraph: def __init__(self, editwin): self.editwin = editwin + def close(self): + self.editwin = None + def format_paragraph_event(self, event): text = self.editwin.text first, last = self.editwin.get_selection_indices() diff --git a/Tools/idle/IOBinding.py b/Tools/idle/IOBinding.py index 6a41a37500cb..7d8f0a9e50bd 100644 --- a/Tools/idle/IOBinding.py +++ b/Tools/idle/IOBinding.py @@ -24,10 +24,23 @@ class IOBinding: def __init__(self, editwin): self.editwin = editwin self.text = editwin.text - self.text.bind("<>", self.open) - self.text.bind("<>", self.save) - self.text.bind("<>", self.save_as) - self.text.bind("<>", self.save_a_copy) + self.__id_open = self.text.bind("<>", self.open) + self.__id_save = self.text.bind("<>", self.save) + self.__id_saveas = self.text.bind("<>", + self.save_as) + self.__id_savecopy = self.text.bind("<>", + self.save_a_copy) + + def close(self): + # Undo command bindings + self.text.unbind("<>", self.__id_open) + self.text.unbind("<>", self.__id_save) + self.text.unbind("<>",self.__id_saveas) + self.text.unbind("<>", self.__id_savecopy) + # Break cycles + self.editwin = None + self.text = None + self.filename_change_hook = None def get_saved(self): return self.editwin.get_saved()