diff options
author | mathieui <mathieui@mathieui.net> | 2018-07-23 20:38:34 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2018-07-23 20:38:34 +0200 |
commit | 54875e1ad55348e400efe2d75efdd2b0503235e2 (patch) | |
tree | 4e90cf785b03b273ca4026cdcafa9d9cea25f23f /poezio/core/core.py | |
parent | fdc797aec733c355e1e36ddd4b508a833dc71c31 (diff) | |
download | poezio-54875e1ad55348e400efe2d75efdd2b0503235e2.tar.gz poezio-54875e1ad55348e400efe2d75efdd2b0503235e2.tar.bz2 poezio-54875e1ad55348e400efe2d75efdd2b0503235e2.tar.xz poezio-54875e1ad55348e400efe2d75efdd2b0503235e2.zip |
Use the event handler to refresh when the tab changes
Diffstat (limited to 'poezio/core/core.py')
-rw-r--r-- | poezio/core/core.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/poezio/core/core.py b/poezio/core/core.py index fffb5fb0..eee580d5 100644 --- a/poezio/core/core.py +++ b/poezio/core/core.py @@ -98,6 +98,8 @@ class Core: self.plugins_autoloaded = False self.plugin_manager = PluginManager(self) self.events = events.EventHandler() + self.events.add_event_handler('tab_change', + self.on_tab_change) self.tabs = Tabs(self.events) self.previous_tab_nb = 0 @@ -347,6 +349,12 @@ class Core: self.add_configuration_handler("", self.on_any_config_change) + def on_tab_change(self, old_tab, new_tab): + """Whenever the current tab changes, change focus and refresh""" + old_tab.on_lose_focus() + new_tab.on_gain_focus() + self.refresh_window() + def on_any_config_change(self, option, value): """ Update the roster, in case a roster option changed. @@ -1028,19 +1036,13 @@ class Core: """ rotate the rooms list to the right """ - self.tabs.current_tab.on_lose_focus() self.tabs.next() - self.tabs.current_tab.on_gain_focus() - self.refresh_window() def rotate_rooms_left(self, args=None): """ rotate the rooms list to the right """ - self.tabs.current_tab.on_lose_focus() self.tabs.prev() - self.tabs.current_tab.on_gain_focus() - self.refresh_window() def go_to_room_number(self): """ |