From 0c9c4edfa2ed213baf600957a05b3f54d395996b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Sat, 1 Dec 2018 22:48:50 +0000 Subject: Allow additional information elements in MucInfoWin same as ConversationInfoWin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- poezio/windows/info_wins.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'poezio/windows/info_wins.py') diff --git a/poezio/windows/info_wins.py b/poezio/windows/info_wins.py index 0a8f0f27..2c0162b2 100644 --- a/poezio/windows/info_wins.py +++ b/poezio/windows/info_wins.py @@ -257,7 +257,7 @@ class MucInfoWin(InfoWin): def __init__(self): InfoWin.__init__(self) - def refresh(self, room, window=None, user=None): + def refresh(self, room, window=None, user=None, information=None): log.debug('Refresh: %s', self.__class__.__name__) self._win.erase() self.write_room_name(room) @@ -265,11 +265,22 @@ class MucInfoWin(InfoWin): self.write_own_nick(room) self.write_disconnected(room) self.write_role(room, user) + if information: + self.write_additional_information(information, room) if window: self.print_scroll_position(window) self.finish_line(get_theme().COLOR_INFORMATION_BAR) self._refresh() + def write_additional_information(self, information, jid): + """ + Write all information added by plugins by getting the + value returned by the callbacks. + """ + for key in information: + self.addstr(information[key](jid), + to_curses_attr(get_theme().COLOR_INFORMATION_BAR)) + def write_room_name(self, room): self.addstr('[', to_curses_attr(get_theme().COLOR_INFORMATION_BAR)) self.addstr(room.name, -- cgit v1.2.3 From 7d0d4ddb517a27bf5e49a292dad6d70d97056a4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Sat, 15 Dec 2018 20:55:54 +0000 Subject: Use additional info's value directly in MucInfoWin and ConversationInfoWin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- poezio/windows/info_wins.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'poezio/windows/info_wins.py') diff --git a/poezio/windows/info_wins.py b/poezio/windows/info_wins.py index 2c0162b2..d1426e67 100644 --- a/poezio/windows/info_wins.py +++ b/poezio/windows/info_wins.py @@ -87,8 +87,8 @@ class PrivateInfoWin(InfoWin): Write all information added by plugins by getting the value returned by the callbacks. """ - for key in information: - self.addstr(information[key](jid), + for plugin in information.values(): + self.addstr(plugin(jid), to_curses_attr(get_theme().COLOR_INFORMATION_BAR)) def write_room_name(self, name): @@ -277,8 +277,8 @@ class MucInfoWin(InfoWin): Write all information added by plugins by getting the value returned by the callbacks. """ - for key in information: - self.addstr(information[key](jid), + for plugin in information.values(): + self.addstr(plugin(jid), to_curses_attr(get_theme().COLOR_INFORMATION_BAR)) def write_room_name(self, room): -- cgit v1.2.3