diff --git a/uberwriter/main_window.py b/uberwriter/main_window.py index 11bfc96..1d2884d 100644 --- a/uberwriter/main_window.py +++ b/uberwriter/main_window.py @@ -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 diff --git a/uberwriter/text_view.py b/uberwriter/text_view.py index 51ad6af..ea16989 100644 --- a/uberwriter/text_view.py +++ b/uberwriter/text_view.py @@ -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