Commit 133cf329 authored by José Aliste's avatar José Aliste

Run windowactivatable.adjust and latex.editor.parse on an idle.

Both functions currently are very slow and block ui, so we now
call them on an idle to avoid the ui blocking.
parent 78abbd2b
......@@ -27,7 +27,7 @@ extension point.
import logging
from gi.repository import Gedit, Gtk, Gio
from gi.repository import Gedit, Gtk, Gio, GObject
from config import EDITORS
from .file import File
......@@ -112,7 +112,7 @@ class GeditTabDecorator(object):
LOG.debug("no file loaded")
if self._window_decorator.window.get_active_view() == self._text_view:
self._window_decorator.adjust(self)
GObject.idle_add(self._window_decorator.adjust, self)
else:
file = File(location.get_uri())
......@@ -170,7 +170,7 @@ class GeditTabDecorator(object):
# tell WindowDecorator to adjust actions
# but only if this tab is the active tab
if self._window_decorator.window.get_active_view() == self._text_view:
self._window_decorator.adjust(self)
GObject.idle_add(self._window_decorator.adjust,self)
# notify that URI has changed
return True
......
......@@ -311,7 +311,7 @@ class LaTeXWindowActivatable(GObject.Object, Gedit.WindowActivatable, PeasGtk.Co
self._init_tool_actions()
# re-adjust action states
self.adjust(self._active_tab_decorator)
GObject.idle_add(self.adjust,self._active_tab_decorator)
def activate_tab(self, file):
"""
......@@ -365,7 +365,6 @@ class LaTeXWindowActivatable(GObject.Object, Gedit.WindowActivatable, PeasGtk.Co
"""
# TODO: improve and simplify this!
extension = tab_decorator.extension
LOG.debug("---------- ADJUST: %s" % (extension))
......@@ -523,7 +522,7 @@ class LaTeXWindowActivatable(GObject.Object, Gedit.WindowActivatable, PeasGtk.Co
self._active_tab_decorator = decorator
# adjust actions and views
self.adjust(decorator)
GObject.idle_add(self.adjust,decorator)
def _create_tab_decorator(self, tab, init=False):
"""
......
......@@ -27,7 +27,7 @@ BENCHMARK = True
import logging
if BENCHMARK: import time
from gi.repository import Gtk
from gi.repository import Gtk, GObject
from gi.repository import Gdk
from ..base.editor import Editor
......@@ -93,7 +93,7 @@ class LaTeXEditor(Editor, IIssueHandler):
#
self._change_reference = self.initial_timestamp
self.__parse()
GObject.idle_add(self.__parse)
self.__update_neighbors()
def _on_preferences_changed(self, prefs, key, new_value):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment