diff options
author | mathieui <mathieui@mathieui.net> | 2014-04-28 23:29:21 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2014-04-28 23:29:21 +0200 |
commit | 0caf9417b27a67bd6b78a96d22618ef6dd995937 (patch) | |
tree | f42e0e982faa5a88d590eba45165c2f8951bf0be /src/core | |
parent | 069283e349b2e8dd324446aa5c30253a0993f1a3 (diff) | |
download | poezio-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')
-rw-r--r-- | src/core/core.py | 28 | ||||
-rw-r--r-- | src/core/handlers.py | 3 |
2 files changed, 21 insertions, 10 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, diff --git a/src/core/handlers.py b/src/core/handlers.py index bc666736..05eab9f7 100644 --- a/src/core/handlers.py +++ b/src/core/handlers.py @@ -617,7 +617,8 @@ def on_chatstate_groupchat_conversation(self, message, state): self.events.trigger('muc_chatstate', message, tab) tab.get_user_by_name(nick).chatstate = state if tab == self.current_tab(): - tab.user_win.refresh(tab.users) + if not self.size.tab_degrade_x: + tab.user_win.refresh(tab.users) tab.input.refresh() self.doupdate() else: |