summaryrefslogtreecommitdiff
path: root/src/windows.py
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-11-06 17:54:05 +0100
committerFlorent Le Coz <louiz@louiz.org>2011-11-06 17:54:05 +0100
commit07f9fab401f34753d0619ebb8d65f6f9df97931d (patch)
tree11533f3d2b844696f8df1dcc3d48b1e477f89cfe /src/windows.py
parent700a59df5c2fb953b6e28dff2485b5952dcb3515 (diff)
parent7d861ee88514b38081f748a2b9f844eb56c6c349 (diff)
downloadpoezio-07f9fab401f34753d0619ebb8d65f6f9df97931d.tar.gz
poezio-07f9fab401f34753d0619ebb8d65f6f9df97931d.tar.bz2
poezio-07f9fab401f34753d0619ebb8d65f6f9df97931d.tar.xz
poezio-07f9fab401f34753d0619ebb8d65f6f9df97931d.zip
Merge branch 'master' into plugins
Conflicts: src/core.py
Diffstat (limited to 'src/windows.py')
-rw-r--r--src/windows.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/windows.py b/src/windows.py
index 42c9bfa0..790dd858 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -24,7 +24,7 @@ import curses
import string
from config import config
-from threading import Lock
+from threading import RLock
from contact import Contact, Resource
from roster import RosterGroup, roster
@@ -46,7 +46,7 @@ allowed_color_digits = ('0', '1', '2', '3', '4', '5', '6', '7')
# first is a bool telling if this is the first line of the message.
Line = collections.namedtuple('Line', 'msg start_pos end_pos')
-g_lock = Lock()
+g_lock = RLock()
LINES_NB_LIMIT = 4096
@@ -79,7 +79,8 @@ class Win(object):
"""
Override if something has to be done on resize
"""
- self._resize(height, width, y, x)
+ with g_lock:
+ self._resize(height, width, y, x)
def _refresh(self):
self._win.noutrefresh()
@@ -255,10 +256,11 @@ class UserList(Win):
self._refresh()
def resize(self, height, width, y, x):
- self._resize(height, width, y, x)
- self._win.attron(to_curses_attr(get_theme().COLOR_VERTICAL_SEPARATOR))
- self._win.vline(0, 0, curses.ACS_VLINE, self.height)
- self._win.attroff(to_curses_attr(get_theme().COLOR_VERTICAL_SEPARATOR))
+ with g_lock:
+ self._resize(height, width, y, x)
+ self._win.attron(to_curses_attr(get_theme().COLOR_VERTICAL_SEPARATOR))
+ self._win.vline(0, 0, curses.ACS_VLINE, self.height)
+ self._win.attroff(to_curses_attr(get_theme().COLOR_VERTICAL_SEPARATOR))
class Topic(Win):
def __init__(self):
@@ -674,9 +676,10 @@ class TextWin(Win):
self.addstr(' ')
def resize(self, height, width, y, x, room=None):
- self._resize(height, width, y, x)
- if room:
- self.rebuild_everything(room)
+ with g_lock:
+ self._resize(height, width, y, x)
+ if room:
+ self.rebuild_everything(room)
def rebuild_everything(self, room):
self.built_lines = []