From c6cf2d08b7295a477d89d01535463d18103f6311 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 22 Jul 2018 16:17:06 +0200 Subject: Fix close_all and change_title plugins --- plugins/change_title.py | 6 ++---- plugins/close_all.py | 7 +++---- 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'plugins') diff --git a/plugins/change_title.py b/plugins/change_title.py index 92fcb5c3..e5ed96a8 100644 --- a/plugins/change_title.py +++ b/plugins/change_title.py @@ -8,7 +8,7 @@ import sys class Plugin(BasePlugin): def init(self): - self.on_tab_change(0, self.core.current_tab_nb) + self.on_tab_change(None, new_tab=self.core.tabs.current_tab) self.api.add_event_handler('tab_change', self.on_tab_change) def cleanup(self): @@ -16,8 +16,6 @@ class Plugin(BasePlugin): sys.stdout.write("\x1b]0;poezio\x07") sys.stdout.flush() - def on_tab_change(self, old, new): - new_tab = self.core.get_tab_by_number(new) + def on_tab_change(self, old_tab, new_tab): sys.stdout.write("\x1b]0;{}\x07".format(new_tab.name)) sys.stdout.flush() - diff --git a/plugins/close_all.py b/plugins/close_all.py index 93bcdcfc..faf1d0ea 100644 --- a/plugins/close_all.py +++ b/plugins/close_all.py @@ -26,19 +26,18 @@ class Plugin(BasePlugin): """ /closeall """ - current = self.core.current_tab() + current = self.api.current_tab() if not isinstance(current, (tabs.RosterInfoTab, tabs.MucTab)): self.core.go_to_roster() - current = self.core.current_tab() + current = self.api.current_tab() def filter_func(x): return not isinstance(x, (tabs.RosterInfoTab, tabs.MucTab)) - matching_tabs = list(filter(filter_func, self.core.tabs)) + matching_tabs = list(filter(filter_func, self.core.tabs.get_tabs())) length = len(matching_tabs) for tab in matching_tabs: self.core.close_tab(tab) - self.core.current_tab_nb = current.nb self.api.information('%s tabs closed.' % length, 'Info') self.core.refresh_window() -- cgit v1.2.3