summaryrefslogtreecommitdiffstats
path: root/Tools/idle/IOBinding.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-06-25 16:02:22 (GMT)
committerGuido van Rossum <guido@python.org>1999-06-25 16:02:22 (GMT)
commite689f0087ed3db8a5102ac4afdf147b50cd971e0 (patch)
treed60e0af3b16c9b82c9654f16a0d9010814e5d58d /Tools/idle/IOBinding.py
parent7ea8f8404c8291563a77af1fd6acd7920d24b24e (diff)
downloadcpython-e689f0087ed3db8a5102ac4afdf147b50cd971e0.zip
cpython-e689f0087ed3db8a5102ac4afdf147b50cd971e0.tar.gz
cpython-e689f0087ed3db8a5102ac4afdf147b50cd971e0.tar.bz2
Add close() method that breaks a cycle.
Diffstat (limited to 'Tools/idle/IOBinding.py')
-rw-r--r--Tools/idle/IOBinding.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/Tools/idle/IOBinding.py b/Tools/idle/IOBinding.py
index 6a41a37..7d8f0a9 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("<<open-window-from-file>>", self.open)
- self.text.bind("<<save-window>>", self.save)
- self.text.bind("<<save-window-as-file>>", self.save_as)
- self.text.bind("<<save-copy-of-window-as-file>>", self.save_a_copy)
+ self.__id_open = self.text.bind("<<open-window-from-file>>", self.open)
+ self.__id_save = self.text.bind("<<save-window>>", self.save)
+ self.__id_saveas = self.text.bind("<<save-window-as-file>>",
+ self.save_as)
+ self.__id_savecopy = self.text.bind("<<save-copy-of-window-as-file>>",
+ self.save_a_copy)
+
+ def close(self):
+ # Undo command bindings
+ self.text.unbind("<<open-window-from-file>>", self.__id_open)
+ self.text.unbind("<<save-window>>", self.__id_save)
+ self.text.unbind("<<save-window-as-file>>",self.__id_saveas)
+ self.text.unbind("<<save-copy-of-window-as-file>>", 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()