Skip to content
Snippets Groups Projects
Commit aedc06ae authored by Daniel Brötzmann's avatar Daniel Brötzmann Committed by Philipp Hörist
Browse files

MUCUserStatus: Add styling

parent 6ec56a1e
No related branches found
No related tags found
No related merge requests found
......@@ -20,10 +20,15 @@
from gajim.common.i18n import _
from gajim.common.const import AvatarSize
from gajim.common import helpers
from gajim.common.styling import process
from .widgets import SimpleLabel
from .base import BaseRow
from ..message_widget import MessageWidget
from ...avatar import get_show_circle
class MUCUserStatus(BaseRow):
def __init__(self, account, user_contact, is_self):
......@@ -38,15 +43,26 @@ def __init__(self, account, user_contact, is_self):
avatar_placeholder.set_size_request(AvatarSize.ROSTER, -1)
self.grid.attach(avatar_placeholder, 0, 0, 1, 1)
icon_name = 'feather-info-symbolic'
icon = Gtk.Image.new_from_icon_name(icon_name, Gtk.IconSize.MENU)
self.grid.attach(icon, 1, 0, 1, 1)
show_icon = Gtk.Image()
show_icon.set_opacity(0.6)
surface = get_show_circle(
user_contact.show.value,
AvatarSize.SHOW_CIRCLE,
self.get_scale_factor())
show_icon.set_from_surface(surface)
self.grid.attach(show_icon, 1, 0, 1, 1)
self._label = SimpleLabel()
self._label.set_text(self._make_text(user_contact, is_self))
self._label.set_text(self._make_show_text(user_contact, is_self))
self._label.get_style_context().add_class('gajim-status-message')
self.grid.attach(self._label, 2, 0, 1, 1)
if user_contact.status is not None:
result = process(user_contact.status)
message_widget = MessageWidget(account)
message_widget.add_content(result)
self.grid.attach(message_widget, 2, 1, 1, 1)
timestamp_widget = self.create_timestamp_widget(self.timestamp)
timestamp_widget.set_hexpand(True)
timestamp_widget.set_halign(Gtk.Align.END)
......@@ -56,18 +72,14 @@ def __init__(self, account, user_contact, is_self):
self.show_all()
@staticmethod
def _make_text(user_contact, is_self):
def _make_show_text(user_contact, is_self):
nick = user_contact.name
status = user_contact.status
status = '' if status is None else ' - %s' % status
show = helpers.get_uf_show(user_contact.show.value)
if is_self:
message = _('You are now {show}{status}').format(show=show,
status=status)
message = _('You are now {show}').format(show=show)
else:
message = _('{nick} is now {show}{status}').format(nick=nick,
show=show,
status=status)
message = _('{nick} is now {show}').format(nick=nick,
show=show)
return message
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment