summaryrefslogtreecommitdiff
path: root/src/windows.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2014-04-28 23:29:21 +0200
committermathieui <mathieui@mathieui.net>2014-04-28 23:29:21 +0200
commit0caf9417b27a67bd6b78a96d22618ef6dd995937 (patch)
treef42e0e982faa5a88d590eba45165c2f8951bf0be /src/windows.py
parent069283e349b2e8dd324446aa5c30253a0993f1a3 (diff)
downloadpoezio-0caf9417b27a67bd6b78a96d22618ef6dd995937.tar.gz
poezio-0caf9417b27a67bd6b78a96d22618ef6dd995937.tar.bz2
poezio-0caf9417b27a67bd6b78a96d22618ef6dd995937.tar.xz
poezio-0caf9417b27a67bd6b78a96d22618ef6dd995937.zip
Make the size modular, remove small-size lock (also seems to fix #2155)
some stuff is now hidden wen the window size gets too small (might need some adjustments). The info buffer in the roster tab, the userlist in mucs, the vertical tab list, the info buffer everywhere, etc…
Diffstat (limited to 'src/windows.py')
-rw-r--r--src/windows.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/windows.py b/src/windows.py
index fb901f19..72e7a40d 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -52,6 +52,16 @@ g_lock = RLock()
LINES_NB_LIMIT = 4096
+class DummyWin(object):
+ def __getattribute__(self, name):
+ if name != '__bool__':
+ return lambda *args, **kwargs: (0, 0)
+ else:
+ return object.__getattribute__(self, name)
+
+ def __bool__(self):
+ return False
+
def find_first_format_char(text):
pos = -1
for char in format_chars:
@@ -103,6 +113,7 @@ class Win(object):
_tab_win = None
def __init__(self):
self._win = None
+ self.height, self.width = 0, 0
def _resize(self, height, width, y, x):
if height == 0 or width == 0:
@@ -113,8 +124,8 @@ class Win(object):
self._win = Win._tab_win.derwin(height, width, y, x)
except:
log.debug('DEBUG: mvwin returned ERR. Please investigate')
-
- # If this ever fail, uncomment that ^
+ if self._win is None:
+ self._win = DummyWin()
def resize(self, height, width, y, x):
"""