Philipp Hörist pushed to branch mainwindow at gajim / gajim


Commits:
f0f55aa7 by lovetox at 2021-04-29T14:34:06+02:00
Add SimpleLabel

- - - - -


3 changed files:

- gajim/gtk/conversation/rows/info.py
- gajim/gtk/conversation/rows/muc_join_left.py
- + gajim/gtk/conversation/rows/widgets.py


Changes:

=====================================
gajim/gtk/conversation/rows/info.py
=====================================
@@ -19,10 +19,9 @@
 from gi.repository import Gtk
 
 from gajim.common.const import AvatarSize
-from gajim.common.styling import process
 
+from .widgets import SimpleLabel
 from .base import BaseRow
-from ..message_widget import MessageWidget
 
 
 class InfoMessage(BaseRow):
@@ -43,9 +42,7 @@ def __init__(self, account, text):
         timestamp_widget.set_valign(Gtk.Align.START)
         self.grid.attach(timestamp_widget, 2, 0, 1, 1)
 
-        result = process(text)
-        message_widget = MessageWidget(account)
-        message_widget.add_content(result)
+        self._label = SimpleLabel()
 
-        self.grid.attach(message_widget, 1, 0, 1, 1)
+        self.grid.attach(self._label, 1, 0, 1, 1)
         self.show_all()


=====================================
gajim/gtk/conversation/rows/muc_join_left.py
=====================================
@@ -16,11 +16,11 @@
 from datetime import datetime
 
 from gi.repository import Gtk
-from gi.repository import Pango
 
 from gajim.common.i18n import _
 from gajim.common.const import AvatarSize
 
+from .widgets import SimpleLabel
 from .base import BaseRow
 
 
@@ -33,11 +33,7 @@ def __init__(self, type_, account, nick, reason=None, 
error=False):
         self.timestamp = datetime.fromtimestamp(timestamp)
         self.db_timestamp = timestamp
 
-        self._label = Gtk.Label()
-        self._label.set_selectable(True)
-        self._label.set_line_wrap(True)
-        self._label.set_xalign(0)
-        self._label.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)
+        self._label = SimpleLabel()
 
         if type_ == 'muc-user-joined':
             text = self._make_join_message(nick)


=====================================
gajim/gtk/conversation/rows/widgets.py
=====================================
@@ -0,0 +1,24 @@
+# This file is part of Gajim.
+#
+# Gajim is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published
+# by the Free Software Foundation; version 3 only.
+#
+# Gajim is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
+
+from gi.repository import Gtk
+
+
+class SimpleLabel(Gtk.Label):
+    def __init__(self):
+        Gtk.Label.__init__(self)
+        self.set_selectable(True)
+        self.set_line_wrap(True)
+        self.set_xalign(0)
+        self.set_line_wrap_mode(Pango.WrapMode.WORD_CHAR)



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/f0f55aa79e74a194afaf21a1f90e3968af561ff3

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/f0f55aa79e74a194afaf21a1f90e3968af561ff3
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

Reply via email to