summaryrefslogtreecommitdiff
path: root/src/windows.py
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-03-08 04:20:46 +0100
committerFlorent Le Coz <louiz@louiz.org>2011-03-08 04:20:46 +0100
commit1a2252b3e5f902eea19b5f295812c9f9a0686815 (patch)
treeffd3bde93a278d6be063376e92dc19bc6546df96 /src/windows.py
parent8f48c5ede7e1da18f85daae9bda5a4b68272498b (diff)
downloadpoezio-1a2252b3e5f902eea19b5f295812c9f9a0686815.tar.gz
poezio-1a2252b3e5f902eea19b5f295812c9f9a0686815.tar.bz2
poezio-1a2252b3e5f902eea19b5f295812c9f9a0686815.tar.xz
poezio-1a2252b3e5f902eea19b5f295812c9f9a0686815.zip
Have a single TextWin in common for each tab, reducing the needed memory, and simplifying its resize (F7 and F8 stuff)
Diffstat (limited to 'src/windows.py')
-rw-r--r--src/windows.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/windows.py b/src/windows.py
index e6ca9800..7ad382d3 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -56,13 +56,17 @@ LINES_NB_LIMIT = 4096
class Win(object):
_win_core = None
def __init__(self):
- pass
+ self._win = None
def _resize(self, height, width, y, x):
self.height, self.width, self.x, self.y = height, width, x, y
if height == 0 or width == 0:
return
- self._win = curses.newwin(height, width, y, x)
+ if not self._win:
+ self._win = curses.newwin(height, width, y, x)
+ else:
+ self._win.resize(height, width)
+ self._win.mvwin(y, x)
def resize(self, height, width, y, x):
"""
@@ -1456,6 +1460,7 @@ class ListWin(Win):
scrolled up and down, with one selected line at a time
"""
def __init__(self, columns, with_headers=True):
+ Win.__init__(self)
self._columns = columns # a tuple with the name of the columns
self._columns_sizes = {} # a dict {'column_name': size}
self.sorted_by = (None, None) # for example: ('name', '↑')
@@ -1546,6 +1551,7 @@ class ColumnHeaderWin(Win):
A class displaying the column's names
"""
def __init__(self, columns):
+ Win.__init__(self)
self._columns = columns
self._columns_sizes = {}
@@ -1566,6 +1572,7 @@ class ColumnHeaderWin(Win):
class SimpleTextWin(Win):
def __init__(self, text):
+ Win.__init__(self)
self._text = text
self.built_lines = []