[gedit-latex] Finish save before running the tool
- From: Jose Aliste <jaliste src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit-latex] Finish save before running the tool
- Date: Fri, 15 Jul 2011 00:26:14 +0000 (UTC)
commit 4837eb1710d47e69c6cfed076df30e33c35318ce
Author: Lucas David-Roesler <roesler lucas gmail com>
Date: Sun Jul 10 22:11:23 2011 -0400
Finish save before running the tool
latex/tools/__init__.py | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/latex/tools/__init__.py b/latex/tools/__init__.py
index 2374dd3..5efc38a 100644
--- a/latex/tools/__init__.py
+++ b/latex/tools/__init__.py
@@ -26,7 +26,7 @@ It can be used for cleaning up, converting files, for building PDFs etc.
"""
from logging import getLogger
-
+from gi.repository import Gedit
from ..base.resources import Resources
@@ -122,18 +122,23 @@ class ToolAction(Action):
def activate(self, context):
self._log.debug("activate: %s" % self._tool)
- tool_view = context.find_view(None, "ToolView")
-
if context.active_editor:
- from ..preferences import Preferences # FIXME: circ dep
- # FIXME: find better way to save
+ doc = Gedit.App.get_default().get_active_window().get_active_document()
+ self.saving_id = doc.connect("saved",self.run_tool,context,doc)
context._window_decorator.save_file()
-
- self._runner.run(context.active_editor.file, self._tool, tool_view)
- self._log.debug("activate: " + str(context.active_editor.file))
else:
self._log.error("No active editor")
+ def run_tool(self, document, other, context, doc):
+ tool_view = context.find_view(None, "ToolView")
+
+ self._runner.run(context.active_editor.file, self._tool, tool_view)
+ self._log.debug("activate: " + str(context.active_editor.file))
+
+ # destroy the save listener, or else we get a compile on any save
+ doc.disconnect(self.saving_id)
+
+
from os import chdir
from util import Process
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]