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


Commits:
23f9107c by Philipp Hörist at 2024-05-24T16:29:03+02:00
refactor: QuickReactions: Add dedicated widget

- - - - -
a7007c8f by Philipp Hörist at 2024-05-24T16:30:16+02:00
other: Windows: Update dependencies

- - - - -


2 changed files:

- gajim/gtk/conversation/rows/widgets.py
- pyproject.toml


Changes:

=====================================
gajim/gtk/conversation/rows/widgets.py
=====================================
@@ -62,12 +62,8 @@ def __init__(self) -> None:
         self._reaction_buttons: list[Gtk.Button] = []
 
         for emoji in ['👍', '❤', '🤣']:
-            button = Gtk.Button(
-                label=emoji, tooltip_text=_('React with %s') % emoji, 
no_show_all=True
-            )
-            button.connect('clicked', 
self._on_specific_reaction_button_clicked)
-            button.get_style_context().remove_class('text-button')
-            button.get_style_context().add_class('image-button')
+            button = QuickReactionButton(emoji)
+            button.connect('clicked', self._on_quick_reaction_button_clicked)
             self._reaction_buttons.append(button)
 
         choose_reaction_button = AddReactionButton()
@@ -213,8 +209,8 @@ def _on_reply_clicked(self, _button: Gtk.Button) -> None:
         assert self._message_row is not None
         app.window.activate_action('reply', GLib.Variant('u', 
self._message_row.pk))
 
-    def _on_specific_reaction_button_clicked(self, button: Gtk.Button) -> None:
-        self._send_reaction(button.get_label())
+    def _on_quick_reaction_button_clicked(self, button: QuickReactionButton) 
-> None:
+        self._send_reaction(button.emoji)
 
     def _on_choose_reaction_button_clicked(self, _button: AddReactionButton) 
-> None:
         self._menu_button_clicked = True
@@ -233,6 +229,26 @@ def _on_more_clicked(self, button: Gtk.Button) -> None:
         self._message_row.show_chat_row_menu(self, button)
 
 
+class QuickReactionButton(Gtk.Button):
+    def __init__(self, emoji: str) -> None:
+
+        self.emoji = emoji
+
+        # Add emoji presentation selector, otherwise depending on the font
+        # emojis might be displayed in its text variant
+        emoji_presentation_form = f'{emoji}\uFE0F'
+
+        Gtk.Button.__init__(
+            self,
+            label=emoji_presentation_form,
+            tooltip_text=_('React with %s') % emoji_presentation_form,
+            no_show_all=True
+        )
+
+        self.get_style_context().remove_class('text-button')
+        self.get_style_context().add_class('image-button')
+
+
 class DateTimeLabel(Gtk.Label):
     def __init__(self, timestamp: datetime) -> None:
         Gtk.Label.__init__(self)


=====================================
pyproject.toml
=====================================
@@ -38,6 +38,7 @@ dependencies = [
   "PyGObject>=3.42.0",
   "qrcode>=7.3.1",
   "SQLAlchemy>=2.0.0",
+  "winrt-Windows.Foundation; platform_system == 'Windows'",
   "winrt-Windows.UI; platform_system == 'Windows'",
   "winrt-Windows.UI.ViewManagement; platform_system == 'Windows'",
 ]



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/734c9871d74a96597e7ca8ac56dc54f816e00589...a7007c8f2f6ed46fd344aa8215891f6a080ac769

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/734c9871d74a96597e7ca8ac56dc54f816e00589...a7007c8f2f6ed46fd344aa8215891f6a080ac769
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