[gedit-latex] Run windowactivatable.adjust and latex.editor.parse on an idle.
- From: Jose Aliste <jaliste src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit-latex] Run windowactivatable.adjust and latex.editor.parse on an idle.
- Date: Mon, 26 Sep 2011 00:52:19 +0000 (UTC)
commit 133cf3297f7913673199de4c102c73cc2a466dc5
Author: Josà Aliste <jaliste src gnome org>
Date: Sun Sep 25 18:43:34 2011 -0600
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.
latex/base/decorators.py | 6 +++---
latex/base/windowactivatable.py | 5 ++---
latex/latex/editor.py | 4 ++--
3 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/latex/base/decorators.py b/latex/base/decorators.py
index d4f7bc9..2a2fd24 100644
--- a/latex/base/decorators.py
+++ b/latex/base/decorators.py
@@ -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
diff --git a/latex/base/windowactivatable.py b/latex/base/windowactivatable.py
index 066c7f4..a70a3e5 100644
--- a/latex/base/windowactivatable.py
+++ b/latex/base/windowactivatable.py
@@ -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):
"""
diff --git a/latex/latex/editor.py b/latex/latex/editor.py
index 90668cb..b58dc08 100644
--- a/latex/latex/editor.py
+++ b/latex/latex/editor.py
@@ -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):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]