Philipp Hörist pushed to branch master at gajim / gajim
Commits:
-
7692b376
by Philipp Hörist at 2017-11-26T00:44:50+01:00
-
92917c18
by Philipp Hörist at 2017-11-26T00:54:17+01:00
10 changed files:
- README.md
- gajim/chat_control.py
- gajim/chat_control_base.py
- gajim/common/app.py
- gajim/config.py
- gajim/dialogs.py
- gajim/features_window.py
- − gajim/gtkspell.py
- gajim/message_textview.py
- win/_base.sh
Changes:
| ... | ... | @@ -18,7 +18,7 @@ |
| 18 | 18 |
- python3-crypto to enable End to end encryption
|
| 19 | 19 |
- python3-gnupg to enable GPG encryption
|
| 20 | 20 |
- For zeroconf (bonjour) you need dbus-glib, python-avahi
|
| 21 |
-- gir1.2-gtkspell3-3.0 and aspell-LANG where lang is your locale eg. en, fr etc
|
|
| 21 |
+- gir1.2-gspell-1 and hunspell-LANG where lang is your locale eg. en, fr etc
|
|
| 22 | 22 |
- gir1.2-secret-1 for GNOME Keyring or KDE support as password storage
|
| 23 | 23 |
- D-Bus running to have gajim-remote working. Some distributions split dbus-x11, which is needed for dbus to work with Gajim. Version >= 0.80 is required.
|
| 24 | 24 |
- python3-dbus bindings (>=1.2.0)
|
| ... | ... | @@ -1173,7 +1173,6 @@ class ChatControl(ChatControlBase): |
| 1173 | 1173 |
self.handlers[i].disconnect(i)
|
| 1174 | 1174 |
del self.handlers[i]
|
| 1175 | 1175 |
self.conv_textview.del_handlers()
|
| 1176 |
- self.remove_speller()
|
|
| 1177 | 1176 |
self.msg_textview.destroy()
|
| 1178 | 1177 |
# PluginSystem: calling shutdown of super class (ChatControlBase) to let
|
| 1179 | 1178 |
# it remove it's GUI extension points
|
| ... | ... | @@ -32,7 +32,6 @@ import time |
| 32 | 32 |
from gi.repository import Gtk
|
| 33 | 33 |
from gi.repository import Gdk
|
| 34 | 34 |
from gi.repository import Pango
|
| 35 |
-from gi.repository import GObject
|
|
| 36 | 35 |
from gi.repository import GLib
|
| 37 | 36 |
from gi.repository import Gio
|
| 38 | 37 |
|
| ... | ... | @@ -42,7 +41,6 @@ from gajim import message_control |
| 42 | 41 |
from gajim import dialogs
|
| 43 | 42 |
from gajim import history_window
|
| 44 | 43 |
from gajim import notify
|
| 45 |
-from gajim import gtkspell
|
|
| 46 | 44 |
import re
|
| 47 | 45 |
|
| 48 | 46 |
from gajim import emoticons
|
| ... | ... | @@ -66,6 +64,9 @@ from gajim.command_system.implementation.middleware import CommandTools |
| 66 | 64 |
from gajim.command_system.implementation import standard
|
| 67 | 65 |
from gajim.command_system.implementation import execute
|
| 68 | 66 |
|
| 67 |
+if app.HAVE_SPELL:
|
|
| 68 |
+ from gi.repository import Gspell
|
|
| 69 |
+ |
|
| 69 | 70 |
|
| 70 | 71 |
################################################################################
|
| 71 | 72 |
class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
| ... | ... | @@ -345,8 +346,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools): |
| 345 | 346 |
self.set_emoticon_popover()
|
| 346 | 347 |
|
| 347 | 348 |
# Attach speller
|
| 348 |
- self.spell = None
|
|
| 349 |
- self.spell_handlers = []
|
|
| 349 |
+ self.spell_checker = None
|
|
| 350 | 350 |
self.set_speller()
|
| 351 | 351 |
self.conv_textview.tv.show()
|
| 352 | 352 |
|
| ... | ... | @@ -471,44 +471,22 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools): |
| 471 | 471 |
image.set_from_pixbuf(icon)
|
| 472 | 472 |
|
| 473 | 473 |
def set_speller(self):
|
| 474 |
- if not gtkspell.HAS_GTK_SPELL or not app.config.get('use_speller'):
|
|
| 474 |
+ if not app.HAVE_SPELL or not app.config.get('use_speller'):
|
|
| 475 | 475 |
return
|
| 476 | 476 |
|
| 477 |
- def _on_focus_in(*args):
|
|
| 478 |
- if self.spell is None:
|
|
| 479 |
- return
|
|
| 480 |
- self.spell.attach(self.msg_textview)
|
|
| 477 |
+ gspell_lang = self.get_speller_language()
|
|
| 478 |
+ if gspell_lang is None:
|
|
| 479 |
+ return
|
|
| 481 | 480 |
|
| 482 |
- def _on_focus_out(*args):
|
|
| 483 |
- if self.spell is None:
|
|
| 484 |
- return
|
|
| 485 |
- if not self.msg_textview.has_text():
|
|
| 486 |
- self.spell.detach()
|
|
| 481 |
+ self.spell_checker = Gspell.Checker.new(gspell_lang)
|
|
| 482 |
+ spell_buffer = Gspell.TextBuffer.get_from_gtk_text_buffer(
|
|
| 483 |
+ self.msg_textview.get_buffer())
|
|
| 484 |
+ spell_buffer.set_spell_checker(self.spell_checker)
|
|
| 485 |
+ spell_view = Gspell.TextView.get_from_gtk_text_view(self.msg_textview)
|
|
| 486 |
+ spell_view.set_inline_spell_checking(False)
|
|
| 487 |
+ spell_view.set_enable_language_menu(True)
|
|
| 487 | 488 |
|
| 488 |
- lang = self.get_speller_language()
|
|
| 489 |
- if not lang:
|
|
| 490 |
- return
|
|
| 491 |
- try:
|
|
| 492 |
- self.spell = gtkspell.Spell(self.msg_textview, lang)
|
|
| 493 |
- self.spell.connect('language_changed', self.on_language_changed)
|
|
| 494 |
- handler_id = self.msg_textview.connect('focus-in-event',
|
|
| 495 |
- _on_focus_in)
|
|
| 496 |
- self.spell_handlers.append(handler_id)
|
|
| 497 |
- handler_id = self.msg_textview.connect('focus-out-event',
|
|
| 498 |
- _on_focus_out)
|
|
| 499 |
- self.spell_handlers.append(handler_id)
|
|
| 500 |
- except OSError:
|
|
| 501 |
- dialogs.AspellDictError(lang)
|
|
| 502 |
- app.config.set('use_speller', False)
|
|
| 503 |
- |
|
| 504 |
- def remove_speller(self):
|
|
| 505 |
- if self.spell is None:
|
|
| 506 |
- return
|
|
| 507 |
- self.spell.detach()
|
|
| 508 |
- for id_ in self.spell_handlers:
|
|
| 509 |
- self.msg_textview.disconnect(id_)
|
|
| 510 |
- self.spell_handlers.remove(id_)
|
|
| 511 |
- self.spell = None
|
|
| 489 |
+ self.spell_checker.connect('notify::language', self.on_language_changed)
|
|
| 512 | 490 |
|
| 513 | 491 |
def get_speller_language(self):
|
| 514 | 492 |
per_type = 'contacts'
|
| ... | ... | @@ -521,16 +499,20 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools): |
| 521 | 499 |
lang = app.config.get('speller_language')
|
| 522 | 500 |
if not lang:
|
| 523 | 501 |
lang = app.LANG
|
| 524 |
- return lang or None
|
|
| 502 |
+ gspell_lang = Gspell.language_lookup(lang)
|
|
| 503 |
+ if gspell_lang is None:
|
|
| 504 |
+ gspell_lang = Gspell.language_get_default()
|
|
| 505 |
+ return gspell_lang
|
|
| 525 | 506 |
|
| 526 |
- def on_language_changed(self, spell, lang):
|
|
| 507 |
+ def on_language_changed(self, checker, param):
|
|
| 508 |
+ gspell_lang = checker.get_language()
|
|
| 527 | 509 |
per_type = 'contacts'
|
| 528 | 510 |
if self.type_id == message_control.TYPE_GC:
|
| 529 | 511 |
per_type = 'rooms'
|
| 530 | 512 |
if not app.config.get_per(per_type, self.contact.jid):
|
| 531 | 513 |
app.config.add_per(per_type, self.contact.jid)
|
| 532 |
- app.config.set_per(
|
|
| 533 |
- per_type, self.contact.jid, 'speller_language', lang)
|
|
| 514 |
+ app.config.set_per(per_type, self.contact.jid,
|
|
| 515 |
+ 'speller_language', gspell_lang.get_code())
|
|
| 534 | 516 |
|
| 535 | 517 |
def on_banner_label_populate_popup(self, label, menu):
|
| 536 | 518 |
"""
|
| ... | ... | @@ -253,6 +253,21 @@ except Exception: |
| 253 | 253 |
glog.info(_('Unable to load idle module'))
|
| 254 | 254 |
HAVE_IDLE = False
|
| 255 | 255 |
|
| 256 |
+HAVE_SPELL = False
|
|
| 257 |
+try:
|
|
| 258 |
+ spell_log = logging.getLogger('gajim.speller')
|
|
| 259 |
+ gi.require_version('Gspell', '1')
|
|
| 260 |
+ from gi.repository import Gspell
|
|
| 261 |
+ langs = Gspell.language_get_available()
|
|
| 262 |
+ for lang in langs:
|
|
| 263 |
+ spell_log.info('%s (%s) dict available',
|
|
| 264 |
+ lang.get_name(), lang.get_code())
|
|
| 265 |
+ if langs:
|
|
| 266 |
+ HAVE_SPELL = True
|
|
| 267 |
+ else:
|
|
| 268 |
+ spell_log.info('No dicts available')
|
|
| 269 |
+except ImportError:
|
|
| 270 |
+ pass
|
|
| 256 | 271 |
|
| 257 | 272 |
gajim_identity = {'type': 'pc', 'category': 'client', 'name': 'Gajim'}
|
| 258 | 273 |
gajim_common_features = [nbxmpp.NS_BYTESTREAM, nbxmpp.NS_SI, nbxmpp.NS_FILE,
|
| ... | ... | @@ -50,7 +50,6 @@ from gajim import message_control |
| 50 | 50 |
from gajim.chat_control_base import ChatControlBase
|
| 51 | 51 |
from gajim import dataforms_widget
|
| 52 | 52 |
from gajim import gui_menu_builder
|
| 53 |
-from gajim import gtkspell
|
|
| 54 | 53 |
|
| 55 | 54 |
from gajim.common import helpers
|
| 56 | 55 |
from gajim.common import app
|
| ... | ... | @@ -66,6 +65,9 @@ try: |
| 66 | 65 |
except (ImportError, ValueError):
|
| 67 | 66 |
HAS_GST = False
|
| 68 | 67 |
|
| 68 |
+if app.HAVE_SPELL:
|
|
| 69 |
+ from gi.repository import Gspell
|
|
| 70 |
+ |
|
| 69 | 71 |
#---------- PreferencesWindow class -------------#
|
| 70 | 72 |
class PreferencesWindow:
|
| 71 | 73 |
"""
|
| ... | ... | @@ -187,7 +189,7 @@ class PreferencesWindow: |
| 187 | 189 |
self.xml.get_object('xhtml_checkbutton').set_active(st)
|
| 188 | 190 |
|
| 189 | 191 |
# use speller
|
| 190 |
- if gtkspell.HAS_GTK_SPELL:
|
|
| 192 |
+ if app.HAVE_SPELL:
|
|
| 191 | 193 |
st = app.config.get('use_speller')
|
| 192 | 194 |
self.xml.get_object('speller_checkbutton').set_active(st)
|
| 193 | 195 |
else:
|
| ... | ... | @@ -657,30 +659,22 @@ class PreferencesWindow: |
| 657 | 659 |
if isinstance(ctrl, ChatControlBase):
|
| 658 | 660 |
ctrl.set_speller()
|
| 659 | 661 |
|
| 660 |
- def remove_speller(self):
|
|
| 661 |
- for ctrl in self._get_all_controls():
|
|
| 662 |
- if isinstance(ctrl, ChatControlBase):
|
|
| 663 |
- if ctrl.spell is not None:
|
|
| 664 |
- ctrl.remove_speller()
|
|
| 665 |
- |
|
| 666 | 662 |
def on_speller_checkbutton_toggled(self, widget):
|
| 667 | 663 |
active = widget.get_active()
|
| 668 | 664 |
app.config.set('use_speller', active)
|
| 669 |
- if active:
|
|
| 670 |
- lang = app.config.get('speller_language')
|
|
| 671 |
- if not lang:
|
|
| 672 |
- lang = app.LANG
|
|
| 673 |
- |
|
| 674 |
- available = gtkspell.test_language(lang)
|
|
| 675 |
- if not available:
|
|
| 676 |
- dialogs.AspellDictError(lang)
|
|
| 677 |
- app.config.set('use_speller', False)
|
|
| 678 |
- widget.set_active(False)
|
|
| 679 |
- else:
|
|
| 680 |
- app.config.set('speller_language', lang)
|
|
| 681 |
- self.apply_speller()
|
|
| 665 |
+ if not active:
|
|
| 666 |
+ return
|
|
| 667 |
+ lang = app.config.get('speller_language')
|
|
| 668 |
+ gspell_lang = Gspell.language_lookup(lang)
|
|
| 669 |
+ if gspell_lang is None:
|
|
| 670 |
+ gspell_lang = Gspell.language_get_default()
|
|
| 671 |
+ if gspell_lang is None:
|
|
| 672 |
+ dialogs.AspellDictError(lang)
|
|
| 673 |
+ app.config.set('use_speller', False)
|
|
| 674 |
+ widget.set_active(False)
|
|
| 682 | 675 |
else:
|
| 683 |
- self.remove_speller()
|
|
| 676 |
+ app.config.set('speller_language', gspell_lang.get_code())
|
|
| 677 |
+ self.apply_speller()
|
|
| 684 | 678 |
|
| 685 | 679 |
def on_positive_184_ack_checkbutton_toggled(self, widget):
|
| 686 | 680 |
self.on_checkbutton_toggled(widget, 'positive_184_ack')
|
| ... | ... | @@ -34,6 +34,7 @@ from gi.repository import Gdk |
| 34 | 34 |
from gi.repository import GdkPixbuf
|
| 35 | 35 |
from gi.repository import GObject
|
| 36 | 36 |
from gi.repository import GLib
|
| 37 |
+ |
|
| 37 | 38 |
import os
|
| 38 | 39 |
import nbxmpp
|
| 39 | 40 |
import time
|
| ... | ... | @@ -42,7 +43,6 @@ from gajim import gtkgui_helpers |
| 42 | 43 |
from gajim import vcard
|
| 43 | 44 |
from gajim import conversation_textview
|
| 44 | 45 |
from gajim import dataforms_widget
|
| 45 |
-from gajim import gtkspell
|
|
| 46 | 46 |
|
| 47 | 47 |
from random import randrange
|
| 48 | 48 |
from gajim.common import pep
|
| ... | ... | @@ -64,6 +64,9 @@ from gajim.common import dataforms |
| 64 | 64 |
from gajim.common.exceptions import GajimGeneralException
|
| 65 | 65 |
from gajim.common.connection_handlers_events import MessageOutgoingEvent
|
| 66 | 66 |
|
| 67 |
+if app.HAVE_SPELL:
|
|
| 68 |
+ from gi.repository import Gspell
|
|
| 69 |
+ |
|
| 67 | 70 |
import logging
|
| 68 | 71 |
log = logging.getLogger('gajim.dialogs')
|
| 69 | 72 |
|
| ... | ... | @@ -3077,15 +3080,19 @@ class SingleMessageWindow: |
| 3077 | 3080 |
else:
|
| 3078 | 3081 |
self.to_entry.set_text(to)
|
| 3079 | 3082 |
|
| 3080 |
- if app.config.get('use_speller') and gtkspell.HAS_GTK_SPELL and action == 'send':
|
|
| 3081 |
- try:
|
|
| 3082 |
- lang = app.config.get('speller_language')
|
|
| 3083 |
- if not lang:
|
|
| 3084 |
- lang = app.LANG
|
|
| 3085 |
- self.spell = gtkspell.Spell(self.message_textview, lang)
|
|
| 3086 |
- self.spell.attach(self.message_textview)
|
|
| 3087 |
- except OSError:
|
|
| 3083 |
+ if app.config.get('use_speller') and app.HAVE_SPELL and action == 'send':
|
|
| 3084 |
+ lang = app.config.get('speller_language')
|
|
| 3085 |
+ gspell_lang = Gspell.language_lookup(lang)
|
|
| 3086 |
+ if gspell_lang is None:
|
|
| 3088 | 3087 |
AspellDictError(lang)
|
| 3088 |
+ else:
|
|
| 3089 |
+ spell_buffer = Gspell.TextBuffer.get_from_gtk_text_buffer(
|
|
| 3090 |
+ self.message_textview.get_buffer())
|
|
| 3091 |
+ spell_buffer.set_spell_checker(Gspell.Checker.new(gspell_lang))
|
|
| 3092 |
+ spell_view = Gspell.TextView.get_from_gtk_text_view(
|
|
| 3093 |
+ self.message_textview)
|
|
| 3094 |
+ spell_view.set_inline_spell_checking(True)
|
|
| 3095 |
+ spell_view.set_enable_language_menu(True)
|
|
| 3089 | 3096 |
|
| 3090 | 3097 |
self.prepare_widgets_for(self.action)
|
| 3091 | 3098 |
|
| ... | ... | @@ -63,8 +63,8 @@ class FeaturesWindow: |
| 63 | 63 |
_('On Windows the Windows Credential Vault is used.')),
|
| 64 | 64 |
_('Spell Checker'): (self.speller_available,
|
| 65 | 65 |
_('Spellchecking of composed messages.'),
|
| 66 |
- _('Requires libgtkspell.'),
|
|
| 67 |
- _('Requires libgtkspell and libenchant.')),
|
|
| 66 |
+ _('Requires Gspell'),
|
|
| 67 |
+ _('Requires Gspell')),
|
|
| 68 | 68 |
_('Automatic status'): (self.idle_available,
|
| 69 | 69 |
_('Ability to measure idle time, in order to set auto status.'),
|
| 70 | 70 |
_('Requires libxss library.'),
|
| ... | ... | @@ -164,11 +164,7 @@ class FeaturesWindow: |
| 164 | 164 |
return True
|
| 165 | 165 |
|
| 166 | 166 |
def speller_available(self):
|
| 167 |
- try:
|
|
| 168 |
- __import__('gajim.gtkspell')
|
|
| 169 |
- except ValueError:
|
|
| 170 |
- return False
|
|
| 171 |
- return True
|
|
| 167 |
+ return app.HAVE_SPELL
|
|
| 172 | 168 |
|
| 173 | 169 |
def idle_available(self):
|
| 174 | 170 |
from gajim.common import sleepy
|
| 1 |
-## src/gtkspell.py
|
|
| 2 |
-##
|
|
| 3 |
-## (C) 2008 Thorsten P. 'dGhvcnN0ZW5wIEFUIHltYWlsIGNvbQ==\n'.decode("base64")
|
|
| 4 |
-## (C) 2015 Yann Leboulanger <asterix AT lagaule.org>
|
|
| 5 |
-##
|
|
| 6 |
-## This file is part of Gajim.
|
|
| 7 |
-##
|
|
| 8 |
-## Gajim is free software; you can redistribute it and/or modify
|
|
| 9 |
-## it under the terms of the GNU General Public License as published
|
|
| 10 |
-## by the Free Software Foundation; version 3 only.
|
|
| 11 |
-##
|
|
| 12 |
-## Gajim is distributed in the hope that it will be useful,
|
|
| 13 |
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 14 |
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 15 |
-## GNU General Public License for more details.
|
|
| 16 |
-##
|
|
| 17 |
-## You should have received a copy of the GNU General Public License
|
|
| 18 |
-## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
|
| 19 |
- |
|
| 20 |
-from gi.repository import GObject
|
|
| 21 |
-from gi.repository import Gtk
|
|
| 22 |
-from gi.repository import GLib
|
|
| 23 |
-import gi
|
|
| 24 |
-try:
|
|
| 25 |
- gi.require_version('GtkSpell', '3.0')
|
|
| 26 |
- from gi.repository import GtkSpell
|
|
| 27 |
- HAS_GTK_SPELL = True
|
|
| 28 |
-except (ImportError, ValueError):
|
|
| 29 |
- HAS_GTK_SPELL = False
|
|
| 30 |
- |
|
| 31 |
- |
|
| 32 |
-def ensure_attached(func):
|
|
| 33 |
- def f(self, *args, **kwargs):
|
|
| 34 |
- if self.spell:
|
|
| 35 |
- func(self, *args, **kwargs)
|
|
| 36 |
- else:
|
|
| 37 |
- raise RuntimeError("Spell object is already detached")
|
|
| 38 |
- return f
|
|
| 39 |
- |
|
| 40 |
- |
|
| 41 |
-class Spell(GObject.GObject):
|
|
| 42 |
- __gsignals__ = {
|
|
| 43 |
- 'language_changed': (GObject.SignalFlags.RUN_FIRST, None, (str,))
|
|
| 44 |
- }
|
|
| 45 |
- |
|
| 46 |
- def __init__(self, textview, language=None, create=True, jid=None,
|
|
| 47 |
- per_type=None):
|
|
| 48 |
- GObject.GObject.__init__(self)
|
|
| 49 |
- if not isinstance(textview, Gtk.TextView):
|
|
| 50 |
- raise TypeError("Textview must be derived from Gtk.TextView")
|
|
| 51 |
- spell = GtkSpell.Checker.get_from_text_view(textview)
|
|
| 52 |
- if create:
|
|
| 53 |
- if spell:
|
|
| 54 |
- raise RuntimeError("Textview has already a Spell obj attached")
|
|
| 55 |
- self.spell = GtkSpell.Checker.new()
|
|
| 56 |
- |
|
| 57 |
- try:
|
|
| 58 |
- self.spell.set_language(language)
|
|
| 59 |
- except GLib.GError as error:
|
|
| 60 |
- if error.domain == 'gtkspell-error-quark':
|
|
| 61 |
- raise OSError("Unable to set language: '%s'" % language)
|
|
| 62 |
- |
|
| 63 |
- self.spell.connect('language-changed', self.on_language_changed)
|
|
| 64 |
- |
|
| 65 |
- else:
|
|
| 66 |
- if spell:
|
|
| 67 |
- self.spell = spell
|
|
| 68 |
- else:
|
|
| 69 |
- raise RuntimeError("Textview has no Spell object attached")
|
|
| 70 |
- |
|
| 71 |
- def on_language_changed(self, spell, lang):
|
|
| 72 |
- self.emit('language_changed', lang)
|
|
| 73 |
- |
|
| 74 |
- @ensure_attached
|
|
| 75 |
- def set_language(self, language):
|
|
| 76 |
- if not self.spell.set_language(language):
|
|
| 77 |
- raise OSError("Unable to set language: '%s'" % language)
|
|
| 78 |
- |
|
| 79 |
- @ensure_attached
|
|
| 80 |
- def recheck_all(self):
|
|
| 81 |
- self.spell.recheck_all()
|
|
| 82 |
- |
|
| 83 |
- def detach(self):
|
|
| 84 |
- if self.spell is not None:
|
|
| 85 |
- self.spell.detach()
|
|
| 86 |
- |
|
| 87 |
- def attach(self, textview):
|
|
| 88 |
- spell = GtkSpell.Checker.get_from_text_view(textview)
|
|
| 89 |
- if spell is None:
|
|
| 90 |
- print('attached')
|
|
| 91 |
- self.spell.attach(textview)
|
|
| 92 |
- |
|
| 93 |
- |
|
| 94 |
-GObject.type_register(Spell)
|
|
| 95 |
- |
|
| 96 |
- |
|
| 97 |
-def test_language(lang):
|
|
| 98 |
- spell = GtkSpell.Checker.new()
|
|
| 99 |
- try:
|
|
| 100 |
- spell.set_language(lang)
|
|
| 101 |
- except GLib.GError as error:
|
|
| 102 |
- if error.domain == 'gtkspell-error-quark':
|
|
| 103 |
- return False
|
|
| 104 |
- return True
|
| ... | ... | @@ -30,6 +30,10 @@ from gi.repository import Pango |
| 30 | 30 |
from gajim.common import app
|
| 31 | 31 |
from gajim import gtkgui_helpers
|
| 32 | 32 |
|
| 33 |
+if app.HAVE_SPELL:
|
|
| 34 |
+ from gi.repository import Gspell
|
|
| 35 |
+ |
|
| 36 |
+ |
|
| 33 | 37 |
class MessageTextView(Gtk.TextView):
|
| 34 | 38 |
"""
|
| 35 | 39 |
Class for the message textview (where user writes new messages) for
|
| ... | ... | @@ -101,6 +105,7 @@ class MessageTextView(Gtk.TextView): |
| 101 | 105 |
def _on_focus_in(self, *args):
|
| 102 | 106 |
if not self.has_text():
|
| 103 | 107 |
self.get_buffer().set_text('')
|
| 108 |
+ self.toggle_speller(True)
|
|
| 104 | 109 |
|
| 105 | 110 |
def _on_focus_out(self, *args):
|
| 106 | 111 |
buf = self.get_buffer()
|
| ... | ... | @@ -109,6 +114,12 @@ class MessageTextView(Gtk.TextView): |
| 109 | 114 |
if text == '':
|
| 110 | 115 |
buf.insert_with_tags(
|
| 111 | 116 |
start, self.PLACEHOLDER, self.placeholder_tag)
|
| 117 |
+ self.toggle_speller(False)
|
|
| 118 |
+ |
|
| 119 |
+ def toggle_speller(self, activate):
|
|
| 120 |
+ if app.HAVE_SPELL and app.config.get('use_speller'):
|
|
| 121 |
+ spell_view = Gspell.TextView.get_from_gtk_text_view(self)
|
|
| 122 |
+ spell_view.set_inline_spell_checking(activate)
|
|
| 112 | 123 |
|
| 113 | 124 |
def remove_placeholder(self):
|
| 114 | 125 |
self._on_focus_in()
|
| ... | ... | @@ -75,7 +75,9 @@ function install_deps { |
| 75 | 75 |
mingw-w64-"${ARCH}"-adwaita-icon-theme \
|
| 76 | 76 |
mingw-w64-"${ARCH}"-libwebp \
|
| 77 | 77 |
mingw-w64-"${ARCH}"-sqlite3 \
|
| 78 |
- mingw-w64-"${ARCH}"-goocanvas
|
|
| 78 |
+ mingw-w64-"${ARCH}"-goocanvas \
|
|
| 79 |
+ mingw-w64-"${ARCH}"-gspell \
|
|
| 80 |
+ mingw-w64-"${ARCH}"-hunspell
|
|
| 79 | 81 |
|
| 80 | 82 |
build_pip install setuptools_scm
|
| 81 | 83 |
|
| ... | ... | @@ -136,6 +138,10 @@ function install_gajim { |
| 136 | 138 |
mkdir "${PACKAGE_DIR}"/gajim/data/plugins
|
| 137 | 139 |
7z x -o"${PACKAGE_DIR}"/gajim/data/plugins "${BUILD_ROOT}"/plugin_installer.zip
|
| 138 | 140 |
|
| 141 |
+ # Install language dicts
|
|
| 142 |
+ curl -o "${BUILD_ROOT}"/speller_dicts.zip https://gajim.org/downloads/snap/win/build/speller_dicts.zip
|
|
| 143 |
+ 7z x -o"${MINGW_ROOT}"/share "${BUILD_ROOT}"/speller_dicts.zip
|
|
| 144 |
+ |
|
| 139 | 145 |
# Install themes
|
| 140 | 146 |
# rm -Rf "${MINGW_ROOT}"/etc
|
| 141 | 147 |
# rm -Rf "${MINGW_ROOT}"/share/themes
|
| ... | ... | @@ -194,7 +200,6 @@ function cleanup_install { |
| 194 | 200 |
rm -Rf "${MINGW_ROOT}"/share/ffmpeg
|
| 195 | 201 |
rm -Rf "${MINGW_ROOT}"/share/vala
|
| 196 | 202 |
rm -Rf "${MINGW_ROOT}"/share/readline
|
| 197 |
- rm -Rf "${MINGW_ROOT}"/share/xml
|
|
| 198 | 203 |
rm -Rf "${MINGW_ROOT}"/share/bash-completion
|
| 199 | 204 |
rm -Rf "${MINGW_ROOT}"/share/common-lisp
|
| 200 | 205 |
rm -Rf "${MINGW_ROOT}"/share/emacs
|