mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
Add close() method that breaks a cycle.
This commit is contained in:
parent
7ea8f8404c
commit
e689f0087e
3 changed files with 23 additions and 4 deletions
|
@ -32,6 +32,9 @@ class CallTips:
|
||||||
else:
|
else:
|
||||||
self._make_calltip_window = self._make_tk_calltip_window
|
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.
|
# Makes a Tk based calltip window. Used by IDLE, but not Pythonwin.
|
||||||
# See __init__ above for how this is used.
|
# See __init__ above for how this is used.
|
||||||
def _make_tk_calltip_window(self):
|
def _make_tk_calltip_window(self):
|
||||||
|
|
|
@ -36,6 +36,9 @@ class FormatParagraph:
|
||||||
def __init__(self, editwin):
|
def __init__(self, editwin):
|
||||||
self.editwin = editwin
|
self.editwin = editwin
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
self.editwin = None
|
||||||
|
|
||||||
def format_paragraph_event(self, event):
|
def format_paragraph_event(self, event):
|
||||||
text = self.editwin.text
|
text = self.editwin.text
|
||||||
first, last = self.editwin.get_selection_indices()
|
first, last = self.editwin.get_selection_indices()
|
||||||
|
|
|
@ -24,10 +24,23 @@ class IOBinding:
|
||||||
def __init__(self, editwin):
|
def __init__(self, editwin):
|
||||||
self.editwin = editwin
|
self.editwin = editwin
|
||||||
self.text = editwin.text
|
self.text = editwin.text
|
||||||
self.text.bind("<<open-window-from-file>>", self.open)
|
self.__id_open = self.text.bind("<<open-window-from-file>>", self.open)
|
||||||
self.text.bind("<<save-window>>", self.save)
|
self.__id_save = self.text.bind("<<save-window>>", self.save)
|
||||||
self.text.bind("<<save-window-as-file>>", self.save_as)
|
self.__id_saveas = self.text.bind("<<save-window-as-file>>",
|
||||||
self.text.bind("<<save-copy-of-window-as-file>>", self.save_a_copy)
|
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):
|
def get_saved(self):
|
||||||
return self.editwin.get_saved()
|
return self.editwin.get_saved()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue