forked from Mirrors/apostrophe
Improve gspell_view encapsulation inside TextView
parent
c2d0bde9f8
commit
250519f319
|
@ -417,9 +417,7 @@ class MainWindow(StyledWindow):
|
|||
status {gtk bool} -- Desired status of the spellchecking
|
||||
"""
|
||||
|
||||
self.text_view.gspell_view\
|
||||
.set_inline_spell_checking(state.get_boolean()
|
||||
and not self.text_view.focus_mode)
|
||||
self.text_view.set_spellcheck(state.get_boolean())
|
||||
|
||||
def toggle_gradient_overlay(self, state):
|
||||
"""Toggle the gradient overlay
|
||||
|
|
|
@ -65,6 +65,7 @@ class TextView(Gtk.TextView):
|
|||
self.get_buffer().connect('changed', self.on_text_changed)
|
||||
|
||||
# Spell checking
|
||||
self.spellcheck = True
|
||||
self.gspell_view = Gspell.TextView.get_from_gtk_text_view(self)
|
||||
self.gspell_view.basic_setup()
|
||||
|
||||
|
@ -184,10 +185,14 @@ class TextView(Gtk.TextView):
|
|||
and the surrounding text is greyed out."""
|
||||
|
||||
self.focus_mode = focus_mode
|
||||
self.gspell_view.set_inline_spell_checking(not focus_mode)
|
||||
self.update_vertical_margin()
|
||||
self.markup.apply()
|
||||
self.smooth_scroll_to()
|
||||
self.set_spellcheck(self.spellcheck)
|
||||
|
||||
def set_spellcheck(self, spellcheck):
|
||||
self.spellcheck = spellcheck
|
||||
self.gspell_view.set_inline_spell_checking(self.spellcheck and not self.focus_mode)
|
||||
|
||||
def update_horizontal_margin(self):
|
||||
width = self.get_allocation().width
|
||||
|
|
Loading…
Reference in New Issue