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


Commits:
f2411549 by Nicoco at 2024-04-21T10:30:49+00:00
feat: Display emoji-only messages with a larger font

- - - - -


7 changed files:

- README.md
- flatpak/org.gajim.Gajim.Devel.yaml
- flatpak/org.gajim.Gajim.yaml
- gajim/data/style/default.css
- gajim/gtk/conversation/plain_widget.py
- pyproject.toml
- win/_base.sh


Changes:

=====================================
README.md
=====================================
@@ -7,6 +7,7 @@ ### Runtime Requirements
 - [cairo](https://gitlab.freedesktop.org/cairo/cairo) (>=1.16.0)
 - [cryptography](https://pypi.org/project/cryptography/) (>=3.4.8)
 - [css-parser](https://pypi.org/project/css-parser/)
+- [emoji](https://pypi.org/project/emoji/) (>=2.6.0)
 - [GLib](https://gitlab.gnome.org/GNOME/glib) (>=2.66.0)
 - [Gtk3](https://gitlab.gnome.org/GNOME/gtk) (>=3.24.30)
 - [GtkSourceView](https://gitlab.gnome.org/GNOME/gtksourceview)


=====================================
flatpak/org.gajim.Gajim.Devel.yaml
=====================================
@@ -324,6 +324,15 @@ modules:
         url: 
https://files.pythonhosted.org/packages/py3/S/SQLAlchemy/SQLAlchemy-2.0.29-py3-none-any.whl
         sha256: 
dc4ee2d4ee43251905f88637d5281a8d52e916a021384ec10758826f5cbae305
 
+  - name: python3-emoji
+    buildsystem: simple
+    build-commands:
+      - pip3 install emoji-2.11.0-py2.py3-none-any.whl
+    sources:
+      - type: file
+        url: 
https://files.pythonhosted.org/packages/55/c1/1d97d960831e23a3dd8608b0b489eb4866144445475277a443efb0379609/emoji-2.11.0-py2.py3-none-any.whl
+        sha256: 
63fc9107f06c6c2e48e5078ce9575cef98518f5ac09474f6148a43e989989582
+
   # gssapi dependency
   - name: python3-decorator
     buildsystem: simple


=====================================
flatpak/org.gajim.Gajim.yaml
=====================================
@@ -317,6 +317,15 @@ modules:
         url: 
https://files.pythonhosted.org/packages/py3/S/SQLAlchemy/SQLAlchemy-2.0.29-py3-none-any.whl
         sha256: 
dc4ee2d4ee43251905f88637d5281a8d52e916a021384ec10758826f5cbae305
 
+  - name: python3-emoji
+    buildsystem: simple
+    build-commands:
+      - pip3 install emoji-2.11.0-py2.py3-none-any.whl
+    sources:
+      - type: file
+        url: 
https://files.pythonhosted.org/packages/55/c1/1d97d960831e23a3dd8608b0b489eb4866144445475277a443efb0379609/emoji-2.11.0-py2.py3-none-any.whl
+        sha256: 
63fc9107f06c6c2e48e5078ce9575cef98518f5ac09474f6148a43e989989582
+
   # gssapi dependency
   - name: python3-decorator
     buildsystem: simple


=====================================
gajim/data/style/default.css
=====================================
@@ -72,3 +72,9 @@ .gajim-status-offline {
 .gajim-status-connecting {
     color: rgb(77, 166, 255);
 }
+.gajim-single-emoji-msg {
+    font-size: 36pt
+}
+.gajim-emoji-msg {
+    font-size: 24pt
+}


=====================================
gajim/gtk/conversation/plain_widget.py
=====================================
@@ -6,6 +6,7 @@
 
 import logging
 
+import emoji
 from gi.repository import Gdk
 from gi.repository import GLib
 from gi.repository import Gtk
@@ -104,6 +105,15 @@ def print_text_with_styling(self, block: PlainBlock) -> 
None:
 
         self.set_attributes(make_pango_attributes(block))
 
+        stripped = text.strip()
+        if emoji.purely_emoji(stripped):
+            emoji_count = emoji.emoji_count(stripped)
+            if emoji_count == 1:
+                classname = 'gajim-single-emoji-msg'
+            else:
+                classname = 'gajim-emoji-msg'
+            self.get_style_context().add_class(classname)
+
     def add_action_phrase(self, text: str, nickname: str) -> None:
         text = text.replace('/me', f'* {nickname}', 1)
         uris = process_uris(text)


=====================================
pyproject.toml
=====================================
@@ -27,6 +27,7 @@ classifiers = [
 dependencies = [
   "cryptography>=3.4.8",
   "css-parser",
+  "emoji>=2.6.0",
   "keyring",
   "nbxmpp>=4.5.3,<5.0.0",
   "omemo-dr>=1.0.0,<2.0.0",
@@ -183,7 +184,7 @@ select = [
     # "DJ",    # flake8-django
     # "DTZ",   # flake8-datetimez
     "E",     # Error
-    # "EM",    # flake8-errmsg 
+    # "EM",    # flake8-errmsg
     # "ERA",   # eradicate
     "EXE",   # flake8-executable
     "F",     # Pyflakes


=====================================
win/_base.sh
=====================================
@@ -108,6 +108,7 @@ python-gnupg
 qrcode
 css_parser
 sentry-sdk
+emoji
 "
 
     build_pip install precis-i18n



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

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/f241154928036079d25456329e87b34ccf45eda5
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to