Philipp Hörist pushed to branch master at gajim / gajim
Commits: d4b25c23 by Daniel Brötzmann at 2020-08-25T20:49:28+02:00 Use GTK emoji chooser on Linux
- - - - -
3 changed files:
- gajim/chat_control_base.py - gajim/gtk/emoji_chooser.py - gajim/gui_interface.py
Changes:
===================================== gajim/chat_control_base.py ===================================== @@ -24,6 +24,7 @@ # along with Gajim. If not, see http://www.gnu.org/licenses/.
import os +import sys import time import uuid import tempfile @@ -504,7 +505,10 @@ class ChatControlBase(ChatCommandProcessor, CommandTools, EventHelper): return Gdk.EVENT_STOP
if action == 'show-emoji-chooser': - self.xml.emoticons_button.get_popover().show() + if sys.platform in ('win32', 'darwin'): + self.xml.emoticons_button.get_popover().show() + return Gdk.EVENT_STOP + self.msg_textview.emit('insert-emoji') return Gdk.EVENT_STOP
if action == 'copy-text': @@ -1207,8 +1211,20 @@ class ChatControlBase(ChatCommandProcessor, CommandTools, EventHelper): if not self.parent_win: return
- emoji_chooser.text_widget = self.msg_textview - self.xml.emoticons_button.set_popover(emoji_chooser) + if sys.platform in ('win32', 'darwin'): + emoji_chooser.text_widget = self.msg_textview + self.xml.emoticons_button.set_popover(emoji_chooser) + return + + self.xml.emoticons_button.set_sensitive(True) + self.xml.emoticons_button.connect('clicked', + self._on_emoticon_button_clicked) + + def _on_emoticon_button_clicked(self, _widget): + self.msg_textview.remove_placeholder() + # Present GTK emoji chooser (not cross platform compatible) + self.msg_textview.emit('insert-emoji') + self.xml.emoticons_button.set_property('active', False)
def on_color_menuitem_activate(self, _widget): color_dialog = Gtk.ColorChooserDialog(None, self.parent_win.window)
===================================== gajim/gtk/emoji_chooser.py ===================================== @@ -12,7 +12,6 @@ # You should have received a copy of the GNU General Public License # along with Gajim. If not, see http://www.gnu.org/licenses/.
-import sys import logging import weakref from pathlib import Path @@ -304,13 +303,8 @@ class EmojiChooser(Gtk.Popover): theme = app.settings.get('emoticons_theme') themes = helpers.get_available_emoticon_themes() if theme not in themes: - if sys.platform not in ('win32', 'darwin'): - app.settings.set('emoticons_theme', 'font') - theme = 'font' - else: - # Win/Mac fallback to noto - app.settings.set('emoticons_theme', 'noto') - theme = 'noto' + app.settings.set('emoticons_theme', 'noto') + theme = 'noto' return theme
@staticmethod
===================================== gajim/gui_interface.py ===================================== @@ -2088,9 +2088,10 @@ class Interface: from gajim.gtk import statusicon self.systray = statusicon.StatusIcon()
- # Init emoji_chooser - from gajim.gtk.emoji_chooser import emoji_chooser - emoji_chooser.load() + if sys.platform in ('win32', 'darwin'): + from gajim.gtk.emoji_chooser import emoji_chooser + emoji_chooser.load() + self.make_regexps()
# get transports type from DB
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/d4b25c230f6b6c3b0146b5415708ae083...