summaryrefslogtreecommitdiff
path: root/src/windows.py
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-03-07 21:41:13 +0100
committerFlorent Le Coz <louiz@louiz.org>2011-03-07 21:41:13 +0100
commit8f48c5ede7e1da18f85daae9bda5a4b68272498b (patch)
tree2ccbe6a10613ee0e5301e81fde396fd04fccf543 /src/windows.py
parenta769babf0acd03bf9c22a5f03808dab7b0c52cc4 (diff)
downloadpoezio-8f48c5ede7e1da18f85daae9bda5a4b68272498b.tar.gz
poezio-8f48c5ede7e1da18f85daae9bda5a4b68272498b.tar.bz2
poezio-8f48c5ede7e1da18f85daae9bda5a4b68272498b.tar.xz
poezio-8f48c5ede7e1da18f85daae9bda5a4b68272498b.zip
Inputs are garbage collected, making MucListTab collectable.
Memory improvement issues.
Diffstat (limited to 'src/windows.py')
-rw-r--r--src/windows.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/windows.py b/src/windows.py
index a949ca99..e6ca9800 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -734,6 +734,13 @@ class Input(Win):
self.on_input = None # callback called on any key pressed
self.color = None # use this color on addstr
+ def on_delete(self):
+ """
+ Remove all references kept to a tab, so that the tab
+ can be garbage collected
+ """
+ del self.key_func
+
def set_color(self, color):
self.color = color
self.rewrite_text()
@@ -1171,6 +1178,22 @@ class CommandInput(Input):
self.addstr(0, cursor_pos, '') # WTF, this works but .move() doesn't…
self._refresh()
+ def on_delete(self):
+ """
+ SERIOUSLY BIG WTF.
+
+ I can do
+ self.key_func.clear()
+
+ but not
+ del self.key_func
+ because that would raise an AttributeError exception. WTF.
+ """
+ self.on_abort = None
+ self.on_success = None
+ self.on_input = None
+ self.key_func.clear()
+
class VerticalSeparator(Win):
"""
Just a one-column window, with just a line in it, that is