summaryrefslogtreecommitdiff
path: root/src/windows.py
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-02-14 14:54:26 +0100
committerFlorent Le Coz <louiz@louiz.org>2011-02-14 14:54:26 +0100
commit4b31e5acf142664c2f2ebd2e0cfa26e700d947d7 (patch)
tree82471c08139bdea5bcb1ba6a149d0b970580a784 /src/windows.py
parent3e550f4ae7ef13496fcc2e19ae406f324a2ee8e2 (diff)
downloadpoezio-4b31e5acf142664c2f2ebd2e0cfa26e700d947d7.tar.gz
poezio-4b31e5acf142664c2f2ebd2e0cfa26e700d947d7.tar.bz2
poezio-4b31e5acf142664c2f2ebd2e0cfa26e700d947d7.tar.xz
poezio-4b31e5acf142664c2f2ebd2e0cfa26e700d947d7.zip
Make the number of lines and messages kept in memory configurable
and lower (a lot) the number of lines kept in the info_win buffers This lower the memory usage.
Diffstat (limited to 'src/windows.py')
-rw-r--r--src/windows.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/windows.py b/src/windows.py
index c46b60e3..1ec5de8a 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -432,8 +432,9 @@ class MucInfoWin(InfoWin):
self.addstr(txt, curses.color_pair(theme.COLOR_INFORMATION_BAR))
class TextWin(Win):
- def __init__(self):
+ def __init__(self, lines_nb_limit=config.get('max_lines_in_memory', 2048)):
Win.__init__(self)
+ self.lines_nb_limit = lines_nb_limit
self.pos = 0
self.built_lines = [] # Each new message is built and kept here.
# on resize, we rebuild all the messages
@@ -525,7 +526,7 @@ class TextWin(Win):
if txt.startswith('\n'):
txt = txt[1:]
first = False
- while len(self.built_lines) > LINES_NB_LIMIT:
+ while len(self.built_lines) > self.lines_nb_limit:
self.built_lines.pop(0)
return nb