Skip to content
Snippets Groups Projects
Commit f2411549 authored by Nicoco's avatar Nicoco Committed by Philipp Hörist
Browse files

feat: Display emoji-only messages with a larger font

parent a71a1874
No related branches found
No related tags found
No related merge requests found
...@@ -7,6 +7,7 @@ ### Runtime Requirements ...@@ -7,6 +7,7 @@ ### Runtime Requirements
- [cairo](https://gitlab.freedesktop.org/cairo/cairo) (>=1.16.0) - [cairo](https://gitlab.freedesktop.org/cairo/cairo) (>=1.16.0)
- [cryptography](https://pypi.org/project/cryptography/) (>=3.4.8) - [cryptography](https://pypi.org/project/cryptography/) (>=3.4.8)
- [css-parser](https://pypi.org/project/css-parser/) - [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) - [GLib](https://gitlab.gnome.org/GNOME/glib) (>=2.66.0)
- [Gtk3](https://gitlab.gnome.org/GNOME/gtk) (>=3.24.30) - [Gtk3](https://gitlab.gnome.org/GNOME/gtk) (>=3.24.30)
- [GtkSourceView](https://gitlab.gnome.org/GNOME/gtksourceview) - [GtkSourceView](https://gitlab.gnome.org/GNOME/gtksourceview)
......
...@@ -324,6 +324,15 @@ modules: ...@@ -324,6 +324,15 @@ modules:
url: https://files.pythonhosted.org/packages/py3/S/SQLAlchemy/SQLAlchemy-2.0.29-py3-none-any.whl url: https://files.pythonhosted.org/packages/py3/S/SQLAlchemy/SQLAlchemy-2.0.29-py3-none-any.whl
sha256: dc4ee2d4ee43251905f88637d5281a8d52e916a021384ec10758826f5cbae305 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 # gssapi dependency
- name: python3-decorator - name: python3-decorator
buildsystem: simple buildsystem: simple
......
...@@ -317,6 +317,15 @@ modules: ...@@ -317,6 +317,15 @@ modules:
url: https://files.pythonhosted.org/packages/py3/S/SQLAlchemy/SQLAlchemy-2.0.29-py3-none-any.whl url: https://files.pythonhosted.org/packages/py3/S/SQLAlchemy/SQLAlchemy-2.0.29-py3-none-any.whl
sha256: dc4ee2d4ee43251905f88637d5281a8d52e916a021384ec10758826f5cbae305 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 # gssapi dependency
- name: python3-decorator - name: python3-decorator
buildsystem: simple buildsystem: simple
......
...@@ -72,3 +72,9 @@ .gajim-status-offline { ...@@ -72,3 +72,9 @@ .gajim-status-offline {
.gajim-status-connecting { .gajim-status-connecting {
color: rgb(77, 166, 255); color: rgb(77, 166, 255);
} }
.gajim-single-emoji-msg {
font-size: 36pt
}
.gajim-emoji-msg {
font-size: 24pt
}
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
import logging import logging
import emoji
from gi.repository import Gdk from gi.repository import Gdk
from gi.repository import GLib from gi.repository import GLib
from gi.repository import Gtk from gi.repository import Gtk
...@@ -104,6 +105,15 @@ def print_text_with_styling(self, block: PlainBlock) -> None: ...@@ -104,6 +105,15 @@ def print_text_with_styling(self, block: PlainBlock) -> None:
self.set_attributes(make_pango_attributes(block)) 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: def add_action_phrase(self, text: str, nickname: str) -> None:
text = text.replace('/me', f'* {nickname}', 1) text = text.replace('/me', f'* {nickname}', 1)
uris = process_uris(text) uris = process_uris(text)
......
...@@ -27,6 +27,7 @@ classifiers = [ ...@@ -27,6 +27,7 @@ classifiers = [
dependencies = [ dependencies = [
"cryptography>=3.4.8", "cryptography>=3.4.8",
"css-parser", "css-parser",
"emoji>=2.6.0",
"keyring", "keyring",
"nbxmpp>=4.5.3,<5.0.0", "nbxmpp>=4.5.3,<5.0.0",
"omemo-dr>=1.0.0,<2.0.0", "omemo-dr>=1.0.0,<2.0.0",
...@@ -183,7 +184,7 @@ select = [ ...@@ -183,7 +184,7 @@ select = [
# "DJ", # flake8-django # "DJ", # flake8-django
# "DTZ", # flake8-datetimez # "DTZ", # flake8-datetimez
"E", # Error "E", # Error
# "EM", # flake8-errmsg # "EM", # flake8-errmsg
# "ERA", # eradicate # "ERA", # eradicate
"EXE", # flake8-executable "EXE", # flake8-executable
"F", # Pyflakes "F", # Pyflakes
......
...@@ -108,6 +108,7 @@ python-gnupg ...@@ -108,6 +108,7 @@ python-gnupg
qrcode qrcode
css_parser css_parser
sentry-sdk sentry-sdk
emoji
" "
build_pip install precis-i18n build_pip install precis-i18n
......
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