summaryrefslogtreecommitdiff
path: root/src/core/core.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/core/core.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/core/core.py')
-rw-r--r--src/core/core.py28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/core/core.py b/src/core/core.py
index 95adc067..a0bb243c 100644
--- a/src/core/core.py
+++ b/src/core/core.py
@@ -41,6 +41,7 @@ from keyboard import Keyboard
from logger import logger
from plugin_manager import PluginManager
from roster import roster
+from size_manager import SizeManager
from text_buffer import TextBuffer
from theming import get_theme
from windows import g_lock
@@ -105,6 +106,7 @@ class Core(object):
self.plugin_manager = PluginManager(self)
self.events = events.EventHandler()
+ self.size = SizeManager(self, windows.Win)
# global commands, available from all tabs
# a command is tuple of the form:
@@ -1498,20 +1500,25 @@ class Core(object):
Resize the global_information_win only once at each resize.
"""
with g_lock:
- 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)
+ height = min(tabs.Tab.height - 1 - self.information_win_size
+ - tabs.Tab.tab_win_height(),
+ tabs.Tab.height - 5)
+ if not self.size.core_degrade_y:
+ 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:
- self.tab_win.resize(1, tabs.Tab.width, tabs.Tab.height - 2, 0)
- if config.get('enable_vertical_tab_list', False):
+ height, width = self.stdscr.getmaxyx()
+ if not self.size.core_degrade_y:
+ self.tab_win.resize(1, tabs.Tab.width, tabs.Tab.height - 2, 0)
+ if (config.get('enable_vertical_tab_list', False)
+ and not self.size.core_degrade_x):
try:
height, _ = self.stdscr.getmaxyx()
truncated_win = self.stdscr.subwin(height,
@@ -1550,7 +1557,10 @@ class Core(object):
# window to each Tab class, so the draw themself in the portion
# of the screen that the can occupy, and we draw the tab list
# on the left remaining space
- if config.get('enable_vertical_tab_list', False):
+ with g_lock:
+ 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,