Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.9, 0.9.1, and 0.9.1.1

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.

Changeset 65921b53b7ed

Parent f62bc272bec9

by Simon Heimberg

Changes to 4 files · Browse files at 65921b53b7ed Showing diff from parent f62bc272bec9 Diff from another changeset...

Change 1 of 1 Show Entire File hggtk/​commit.py Stacked
 
292
293
294
295
 
296
297
298
 
292
293
294
 
295
296
297
298
@@ -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)
Change 1 of 2 Show Entire File hggtk/​gtklib.py Stacked
 
319
320
321
322
 
 
 
 
323
324
325
 
326
327
328
 
364
365
366
 
 
 
 
 
 
 
 
 
319
320
321
 
322
323
324
325
326
327
 
328
329
330
331
 
367
368
369
370
371
372
373
374
375
376
377
@@ -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: @@ -364,3 +367,11 @@
  menu.append(item)   item.show()   textview.connect('populate-popup', langmenu) + +def hasspellcheck(): + try: + import gtkspell + gtkspell.Spell + return True + except ImportError: + return False
Change 1 of 2 Show Entire File hggtk/​hgemail.py Stacked
 
178
179
180
181
182
183
184
 
231
232
233
 
234
235
236
 
178
179
180
 
181
182
183
 
230
231
232
233
234
235
236
@@ -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')
 
557
558
559
 
 
 
 
 
 
 
 
 
560
561
562
 
563
564
565
 
557
558
559
560
561
562
563
564
565
566
567
568
569
570
 
571
572
573
574
@@ -557,9 +557,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)