summaryrefslogtreecommitdiff
path: root/src/core/core.py
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2014-08-01 16:00:01 +0200
committerFlorent Le Coz <louiz@louiz.org>2014-08-01 16:00:01 +0200
commit271fd662a18d0a289fa73c1f42885a451accb1b8 (patch)
tree269f43afb5f345a4cb0bc290366aa96c17cbae45 /src/core/core.py
parentba93f3f236e68b14d84c9bc621c638c4f79207f9 (diff)
downloadpoezio-271fd662a18d0a289fa73c1f42885a451accb1b8.tar.gz
poezio-271fd662a18d0a289fa73c1f42885a451accb1b8.tar.bz2
poezio-271fd662a18d0a289fa73c1f42885a451accb1b8.tar.xz
poezio-271fd662a18d0a289fa73c1f42885a451accb1b8.zip
Entirely remove the g_lock (used to avoid a few race conditions with ncures)
Diffstat (limited to 'src/core/core.py')
-rw-r--r--src/core/core.py88
1 files changed, 41 insertions, 47 deletions
diff --git a/src/core/core.py b/src/core/core.py
index 906cc2a8..fe9efdd5 100644
--- a/src/core/core.py
+++ b/src/core/core.py
@@ -46,7 +46,6 @@ from roster import roster
from size_manager import SizeManager
from text_buffer import TextBuffer
from theming import get_theme
-from windows import g_lock
from . import completions
from . import commands
@@ -1540,41 +1539,39 @@ class Core(object):
"""
Resize the global_information_win only once at each resize.
"""
- with g_lock:
- if self.information_win_size > tabs.Tab.height - 6:
- self.information_win_size = tabs.Tab.height - 6
- if tabs.Tab.height < 6:
- self.information_win_size = 0
- height = (tabs.Tab.height - 1 - self.information_win_size
- - tabs.Tab.tab_win_height())
- self.information_win.resize(self.information_win_size,
- tabs.Tab.width,
- height,
- 0)
+ if self.information_win_size > tabs.Tab.height - 6:
+ self.information_win_size = tabs.Tab.height - 6
+ if tabs.Tab.height < 6:
+ self.information_win_size = 0
+ height = (tabs.Tab.height - 1 - self.information_win_size
+ - tabs.Tab.tab_win_height())
+ self.information_win.resize(self.information_win_size,
+ tabs.Tab.width,
+ height,
+ 0)
def resize_global_info_bar(self):
"""
Resize the GlobalInfoBar only once at each resize
"""
- with g_lock:
- height, width = self.stdscr.getmaxyx()
- if config.get('enable_vertical_tab_list', False):
+ height, width = self.stdscr.getmaxyx()
+ if config.get('enable_vertical_tab_list', False):
- if self.size.core_degrade_x:
- return
- try:
- height, _ = self.stdscr.getmaxyx()
- truncated_win = self.stdscr.subwin(height,
- config.get('vertical_tab_list_size', 20),
- 0, 0)
- except:
- log.error('Curses error on infobar resize', exc_info=True)
- return
- self.left_tab_win = windows.VerticalGlobalInfoBar(truncated_win)
- elif not self.size.core_degrade_y:
- self.tab_win.resize(1, tabs.Tab.width,
- tabs.Tab.height - 2, 0)
- self.left_tab_win = None
+ if self.size.core_degrade_x:
+ return
+ try:
+ height, _ = self.stdscr.getmaxyx()
+ truncated_win = self.stdscr.subwin(height,
+ config.get('vertical_tab_list_size', 20),
+ 0, 0)
+ except:
+ log.error('Curses error on infobar resize', exc_info=True)
+ return
+ self.left_tab_win = windows.VerticalGlobalInfoBar(truncated_win)
+ elif not self.size.core_degrade_y:
+ self.tab_win.resize(1, tabs.Tab.width,
+ tabs.Tab.height - 2, 0)
+ self.left_tab_win = None
def add_message_to_text_buffer(self, buff, txt,
time=None, nickname=None, history=None):
@@ -1602,30 +1599,27 @@ class Core(object):
# window to each Tab class, so they draw themself in the portion of
# the screen that they can occupy, and we draw the tab list on the
# remaining space, on the left
- with g_lock:
- height, width = self.stdscr.getmaxyx()
+ height, width = self.stdscr.getmaxyx()
if (config.get('enable_vertical_tab_list', False) and
not self.size.core_degrade_x):
- with g_lock:
- try:
- scr = self.stdscr.subwin(0,
- config.get('vertical_tab_list_size', 20))
- except:
- log.error('Curses error on resize', exc_info=True)
- return
+ try:
+ scr = self.stdscr.subwin(0,
+ config.get('vertical_tab_list_size', 20))
+ except:
+ log.error('Curses error on resize', exc_info=True)
+ return
else:
scr = self.stdscr
tabs.Tab.resize(scr)
self.resize_global_info_bar()
self.resize_global_information_win()
- with g_lock:
- for tab in self.tabs:
- if config.get('lazy_resize', True):
- tab.need_resize = True
- else:
- tab.resize()
- if self.tabs:
- self.full_screen_redraw()
+ for tab in self.tabs:
+ if config.get('lazy_resize', True):
+ tab.need_resize = True
+ else:
+ tab.resize()
+ if self.tabs:
+ self.full_screen_redraw()
def read_keyboard(self):
"""