From 564f35d61c3f4b2c3bebe09913e1fb006c6fabc0 Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Sat, 3 Sep 2005 17:30:49 +0000 Subject: [PATCH] [Sef] Group Chat roster has now tooltips --- src/groupchat_window.py | 11 ++++++----- src/tooltips.py | 19 +++++++++++++++++-- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/groupchat_window.py b/src/groupchat_window.py index 7d5f41c2c..7c8e1bf36 100644 --- a/src/groupchat_window.py +++ b/src/groupchat_window.py @@ -270,7 +270,7 @@ class GroupchatWindow(chat.Chat): def escape(self, s): return s.replace('&', '&').replace('<', '<').replace('>', '>') - def add_contact_to_roster(self, room_jid, nick, show, role, jid, affiliation): + def add_contact_to_roster(self, room_jid, nick, show, role, jid, affiliation, status): model = self.list_treeview[room_jid].get_model() image = self.plugin.roster.jabber_state_images[show] resource = '' @@ -291,7 +291,7 @@ class GroupchatWindow(chat.Chat): iter = model.append(role_iter, (image, nick, self.escape(nick))) gajim.gc_contacts[self.account][room_jid][nick] = \ Contact(jid = j, name = nick, show = show, resource = resource, - role = role, affiliation = affiliation) + role = role, affiliation = affiliation, status = status) if nick == self.nicks[room_jid]: # we became online self.got_connected(room_jid) self.list_treeview[room_jid].expand_row((model.get_path(role_iter)), @@ -363,13 +363,13 @@ class GroupchatWindow(chat.Chat): iter = self.get_contact_iter(room_jid, nick) if not iter: iter = self.add_contact_to_roster(room_jid, nick, show, role, jid, - affiliation) + affiliation, status) else: actual_role = self.get_role(room_jid, nick) if role != actual_role: self.remove_contact(room_jid, nick) self.add_contact_to_roster(room_jid, nick, show, role, jid, - affiliation) + affiliation, status) else: c = gajim.gc_contacts[self.account][room_jid][nick] if c.show == show and c.status == status and \ @@ -377,6 +377,7 @@ class GroupchatWindow(chat.Chat): return c.show = show c.affiliation = affiliation + c.status = status roster = self.plugin.roster state_images = roster.get_appropriate_state_images(jid) image = state_images[show] @@ -391,6 +392,7 @@ class GroupchatWindow(chat.Chat): st += ' (' + status + ')' self.print_conversation(st, room_jid) + def set_subject(self, room_jid, subject): self.subjects[room_jid] = subject @@ -1070,7 +1072,6 @@ class GroupchatWindow(chat.Chat): self.got_disconnected(room_jid) #init some variables conversation_textview.grab_focus() self.childs[room_jid].show_all() - def on_list_treeview_motion_notify_event(self, widget, event): model = widget.get_model() props = widget.get_path_at_pos(int(event.x), int(event.y)) diff --git a/src/tooltips.py b/src/tooltips.py index 1990eecdf..f72d67675 100644 --- a/src/tooltips.py +++ b/src/tooltips.py @@ -248,10 +248,12 @@ class GCTooltip(BaseTooltip, StatusTable): def __init__(self, plugin): self.account = None self.plugin = plugin + self.text_lable = gtk.Label() self.text_lable.set_line_wrap(True) self.text_lable.set_alignment(0., 0.) self.text_lable.set_selectable(False) + BaseTooltip.__init__(self) def populate(self, contact): @@ -259,7 +261,12 @@ class GCTooltip(BaseTooltip, StatusTable): return self.create_window() hbox = gtk.HBox() - info = '' + contact.name + '' + + if contact.jid.strip() != '': + info = '' + contact.jid + '' + else: + info = '' + contact.name + '' + info += '\n' + _('Role: ') + '' + \ helpers.get_uf_role(contact.role) @@ -274,12 +281,20 @@ class GCTooltip(BaseTooltip, StatusTable): if status != '': # escape markup entities info += ' - ' + gtkgui_helpers.escape_for_pango_markup(status) + + if contact.resource.strip() != '': + info += '\n' + _('Resource: ') + \ + '' + gtkgui_helpers.escape_for_pango_markup( + contact.resource) + + self.text_lable.set_markup(info) hbox.add(self.text_lable) self.win.add(hbox) + class RosterTooltip(BaseTooltip, StatusTable): ''' Tooltip that is shown in the roster treeview ''' def __init__(self, plugin): @@ -455,4 +470,4 @@ class FileTransfersTooltip(BaseTooltip): text += status self.text_lable.set_markup(text) self.hbox.add(self.text_lable) - self.win.add(self.hbox) +