[Sef] Group Chat roster has now tooltips
This commit is contained in:
parent
650bbdca39
commit
564f35d61c
|
@ -270,7 +270,7 @@ class GroupchatWindow(chat.Chat):
|
||||||
def escape(self, s):
|
def escape(self, s):
|
||||||
return s.replace('&', '&').replace('<', '<').replace('>', '>')
|
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()
|
model = self.list_treeview[room_jid].get_model()
|
||||||
image = self.plugin.roster.jabber_state_images[show]
|
image = self.plugin.roster.jabber_state_images[show]
|
||||||
resource = ''
|
resource = ''
|
||||||
|
@ -291,7 +291,7 @@ class GroupchatWindow(chat.Chat):
|
||||||
iter = model.append(role_iter, (image, nick, self.escape(nick)))
|
iter = model.append(role_iter, (image, nick, self.escape(nick)))
|
||||||
gajim.gc_contacts[self.account][room_jid][nick] = \
|
gajim.gc_contacts[self.account][room_jid][nick] = \
|
||||||
Contact(jid = j, name = nick, show = show, resource = resource,
|
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
|
if nick == self.nicks[room_jid]: # we became online
|
||||||
self.got_connected(room_jid)
|
self.got_connected(room_jid)
|
||||||
self.list_treeview[room_jid].expand_row((model.get_path(role_iter)),
|
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)
|
iter = self.get_contact_iter(room_jid, nick)
|
||||||
if not iter:
|
if not iter:
|
||||||
iter = self.add_contact_to_roster(room_jid, nick, show, role, jid,
|
iter = self.add_contact_to_roster(room_jid, nick, show, role, jid,
|
||||||
affiliation)
|
affiliation, status)
|
||||||
else:
|
else:
|
||||||
actual_role = self.get_role(room_jid, nick)
|
actual_role = self.get_role(room_jid, nick)
|
||||||
if role != actual_role:
|
if role != actual_role:
|
||||||
self.remove_contact(room_jid, nick)
|
self.remove_contact(room_jid, nick)
|
||||||
self.add_contact_to_roster(room_jid, nick, show, role, jid,
|
self.add_contact_to_roster(room_jid, nick, show, role, jid,
|
||||||
affiliation)
|
affiliation, status)
|
||||||
else:
|
else:
|
||||||
c = gajim.gc_contacts[self.account][room_jid][nick]
|
c = gajim.gc_contacts[self.account][room_jid][nick]
|
||||||
if c.show == show and c.status == status and \
|
if c.show == show and c.status == status and \
|
||||||
|
@ -377,6 +377,7 @@ class GroupchatWindow(chat.Chat):
|
||||||
return
|
return
|
||||||
c.show = show
|
c.show = show
|
||||||
c.affiliation = affiliation
|
c.affiliation = affiliation
|
||||||
|
c.status = status
|
||||||
roster = self.plugin.roster
|
roster = self.plugin.roster
|
||||||
state_images = roster.get_appropriate_state_images(jid)
|
state_images = roster.get_appropriate_state_images(jid)
|
||||||
image = state_images[show]
|
image = state_images[show]
|
||||||
|
@ -392,6 +393,7 @@ class GroupchatWindow(chat.Chat):
|
||||||
self.print_conversation(st, room_jid)
|
self.print_conversation(st, room_jid)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def set_subject(self, room_jid, subject):
|
def set_subject(self, room_jid, subject):
|
||||||
self.subjects[room_jid] = subject
|
self.subjects[room_jid] = subject
|
||||||
name_label = self.name_labels[room_jid]
|
name_label = self.name_labels[room_jid]
|
||||||
|
@ -1070,7 +1072,6 @@ class GroupchatWindow(chat.Chat):
|
||||||
self.got_disconnected(room_jid) #init some variables
|
self.got_disconnected(room_jid) #init some variables
|
||||||
conversation_textview.grab_focus()
|
conversation_textview.grab_focus()
|
||||||
self.childs[room_jid].show_all()
|
self.childs[room_jid].show_all()
|
||||||
|
|
||||||
def on_list_treeview_motion_notify_event(self, widget, event):
|
def on_list_treeview_motion_notify_event(self, widget, event):
|
||||||
model = widget.get_model()
|
model = widget.get_model()
|
||||||
props = widget.get_path_at_pos(int(event.x), int(event.y))
|
props = widget.get_path_at_pos(int(event.x), int(event.y))
|
||||||
|
|
|
@ -248,10 +248,12 @@ class GCTooltip(BaseTooltip, StatusTable):
|
||||||
def __init__(self, plugin):
|
def __init__(self, plugin):
|
||||||
self.account = None
|
self.account = None
|
||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
|
|
||||||
self.text_lable = gtk.Label()
|
self.text_lable = gtk.Label()
|
||||||
self.text_lable.set_line_wrap(True)
|
self.text_lable.set_line_wrap(True)
|
||||||
self.text_lable.set_alignment(0., 0.)
|
self.text_lable.set_alignment(0., 0.)
|
||||||
self.text_lable.set_selectable(False)
|
self.text_lable.set_selectable(False)
|
||||||
|
|
||||||
BaseTooltip.__init__(self)
|
BaseTooltip.__init__(self)
|
||||||
|
|
||||||
def populate(self, contact):
|
def populate(self, contact):
|
||||||
|
@ -259,7 +261,12 @@ class GCTooltip(BaseTooltip, StatusTable):
|
||||||
return
|
return
|
||||||
self.create_window()
|
self.create_window()
|
||||||
hbox = gtk.HBox()
|
hbox = gtk.HBox()
|
||||||
info = '<span size="large" weight="bold">' + contact.name + '</span>'
|
|
||||||
|
if contact.jid.strip() != '':
|
||||||
|
info = '<span size="large" weight="bold">' + contact.jid + '</span>'
|
||||||
|
else:
|
||||||
|
info = '<span size="large" weight="bold">' + contact.name + '</span>'
|
||||||
|
|
||||||
info += '\n<span weight="bold">' + _('Role: ') + '</span>' + \
|
info += '\n<span weight="bold">' + _('Role: ') + '</span>' + \
|
||||||
helpers.get_uf_role(contact.role)
|
helpers.get_uf_role(contact.role)
|
||||||
|
|
||||||
|
@ -275,11 +282,19 @@ class GCTooltip(BaseTooltip, StatusTable):
|
||||||
# escape markup entities
|
# escape markup entities
|
||||||
info += ' - ' + gtkgui_helpers.escape_for_pango_markup(status)
|
info += ' - ' + gtkgui_helpers.escape_for_pango_markup(status)
|
||||||
|
|
||||||
|
if contact.resource.strip() != '':
|
||||||
|
info += '\n<span weight="bold">' + _('Resource: ') + \
|
||||||
|
'</span>' + gtkgui_helpers.escape_for_pango_markup(
|
||||||
|
contact.resource)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
self.text_lable.set_markup(info)
|
self.text_lable.set_markup(info)
|
||||||
hbox.add(self.text_lable)
|
hbox.add(self.text_lable)
|
||||||
self.win.add(hbox)
|
self.win.add(hbox)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class RosterTooltip(BaseTooltip, StatusTable):
|
class RosterTooltip(BaseTooltip, StatusTable):
|
||||||
''' Tooltip that is shown in the roster treeview '''
|
''' Tooltip that is shown in the roster treeview '''
|
||||||
def __init__(self, plugin):
|
def __init__(self, plugin):
|
||||||
|
@ -455,4 +470,4 @@ class FileTransfersTooltip(BaseTooltip):
|
||||||
text += status
|
text += status
|
||||||
self.text_lable.set_markup(text)
|
self.text_lable.set_markup(text)
|
||||||
self.hbox.add(self.text_lable)
|
self.hbox.add(self.text_lable)
|
||||||
self.win.add(self.hbox)
|
|
||||||
|
|
Loading…
Reference in New Issue