This commit is contained in:
mathieui 2011-02-02 00:51:34 +01:00
parent 89f337a457
commit 01f3409505
3 changed files with 14 additions and 3 deletions

View file

@ -134,6 +134,15 @@ class Roster(object):
log.debug('folded:%s\n' %folded_groups)
config.set_and_save('folded_roster_groups', folded_groups, 'var')
def get_nb_connected_contacts(self):
"""
Return the number of contacts connected
"""
length = 0
for group in self._roster_groups:
length += group.get_nb_connected_contacts()
return length
def __len__(self):
"""
Return the number of line that would be printed

View file

@ -283,7 +283,7 @@ class InfoTab(ChatTab):
self.tab_win.resize(1, self.width, self.height-2, 0, self.core.stdscr)
self.info_win.resize(self.height-2, self.width, 0, 0, self.core.stdscr)
self.input.resize(1, self.width, self.height-1, 0, self.core.stdscr)
def refresh(self, tabs, informations, _):
if not self.visible:
return

View file

@ -1259,7 +1259,8 @@ class RosterWin(Win):
def draw_roster_information(self, roster):
"""
"""
self.addstr('Roster: %s contacts' % roster.get_contact_len(), curses.color_pair(theme.COLOR_INFORMATION_BAR))
self.addstr('Roster: %s/%s contacts' % (roster.get_nb_connected_contacts(), roster.get_contact_len())\
, curses.color_pair(theme.COLOR_INFORMATION_BAR))
self.finish_line(theme.COLOR_INFORMATION_BAR)
def draw_group(self, y, group, colored):
@ -1272,7 +1273,8 @@ class RosterWin(Win):
self.addstr(y, 0, '[+] ')
else:
self.addstr(y, 0, '[-] ')
self.addstr(y, 4, group.name)
contacts = " (%s/%s)" % (group.get_nb_connected_contacts(), len(group))
self.addstr(y, 4, group.name + contacts)
if colored:
self._win.attroff(curses.color_pair(theme.COLOR_SELECTED_ROW))