# HG changeset patch
# User Simon Heimberg <[email protected]>
# Date 1250506284 -7200
# Node ID 700915ee13c0f7713bc2978f971e7b117d5d214a
# Parent ed176dd517f711c444ef907af765de866523f5c5
gtklib: default spell check language is configurable
The default language is read from tortoisehg.spellcheck. If none is found, the
default language (from $LANG) is used. The configuration dialog shows the entry
for setting the language only if spell check is possible.
diff -r ed176dd517f7 -r 700915ee13c0 hggtk/commit.py
--- a/hggtk/commit.py Mon Aug 17 12:51:24 2009 +0200
+++ b/hggtk/commit.py Mon Aug 17 12:51:24 2009 +0200
@@ -292,7 +292,7 @@
self.text.connect('populate-popup', self.msg_add_to_popup)
self.text.modify_font(pango.FontDescription(self.fontcomment))
scroller.add(self.text)
- gtklib.addspellcheck(self.text)
+ gtklib.addspellcheck(self.text, self.repo.ui)
self.vpaned = gtk.VPaned()
self.vpaned.add1(vbox)
diff -r ed176dd517f7 -r 700915ee13c0 hggtk/gtklib.py
--- a/hggtk/gtklib.py Mon Aug 17 12:51:24 2009 +0200
+++ b/hggtk/gtklib.py Mon Aug 17 12:51:24 2009 +0200
@@ -319,10 +319,13 @@
return fname
return None
-def addspellcheck(textview):
+def addspellcheck(textview, ui=None):
+ lang = None
+ if ui:
+ lang = ui.config('tortoisehg', 'spellcheck', None)
try:
import gtkspell
- gtkspell.Spell(textview)
+ gtkspell.Spell(textview, lang)
except ImportError:
pass
else:
@@ -366,3 +369,11 @@
menu.append(item)
item.show()
textview.connect('populate-popup', langmenu)
+
+def hasspellcheck():
+ try:
+ import gtkspell
+ gtkspell.Spell
+ return True
+ except ImportError:
+ return False
diff -r ed176dd517f7 -r 700915ee13c0 hggtk/hgemail.py
--- a/hggtk/hgemail.py Mon Aug 17 12:51:24 2009 +0200
+++ b/hggtk/hgemail.py Mon Aug 17 12:51:24 2009 +0200
@@ -178,7 +178,6 @@
self.descview.set_editable(True)
self.descview.modify_font(pango.FontDescription('Monospace'))
self.descbuffer = self.descview.get_buffer()
- gtklib.addspellcheck(self.descview)
scrolledwindow = gtk.ScrolledWindow()
scrolledwindow.set_shadow_type(gtk.SHADOW_ETCHED_IN)
scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
@@ -231,6 +230,7 @@
' the effects of the entire patch series. When emailing'
' a bundle, these fields make up the message subject and
body.')
)
+ gtklib.addspellcheck(self.descview, self.repo.ui)
fill_history(history, self._tolist, 'email.to')
fill_history(history, self._cclist, 'email.cc')
fill_history(history, self._fromlist, 'email.from')
diff -r ed176dd517f7 -r 700915ee13c0 hggtk/thgconfig.py
--- a/hggtk/thgconfig.py Mon Aug 17 12:51:24 2009 +0200
+++ b/hggtk/thgconfig.py Mon Aug 17 12:51:24 2009 +0200
@@ -555,9 +555,18 @@
self.tooltips = gtk.Tooltips()
self.history = settings.Settings('thgconfig')
+ # add spell ckeck entry if spell check is supported
+ tortoise_info = _tortoise_info
+ if gtklib.hasspellcheck():
+ tortoise_info += ((
+ _('Spell Check Language'), 'tortoisehg.spellcheck', [],
+ _('Default language for spell check. '
+ 'System language is used if not specified. '
+ 'Examples: en, en_GB, en_US')),)
+
# create pages for each section of configuration file
self.tortoise_frame = self.add_page(notebook, 'TortoiseHG')
- self.fill_frame(self.tortoise_frame, _tortoise_info)
+ self.fill_frame(self.tortoise_frame, tortoise_info)
self.commit_frame = self.add_page(notebook, _('Commit'))
self.fill_frame(self.commit_frame, _commit_info)
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Tortoisehg-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop