[Paweł M. Zaskórski]use gtkspell to single message winow too; stop doing if 'gtkspell' in globals() and use global var (faster)

This commit is contained in:
Nikos Kouremenos 2005-11-30 22:22:22 +00:00
parent fa1e4fe430
commit db23b53b95
3 changed files with 21 additions and 6 deletions

View File

@ -34,8 +34,9 @@ import message_textview
try:
import gtkspell
HAS_GTK_SPELL = True
except:
pass
HAS_GTK_SPELL = False
from common import gajim
from common import helpers
@ -716,7 +717,7 @@ class Chat:
gajim.last_message_time[self.account][jid] = 0
font = pango.FontDescription(gajim.config.get('conversation_font'))
if gajim.config.get('use_speller') and 'gtkspell' in globals():
if gajim.config.get('use_speller') and HAS_GTK_SPELL:
try:
gtkspell.Spell(msg_textview)
except gobject.GError, msg:
@ -765,8 +766,7 @@ class Chat:
self.notebook.append_page(child, tab_hbox)
msg_textview.modify_font(font)
msg_textview.connect('size-request', self.size_request,
self.xmls[jid])
msg_textview.connect('size-request', self.size_request, self.xmls[jid])
# init new sent history for this conversation
self.sent_history[jid] = []
self.sent_history_pos[jid] = 0

View File

@ -32,8 +32,9 @@ import cell_renderer_image
try:
import gtkspell
HAS_GTK_SPELL = True
except:
pass
HAS_GTK_SPELL = False
from gajim import Contact
from common import helpers
@ -173,7 +174,7 @@ class PreferencesWindow:
if os.name == 'nt':
self.xml.get_widget('speller_checkbutton').set_no_show_all(True)
else:
if 'gtkspell' in globals():
if HAS_GTK_SPELL:
st = gajim.config.get('use_speller')
self.xml.get_widget('speller_checkbutton').set_active(st)
else:

View File

@ -26,6 +26,12 @@ import os
import gtkgui_helpers
import vcard
try:
import gtkspell
HAS_GTK_SPELL = True
except:
HAS_GTK_SPELL = False
from filetransfers_window import FileTransfersWindow
from gajim_themes_window import GajimThemesWindow
from advanced import AdvancedConfigurationWindow
@ -975,6 +981,14 @@ class SingleMessageWindow:
self.to_entry.set_text(to)
if gajim.config.get('use_speller') and HAS_GTK_SPELL:
try:
gtkspell.Spell(self.message_textview)
except gobject.GError, msg:
#FIXME: add a ui for this use spell.set_language()
dialogs.ErrorDialog(unicode(msg), _('If that is not your language for which you want to highlight misspelled words, then please set your $LANG as appropriate. Eg. for French do export LANG=fr_FR or export LANG=fr_FR.UTF-8 in ~/.bash_profile or to make it global in /etc/profile.\n\nHighlighting misspelled words feature will not be used')).get_response()
gajim.config.set('use_speller', False)
self.send_button.set_no_show_all(True)
self.reply_button.set_no_show_all(True)
self.send_and_close_button.set_no_show_all(True)