def setLang(self, textView): if self.lang == '': self.lang = None try: gtkspell.get_from_text_view(textView).set_language(self.lang) except Exception, e: print str(e) self.error(_('Error applying Spell to input (%s)') % e, False) return False
def setLang(self, textView): if self.lang == "": self.lang = None try: gtkspell.get_from_text_view(textView).set_language(self.lang) except Exception, e: print str(e) self.error(_("Error applying Spell to input (%s)") % e, False) return False
def _readonly_set(self, value): super(TextBox, self)._readonly_set(value) self.textview.set_editable(not value) if self.button: self.button.set_sensitive(not value) if value: self.widget.set_focus_chain([]) else: self.widget.set_focus_chain([self.textview]) if gtkspell: spell = None try: spell = gtkspell.get_from_text_view(self.textview) except Exception: pass if not value and self.attrs.get('spell') \ and CONFIG['client.spellcheck'] \ and self.record: language = self.record.expr_eval(self.attrs['spell']) try: if not spell: spell = gtkspell.Spell(self.textview) if self.lang != language: try: spell.set_language(language) except Exception: spell.detach() del spell self.lang = language except Exception: pass elif spell: spell.detach() del spell
def display(self, record, field): super(TextBox, self).display(record, field) value = field and field.get(record) if not value: value = '' buf = self.textview.get_buffer() buf.delete(buf.get_start_iter(), buf.get_end_iter()) iter_start = buf.get_start_iter() buf.insert(iter_start, value) if gtkspell: spell = None try: spell = gtkspell.get_from_text_view(self.textview) except Exception: pass if self.attrs.get('spell') and CONFIG['client.spellcheck'] \ and self.record: language = self.record.expr_eval(self.attrs['spell']) try: if not spell: spell = gtkspell.Spell(self.textview) if self.lang != language: try: spell.set_language(language) except Exception: spell.detach() del spell self.lang = language except Exception: pass elif spell: spell.detach() del spell
def _readonly_set(self, value): super(TextBox, self)._readonly_set(value) self.textview.set_editable(not value) if self.button: self.button.set_sensitive(not value) if value and CONFIG['client.fast_tabbing']: self.widget.set_focus_chain([]) else: self.widget.unset_focus_chain() if gtkspell: spell = None try: spell = gtkspell.get_from_text_view(self.textview) except Exception: pass if not value and self.attrs.get('spell') \ and CONFIG['client.spellcheck'] \ and self.record: language = self.record.expr_eval(self.attrs['spell']) try: if not spell: spell = gtkspell.Spell(self.textview) if self.lang != language: try: spell.set_language(language) except Exception: spell.detach() del spell self.lang = language except Exception: pass elif spell: spell.detach() del spell
def display(self, record, field): super(TextBox, self).display(record, field) value = field and field.get(record) if not value: value = '' self.set_buffer(value) if gtkspell: spell = None try: spell = gtkspell.get_from_text_view(self.textview) except Exception: pass if self.attrs.get('spell') and CONFIG['client.spellcheck'] \ and self.record: language = self.record.expr_eval(self.attrs['spell']) try: if not spell: spell = gtkspell.Spell(self.textview) if self.lang != language: try: spell.set_language(language) except Exception: spell.detach() del spell self.lang = language except Exception: pass elif spell: spell.detach() del spell
def toggle(widget, data=None): global spell_toggle, text if spell_toggle: spell_toggle = 0 spell = gtkspell.get_from_text_view (text) spell.detach() else: spell_toggle = 1 spell = gtkspell.Spell (text)
def _set_spellcheck_(self, textview): if 'spellcheck' in configuration.options: # Deactivate previous spell try: spell = gtkspell.get_from_text_view(textview) except: pass else: spell.detach() # Activate new spell if necessary activate_spellcheck = configuration.options["spellcheck"] if activate_spellcheck == "True": spell = gtkspell.Spell(textview) # [TODO] # Priority: medium/high # Each project should have their own language settings. if 'language' in configuration.options: language = configuration.options["language"] if language: spell.set_language(language)
def __real_set_active_spellcheck(self, spellcheck_code): """Set active spellcheck by its code.""" if self._active_spellcheck == 'off': if spellcheck_code == 'off': return else: try: with self.textview.undo_disabled(): gtkspell_spell = gtkspell.Spell(self.textview) self._active_spellcheck = spellcheck_code except: # attaching the spellchecker will fail if # the language does not exist # and presumably if there is no dictionary pass else: if spellcheck_code == 'on': return else: gtkspell_spell = gtkspell.get_from_text_view(self.textview) gtkspell_spell.detach() self._active_spellcheck = spellcheck_code
def selectlang(senderitem): from tortoisehg.hgtk import dialog spell = gtkspell.get_from_text_view(textview) lang = '' while True: msg = _('Select language for spell checking.\n\n' 'Empty is for the default language.\n' 'When all text is highlited, the dictionary\n' 'is probably not installed.\n\n' 'examples: en, en_GB, en_US') if lang: msg = _('Lang "%s" can not be set.\n') % lang + msg lang = dialog.entry_dialog(None, msg) if lang is None: # cancel return lang = lang.strip() if not lang: lang = None # set default language from $LANG try: spell.set_language(lang) return except Exception, e: pass
def closeConversationWindow(self, conversationManager, conversation, win): textView = conversation.ui.input.input #inputwidget.textview try: gtkspell.get_from_text_view(textView).detach() except: pass
def removeSpell(self, textView): try: gtkspell.get_from_text_view(textView).detach() except (SystemError, Exception): print "Can't detach gtkspell. Ignoring." return
def closeConversationWindow(self, conversationManager, conversation, win): textView = conversation.ui.input.input # inputwidget.textview try: gtkspell.get_from_text_view(textView).detach() except: pass
def _detach_gtkspell(self): try: spell = gtkspell.get_from_text_view(self.blogEntry) spell.detach() except: use_gtkspell = 0