summaryrefslogtreecommitdiff
path: root/src/windows.py
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-11-07 01:02:03 +0100
committerFlorent Le Coz <louiz@louiz.org>2011-11-07 01:02:03 +0100
commit8911f85a4201b48670022226168b749dfa89fbb8 (patch)
tree607f7f7347752f78671a75f0ba3c95a307e96fe2 /src/windows.py
parentb7027e53474c208d7b772794fd34b30092bc4df1 (diff)
parent0315b05f5122f1f4697699fc09de1b0860203177 (diff)
downloadpoezio-8911f85a4201b48670022226168b749dfa89fbb8.tar.gz
poezio-8911f85a4201b48670022226168b749dfa89fbb8.tar.bz2
poezio-8911f85a4201b48670022226168b749dfa89fbb8.tar.xz
poezio-8911f85a4201b48670022226168b749dfa89fbb8.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 = []