diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2017-10-07 18:08:39 +0100 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2017-10-07 18:11:33 +0100 |
commit | 554ff650bff79488d259f32622dbc6b49842c243 (patch) | |
tree | 0ca47c1266b91829e74198de8be15fc0407270ab /poezio/tabs/rostertab.py | |
parent | 232ef11630eed44d9f15b2e09b35bffb022c7afd (diff) | |
download | poezio-554ff650bff79488d259f32622dbc6b49842c243.tar.gz poezio-554ff650bff79488d259f32622dbc6b49842c243.tar.bz2 poezio-554ff650bff79488d259f32622dbc6b49842c243.tar.xz poezio-554ff650bff79488d259f32622dbc6b49842c243.zip |
Display contact avatar in the roster.
Implements XEP-0084 and XEP-0153.
Diffstat (limited to 'poezio/tabs/rostertab.py')
-rw-r--r-- | poezio/tabs/rostertab.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/poezio/tabs/rostertab.py b/poezio/tabs/rostertab.py index 00992e3c..2aa2fa5a 100644 --- a/poezio/tabs/rostertab.py +++ b/poezio/tabs/rostertab.py @@ -44,6 +44,7 @@ class RosterInfoTab(Tab): self.core.information_buffer.add_window(self.information_win) self.roster_win = windows.RosterWin() self.contact_info_win = windows.ContactInfoWin() + self.avatar_win = windows.ImageWin() self.default_help_message = windows.HelpText("Enter commands with “/”. “o”: toggle offline show") self.input = self.default_help_message self.state = 'normal' @@ -513,11 +514,14 @@ class RosterInfoTab(Tab): info_width, 0, roster_width + 1, self.core.information_buffer) if display_contact_win: + y = self.height - tab_win_height - contact_win_h - 1 + avatar_width = contact_win_h * 2 self.contact_info_win.resize(contact_win_h, - info_width, - self.height - tab_win_height - - contact_win_h - 1, - roster_width + 1) + info_width - avatar_width, + y, roster_width + 1) + self.avatar_win.resize(contact_win_h, + avatar_width, + y, self.width - avatar_width) self.roster_win.resize(self.height - 1 - Tab.tab_win_height(), roster_width, 0, 0) self.input.resize(1, self.width, self.height-1, 0) @@ -989,8 +993,12 @@ class RosterInfoTab(Tab): self.v_separator.refresh() self.information_win.refresh() if display_contact_win: - self.contact_info_win.refresh( - self.roster_win.get_selected_row()) + row = self.roster_win.get_selected_row() + self.contact_info_win.refresh(row) + if isinstance(row, Contact): + self.avatar_win.refresh(row.avatar) + else: + self.avatar_win.refresh(None) self.refresh_tab_win() self.input.refresh() |