diff options
author | mathieui <mathieui@mathieui.net> | 2014-04-29 02:20:06 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2014-04-29 02:20:06 +0200 |
commit | 6391d97b3af266fe5e348283196bcb7f1ec78c7c (patch) | |
tree | 751237c51f23083257f0c591b712195993eaeb4f | |
parent | 9e72f8336da77c566fbbe6aad7caf6e79a0aab58 (diff) | |
download | poezio-6391d97b3af266fe5e348283196bcb7f1ec78c7c.tar.gz poezio-6391d97b3af266fe5e348283196bcb7f1ec78c7c.tar.bz2 poezio-6391d97b3af266fe5e348283196bcb7f1ec78c7c.tar.xz poezio-6391d97b3af266fe5e348283196bcb7f1ec78c7c.zip |
Fix most UI issues with introduced in 0caf941
-rw-r--r-- | src/core/core.py | 39 | ||||
-rw-r--r-- | src/core/handlers.py | 16 | ||||
-rw-r--r-- | src/tabs/basetabs.py | 7 | ||||
-rw-r--r-- | src/tabs/conversationtab.py | 2 | ||||
-rw-r--r-- | src/tabs/muctab.py | 17 |
5 files changed, 45 insertions, 36 deletions
diff --git a/src/core/core.py b/src/core/core.py index a0bb243c..19eb9b16 100644 --- a/src/core/core.py +++ b/src/core/core.py @@ -458,7 +458,7 @@ class Core(object): default_tab = tabs.RosterInfoTab() default_tab.on_gain_focus() self.tabs.append(default_tab) - self.information(_('Welcome to poezio!')) + self.information(_('Welcome to poezio!'), _('Info')) if firstrun: self.information(_( 'It seems that it is the first time you start poezio.\n' @@ -1419,7 +1419,8 @@ class Core(object): Expand the information win a number of lines """ if self.information_win_size >= self.current_tab().height -5 or \ - self.information_win_size+nb >= self.current_tab().height-4: + self.information_win_size+nb >= self.current_tab().height-4 or\ + self.size.core_degrade_y: return 0 if self.information_win_size == 14: return 0 @@ -1437,7 +1438,7 @@ class Core(object): """ Reduce the size of the information win """ - if self.information_win_size == 0: + if self.information_win_size == 0 or self.size.core_degrade_y: return self.information_win_size -= nb if self.information_win_size < 0: @@ -1500,14 +1501,16 @@ class Core(object): Resize the global_information_win only once at each resize. """ with g_lock: - 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) + 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): """ @@ -1515,10 +1518,10 @@ class Core(object): """ with g_lock: 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): + 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, @@ -1528,8 +1531,10 @@ class Core(object): log.error('Curses error on infobar resize', exc_info=True) return self.left_tab_win = windows.VerticalGlobalInfoBar(truncated_win) - else: - self.left_tab_win = None + 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): diff --git a/src/core/handlers.py b/src/core/handlers.py index 05eab9f7..12e07201 100644 --- a/src/core/handlers.py +++ b/src/core/handlers.py @@ -813,7 +813,7 @@ def on_failed_connection(self): """ We cannot contact the remote server """ - self.information(_("Connection to remote server failed")) + self.information(_("Connection to remote server failed"), _('Error')) def on_disconnected(self, event): """ @@ -822,25 +822,27 @@ def on_disconnected(self, event): roster.modified() for tab in self.get_tabs(tabs.MucTab): tab.disconnect() - self.information(_("Disconnected from server.")) + self.information(_("Disconnected from server."), _('Error')) def on_failed_auth(self, event): """ Authentication failed """ - self.information(_("Authentication failed (bad credentials?).")) + self.information(_("Authentication failed (bad credentials?)."), + _('Error')) def on_no_auth(self, event): """ Authentication failed (no mech) """ - self.information(_("Authentication failed, no login method available.")) + self.information(_("Authentication failed, no login method available."), + _('Error')) def on_connected(self, event): """ Remote host responded, but we are not yet authenticated """ - self.information(_("Connected to server.")) + self.information(_("Connected to server."), 'Info') def on_session_start(self, event): """ @@ -849,8 +851,8 @@ def on_session_start(self, event): self.connection_time = time.time() if not self.plugins_autoloaded: # Do not reload plugins on reconnection self.autoload_plugins() - self.information(_("Authentication success.")) - self.information(_("Your JID is %s") % self.xmpp.boundjid.full) + self.information(_("Authentication success."), 'Info') + self.information(_("Your JID is %s") % self.xmpp.boundjid.full, 'Info') if not self.xmpp.anon: # request the roster self.xmpp.get_roster() diff --git a/src/tabs/basetabs.py b/src/tabs/basetabs.py index 77086ec6..ed40ce4a 100644 --- a/src/tabs/basetabs.py +++ b/src/tabs/basetabs.py @@ -187,7 +187,7 @@ class Tab(object): def resize(scr): with g_lock: Tab.height, Tab.width = scr.getmaxyx() - windows.Win._tab_win = scr + windows.Win._tab_win = scr def register_command(self, name, func, *, desc='', shortdesc='', completion=None, usage=''): """ @@ -283,8 +283,9 @@ class Tab(object): return False def refresh_tab_win(self): - if self.left_tab_win and not self.size.core_degrade_x: - self.left_tab_win.refresh() + if config.get('enable_vertical_tab_list', False): + if self.left_tab_win and not self.size.core_degrade_x: + self.left_tab_win.refresh() elif not self.size.core_degrade_y: self.tab_win.refresh() diff --git a/src/tabs/conversationtab.py b/src/tabs/conversationtab.py index d37ba4b7..756634ce 100644 --- a/src/tabs/conversationtab.py +++ b/src/tabs/conversationtab.py @@ -279,7 +279,7 @@ class ConversationTab(ChatTab): if display_bar: self.upper_bar.resize(1, self.width, 0, 0) self.info_header.resize(1, self.width, - self.height - 2 - bar_height - info_win_height + self.height - 2 - info_win_height - tab_win_height, 0) self.input.resize(1, self.width, self.height - 1, 0) diff --git a/src/tabs/muctab.py b/src/tabs/muctab.py index 2886a41e..500ea541 100644 --- a/src/tabs/muctab.py +++ b/src/tabs/muctab.py @@ -814,14 +814,13 @@ class MucTab(ChatTab): info_win_height = self.core.information_win_size - if display_user_list: - self.user_win.resize(self.height - 3 - info_win_height - - tab_win_height, - self.width - (self.width // 10) * 9 - 1, - 1, - (self.width // 10) * 9 + 1) - self.v_separator.resize(self.height - 2 - tab_win_height, - 1, 1, 9 * (self.width // 10)) + self.user_win.resize(self.height - 3 - info_win_height + - tab_win_height, + self.width - (self.width // 10) * 9 - 1, + 1, + (self.width // 10) * 9 + 1) + self.v_separator.resize(self.height - 3 - info_win_height - tab_win_height, + 1, 1, 9 * (self.width // 10)) self.topic_win.resize(1, self.width, 0, 0) @@ -949,6 +948,8 @@ class MucTab(ChatTab): self.width - (self.width // 10) * 9 - 1, 1, (self.width // 10) * 9 + 1) + self.v_separator.resize(self.height - 3 - self.core.information_win_size - Tab.tab_win_height(), + 1, 1, 9 * (self.width // 10)) self.text_win.resize(self.height - 3 - self.core.information_win_size - Tab.tab_win_height(), text_width, 1, 0) |