Daniel Brötzmann pushed to branch mainwindow at gajim / gajim
Commits:
0589c500 by wurstsalat at 2021-04-28T22:15:50+02:00
MUCSubject: Add styling
- - - - -
6 changed files:
- gajim/data/style/default-dark.css
- gajim/data/style/default.css
- gajim/data/style/gajim.css
- gajim/gtk/controls/groupchat.py
- gajim/gtk/conversation/rows/muc_subject.py
- gajim/gtk/conversation/view.py
Changes:
=====================================
gajim/data/style/default-dark.css
=====================================
@@ -9,7 +9,8 @@
color: rgb(200, 200, 200);
}
.gajim-status-message {
- color: rgb(140, 175, 210);
+ color: rgb(205, 225, 255);
+ background: rgb(40, 60, 80);
}
.gajim-url {
color: rgb(60, 135, 220);
=====================================
gajim/data/style/default.css
=====================================
@@ -9,7 +9,8 @@
color: rgb(85, 85, 85);
}
.gajim-status-message {
- color: rgb(100, 130, 160);
+ color: rgb(40, 70, 100);
+ background: rgb(225, 235, 250);
}
.gajim-url {
color: rgb(30, 75, 135);
=====================================
gajim/data/style/gajim.css
=====================================
@@ -75,6 +75,10 @@
.conversation-date-row {
padding: 12px;
}
+.conversation-subject-box {
+ border-radius: 6px;
+ padding: 12px;
+}
.conversation-meta {
color: @insensitive_fg_color;
font-size: small;
=====================================
gajim/gtk/controls/groupchat.py
=====================================
@@ -807,17 +807,15 @@ def _on_room_subject(self, _contact, _signal_name,
properties):
self._subject_data = properties
- text = _('%(nick)s has set the subject to %(subject)s') % {
- 'nick': properties.muc_nickname, 'subject': properties.subject}
-
+ date = None
if properties.user_timestamp:
date = time.strftime('%c',
time.localtime(properties.user_timestamp))
- text = '%s - %s' % (text, date)
if (app.settings.get('show_subject_on_join') or
not self.contact.is_joining):
- self.conversation_view.add_muc_subject(text)
+ self.conversation_view.add_muc_subject(
+ properties.subject, properties.muc_nickname, date)
def _on_room_config_changed(self, _contact, _signal_name, properties):
# http://www.xmpp.org/extensions/xep-0045.html#roomconfig-notify
=====================================
gajim/gtk/conversation/rows/muc_subject.py
=====================================
@@ -18,6 +18,8 @@
from gi.repository import GLib
from gi.repository import Gtk
+from gajim.common.const import AvatarSize
+from gajim.common.i18n import _
from gajim.common.styling import process
from .base import BaseRow
@@ -28,7 +30,7 @@ class MUCSubject(BaseRow):
type = 'muc-subject'
- def __init__(self, account, text):
+ def __init__(self, account, text, nick, date):
BaseRow.__init__(self, account)
timestamp = time.time()
@@ -37,16 +39,35 @@ def __init__(self, account, text):
text = GLib.markup_escape_text(text)
- # avatar_placeholder = Gtk.Box()
- # avatar_placeholder.set_size_request(AvatarSize.ROSTER, -1)
- # self.grid.attach(avatar_placeholder, 0, 0, 1, 2)
- timestamp_widget = self.create_timestamp_widget(self.timestamp)
- timestamp_widget.set_valign(Gtk.Align.START)
- self.grid.attach(timestamp_widget, 2, 0, 1, 1)
+ avatar_placeholder = Gtk.Box()
+ avatar_placeholder.set_size_request(AvatarSize.ROSTER, -1)
+ self.grid.attach(avatar_placeholder, 0, 0, 1, 2)
+
+ subject_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
+ subject_box.get_style_context().add_class('conversation-subject-box')
+ subject_box.get_style_context().add_class('gajim-status-message')
+
+ title = Gtk.Label(label=_('Subject'))
+ title.set_halign(Gtk.Align.START)
+ title.get_style_context().add_class('bold')
+ subject_box.add(title)
+
+ meta_str = _('Changed by %s') % nick
+ if date is not None:
+ meta_str = f'{meta_str} ({date})'
+ meta = Gtk.Label(label=meta_str)
+ meta.set_halign(Gtk.Align.START)
+ meta.get_style_context().add_class('small-label')
+ subject_box.add(meta)
result = process(text)
message_widget = MessageWidget(account)
message_widget.add_content(result)
+ subject_box.add(message_widget)
+ self.grid.attach(subject_box, 1, 0, 1, 1)
+
+ timestamp_widget = self.create_timestamp_widget(self.timestamp)
+ timestamp_widget.set_valign(Gtk.Align.START)
+ self.grid.attach(timestamp_widget, 2, 0, 1, 1)
- self.grid.attach(message_widget, 1, 0, 1, 1)
self.show_all()
=====================================
gajim/gtk/conversation/view.py
=====================================
@@ -106,8 +106,8 @@ def _sort_func(self, row1, row2):
return 0
return -1 if row1.timestamp < row2.timestamp else 1
- def add_muc_subject(self, text):
- subject = MUCSubject(self._account, text)
+ def add_muc_subject(self, text, nick, date):
+ subject = MUCSubject(self._account, text, nick, date)
self._insert_message(subject)
def add_info_message(self, text):
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/0589c50026094c05de5d5aa5e1a1d8a2f62cde8e
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/0589c50026094c05de5d5aa5e1a1d8a2f62cde8e
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits