[gedit-latex] Remove livepreview as it is crashing due to poppler.



commit 58cc49603c058906e5b5cb86c366e1b3f5dc2e3d
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Fri Jun 24 18:41:50 2011 +0200

    Remove livepreview as it is crashing due to poppler.
    
    Note: this should be added back when we manage to tidy up everything
    and make it work again.

 latex/base/__init__.py     |    9 +-
 latex/base/config.py       |   28 +-
 latex/base/decorators.py   |   25 +-
 latex/latex/actions.py     |  139 --
 latex/latex/editor.py      |   30 -
 latex/latex/livepreview.py | 3063 --------------------------------------------
 latex/latex/views.py       |    7 -
 latex/tools.xml            |    3 -
 8 files changed, 6 insertions(+), 3298 deletions(-)
---
diff --git a/latex/base/__init__.py b/latex/base/__init__.py
index c46a2e9..b3b05d6 100644
--- a/latex/base/__init__.py
+++ b/latex/base/__init__.py
@@ -949,8 +949,6 @@ class WindowContext(object):
 		
 		self.window_scope_views = {}	# maps view ids to View objects
 		self.editor_scope_views = {}	# maps Editor object to a map from ID to View object
-		
-		self.latex_previews = None
 
 		self._log.debug("init")
 	
@@ -1011,12 +1009,7 @@ class WindowContext(object):
 	def destroy(self):
 		# unreference the window decorator
 		del self._window_decorator
-		
-		# destroy the internal pdf previews
-		if self.latex_previews != None:
-			self.latex_previews.destroy()
-			del self.latex_previews
-		
+
 	def __del__(self):
 		self._log.debug("Properly destroyed %s" % self)
 	
diff --git a/latex/base/config.py b/latex/base/config.py
index cfc9790..836a8c3 100644
--- a/latex/base/config.py
+++ b/latex/base/config.py
@@ -48,18 +48,6 @@ UI = """
 					<separator />
 					<menuitem action="LaTeXForwardSearchAction" />
 					<menuitem action="LaTeXBuildImageAction" />
-					<separator />
-					<menu action="LaTeXPreviewAction">
-						<menuitem action="LaTeXPreviewToggleAction" />
-						<separator />
-						<menuitem action="LaTeXPreviewZoomInAction" />
-						<menuitem action="LaTeXPreviewZoomOutAction" />
-						<separator />
-						<menuitem action="LaTeXPreviewScrollUpAction" />
-						<menuitem action="LaTeXPreviewScrollDownAction" />
-						<menuitem action="LaTeXPreviewScrollLeftAction" />
-						<menuitem action="LaTeXPreviewScrollRightAction" />
-					</menu>
 				</menu>
 				<menu action="BibTeXMenuAction">
 					<menuitem action="BibTeXNewEntryAction" />
@@ -119,17 +107,12 @@ UI = """
 			<toolitem action="LaTeXUseBibliographyAction" />
 			<separator />
 			<toolitem action="LaTeXBuildImageAction" />
-			<!--
-			<separator />
-			<toolitem action="LaTeXPreviewZoomInAction" />
-			<toolitem action="LaTeXPreviewZoomOutAction" />
-			-->
 		</toolbar>
 	</ui>"""
 
 # actions
 
-from ..latex.actions import LaTeXMenuAction, LaTeXNewAction, LaTeXPreviewAction, LaTeXChooseMasterAction, \
+from ..latex.actions import LaTeXMenuAction, LaTeXNewAction, LaTeXChooseMasterAction, \
 		LaTeXItemizeAction, LaTeXEnumerateAction, LaTeXFontFamilyAction, LaTeXFontFamilyMenuAction, LaTeXBoldAction, \
 		LaTeXItalicAction, LaTeXEmphasizeAction, LaTeXDescriptionAction, LaTeXStructureMenuAction, LaTeXPartAction, LaTeXChapterAction, \
 		LaTeXSectionAction, LaTeXSubsectionAction, LaTeXParagraphAction,LaTeXSubparagraphAction, LaTeXStructureAction, \
@@ -137,13 +120,11 @@ from ..latex.actions import LaTeXMenuAction, LaTeXNewAction, LaTeXPreviewAction,
 		LaTeXJustifyCenterAction, LaTeXJustifyRightAction, LaTeXMathMenuAction, LaTeXMathAction, LaTeXDisplayMathAction, \
 		LaTeXEquationAction, LaTeXUnEqnArrayAction, LaTeXEqnArrayAction, LaTeXUnderlineAction, LaTeXSmallCapitalsAction, \
 		LaTeXRomanAction, LaTeXSansSerifAction, LaTeXTypewriterAction, LaTeXCloseEnvironmentAction, LaTeXBlackboardBoldAction, \
-		LaTeXCaligraphyAction, LaTeXFrakturAction, LaTeXForwardSearchAction, LaTeXBuildImageAction, LaTeXSaveAsTemplateAction, \
-		LaTeXPreviewZoomInAction, LaTeXPreviewZoomOutAction, LaTeXPreviewScrollUpAction, LaTeXPreviewScrollDownAction, \
-		LaTeXPreviewScrollLeftAction, LaTeXPreviewScrollRightAction, LaTeXPreviewToggleAction
+		LaTeXCaligraphyAction, LaTeXFrakturAction, LaTeXForwardSearchAction, LaTeXBuildImageAction, LaTeXSaveAsTemplateAction
 
 from ..bibtex.actions import BibTeXMenuAction, BibTeXNewEntryAction
 
-ACTIONS = [ LaTeXMenuAction, LaTeXNewAction, LaTeXPreviewAction, LaTeXChooseMasterAction, 
+ACTIONS = [ LaTeXMenuAction, LaTeXNewAction, LaTeXChooseMasterAction, 
 		LaTeXItemizeAction, LaTeXEnumerateAction, LaTeXFontFamilyAction, LaTeXFontFamilyMenuAction, LaTeXBoldAction, 
 		LaTeXItalicAction, LaTeXEmphasizeAction, LaTeXDescriptionAction, LaTeXStructureMenuAction, LaTeXPartAction, LaTeXChapterAction, 
 		LaTeXSectionAction, LaTeXSubsectionAction, LaTeXParagraphAction,LaTeXSubparagraphAction, LaTeXStructureAction, 
@@ -152,8 +133,7 @@ ACTIONS = [ LaTeXMenuAction, LaTeXNewAction, LaTeXPreviewAction, LaTeXChooseMast
 		LaTeXEquationAction, LaTeXUnEqnArrayAction, LaTeXEqnArrayAction, LaTeXUnderlineAction, LaTeXSmallCapitalsAction, 
 		LaTeXRomanAction, LaTeXSansSerifAction, LaTeXTypewriterAction, LaTeXCloseEnvironmentAction, LaTeXBlackboardBoldAction, 
 		LaTeXCaligraphyAction, LaTeXFrakturAction, LaTeXForwardSearchAction, LaTeXBuildImageAction, LaTeXSaveAsTemplateAction, 
-		BibTeXMenuAction, BibTeXNewEntryAction, LaTeXPreviewZoomInAction, LaTeXPreviewZoomOutAction, LaTeXPreviewScrollUpAction, 
-		LaTeXPreviewScrollDownAction, LaTeXPreviewScrollLeftAction, LaTeXPreviewScrollRightAction, LaTeXPreviewToggleAction ]
+		BibTeXMenuAction, BibTeXNewEntryAction ]
 
 # views
 
diff --git a/latex/base/decorators.py b/latex/base/decorators.py
index 910ae8d..16c427a 100644
--- a/latex/base/decorators.py
+++ b/latex/base/decorators.py
@@ -520,13 +520,7 @@ class GeditWindowDecorator(IPreferencesMonitor):
 		#
 		self._set_selected_bottom_view(self._selected_bottom_views[tab_decorator])
 		self._set_selected_side_view(self._selected_side_views[tab_decorator])
-		
-		
-		# update latex_previews
-		latex_previews = self._window_context.latex_previews
-		if latex_previews != None and latex_previews.is_shown(tab_decorator.tab):
-			latex_previews.reparent(tab_decorator.tab)
-		
+
 	def _get_selected_bottom_view(self):
 		notebook = self._window.get_bottom_panel().get_children()[0].get_children()[0]
 		assert type(notebook) is Gtk.Notebook
@@ -578,11 +572,6 @@ class GeditWindowDecorator(IPreferencesMonitor):
 		@param tab: the closed GeditTab
 		"""
 		self._log.debug("tab_removed")
-
-		# properly remove the latex preview, if any
-		latex_previews = self._window_context.latex_previews
-		if latex_previews != None and latex_previews.is_shown(tab):
-			latex_previews.hide(tab)
 		
 		# As we don't call GeditWindowDecorator.adjust() if the new 
 		# tab is not the active one (for example, when opening several 
@@ -803,13 +792,6 @@ class GeditTabDecorator(object):
 					self._editor = editor_class.__new__(editor_class)
 					editor_class.__init__(self._editor, self, file)
 					
-					# update the file path in latex_previews
-					current_tab = self._window_decorator._window.get_active_tab()
-					pdf_file_path = "%s.pdf" % file.shortname
-					latex_previews = self._window_decorator._window_context.latex_previews
-					if latex_previews != None and latex_previews.is_shown(current_tab):
-						latex_previews.update_file_path(current_tab, pdf_file_path)
-					
 					# The following doesn't work because the right expression is evaluated
 					# and then assigned to the left. This means that Editor.__init__ is
 					# running and reading _editor while _editor is None. That leads to
@@ -831,11 +813,6 @@ class GeditTabDecorator(object):
 					#self._editor = editor_class(self, file)
 				else:
 					self._log.warning("No editor class found for extension %s" % extension)
-
-					current_tab = self._window_decorator._window.get_active_tab()
-					latex_previews = self._window_decorator._window_context.latex_previews
-					if latex_previews != None and latex_previews.is_shown(current_tab):
-						latex_previews.hide(current_tab)
 				
 				# tell WindowDecorator to adjust actions
 				# but only if this tab is the active tab
diff --git a/latex/latex/actions.py b/latex/latex/actions.py
index 5614b37..9cf297b 100644
--- a/latex/latex/actions.py
+++ b/latex/latex/actions.py
@@ -234,145 +234,6 @@ class LaTeXUseBibliographyAction(LaTeXIconAction):
 	
 
 from ..util import verbose
-from livepreview import LaTeXPreviews
-
-class LaTeXPreviewAction(LaTeXAction):
-	label = "Embedded Preview"
-	stock_id = Gtk.STOCK_ZOOM_FIT
-	tooltip = None
-	accelerator = None
-	
-	def activate(self, context):
-		pass
-	
-
-class LaTeXPreviewToggleAction(LaTeXAction):
-	_log = getLogger("LaTeXPreviewToggleAction")
-	
-	label = "Toggle Embedded Preview"
-	stock_id = Gtk.STOCK_ZOOM_FIT				 # TODO: Create and use a better icon 
-	accelerator = "<Ctrl><Shift>T"
-	tooltip = "Toggle the embedded PDF preview"
-	
-	@verbose
-	def activate(self, context):
-		editor = context.active_editor
-		if not type(editor) is LaTeXEditor:
-			return
-
-		if context.latex_previews == None:
-			context.latex_previews = LaTeXPreviews(context)
-		current_tab = context._window_decorator._window.get_active_tab()
-
-		try:
-			pdf_file_path = "%s.pdf" % editor.file.shortname
-		except Exception, exc:
-			# This happens when a .tex document has no master file.
-			# Is it a bug ? Or should one catch this exception ?
-			self._log.debug("Exception catched. %s" % exc)
-			if context.latex_previews.is_shown(current_tab):
-				context.latex_previews.hide(current_tab)
-				self._log.debug("Closing the preview.")
-			return
-
-		context.latex_previews.toggle(current_tab, pdf_file_path)
-
-
-class LaTeXPreviewZoomInAction(LaTeXAction):
-	label = "Zoom In"
-	stock_id = Gtk.STOCK_ZOOM_IN
-	accelerator = "<Alt><Super>P"
-	tooltip = "Zoom the embedded preview in"
-
-	def activate(self, context):
-		editor = context.active_editor
-		if not type(editor) is LaTeXEditor:
-			return
-		
-		current_tab = context._window_decorator._window.get_active_tab()
-		if context.latex_previews != None and context.latex_previews.is_shown(current_tab):
-			context.latex_previews.zoom(current_tab, LaTeXPreviews.ZOOM_IN)
-
-
-class LaTeXPreviewZoomOutAction(LaTeXAction):
-	label = "Zoom Out"
-	stock_id = Gtk.STOCK_ZOOM_OUT
-	accelerator = "<Alt><Super>M"
-	tooltip = "Zoom the embedded preview out"
-
-	def activate(self, context):
-		editor = context.active_editor
-		if not type(editor) is LaTeXEditor:
-			return
-			
-		current_tab = context._window_decorator._window.get_active_tab()
-		if context.latex_previews != None and context.latex_previews.is_shown(current_tab):
-			context.latex_previews.zoom(current_tab, LaTeXPreviews.ZOOM_OUT)
-
-
-class LaTeXPreviewScrollUpAction(LaTeXAction):
-	label = "Scroll Up"
-	stock_id = Gtk.STOCK_GO_UP
-	accelerator = "<Alt><Super>Up"
-	tooltip = "Scroll the embedded preview up"
-
-	def activate(self, context):
-		editor = context.active_editor
-		if not type(editor) is LaTeXEditor:
-			return
-			
-		current_tab = context._window_decorator._window.get_active_tab()
-		if context.latex_previews != None and context.latex_previews.is_shown(current_tab):
-			context.latex_previews.scroll(current_tab, LaTeXPreviews.SCROLL_UP)
-
-
-class LaTeXPreviewScrollDownAction(LaTeXAction):
-	label = "Scroll Down"
-	stock_id = Gtk.STOCK_GO_DOWN
-	accelerator = "<Alt><Super>Down"
-	tooltip = "Scroll the embedded preview down"
-
-	def activate(self, context):
-		editor = context.active_editor
-		if not type(editor) is LaTeXEditor:
-			return
-			
-		current_tab = context._window_decorator._window.get_active_tab()
-		if context.latex_previews != None and context.latex_previews.is_shown(current_tab):
-			context.latex_previews.scroll(current_tab, LaTeXPreviews.SCROLL_DOWN)
-
-
-class LaTeXPreviewScrollLeftAction(LaTeXAction):
-	label = "Scroll Left"
-	stock_id = Gtk.STOCK_GO_BACK
-	accelerator = "<Alt><Super>Left"
-	tooltip = "Scroll the embedded preview to the left"
-
-	def activate(self, context):
-		editor = context.active_editor
-		if not type(editor) is LaTeXEditor:
-			return
-			
-		current_tab = context._window_decorator._window.get_active_tab()
-		if context.latex_previews != None and context.latex_previews.is_shown(current_tab):
-			context.latex_previews.scroll(current_tab, LaTeXPreviews.SCROLL_LEFT)
-
-
-class LaTeXPreviewScrollRightAction(LaTeXAction):
-	label = "Scroll Right"
-	stock_id = Gtk.STOCK_GO_FORWARD
-	accelerator = "<Alt><Super>Right"
-	tooltip = "Scroll the embedded preview to the right"
-
-	def activate(self, context):
-		editor = context.active_editor
-		if not type(editor) is LaTeXEditor:
-			return
-			
-		current_tab = context._window_decorator._window.get_active_tab()
-		if context.latex_previews != None and context.latex_previews.is_shown(current_tab):
-			context.latex_previews.scroll(current_tab, LaTeXPreviews.SCROLL_RIGHT)
-
 
 class LaTeXFontFamilyAction(LaTeXIconAction):
 	menu_tool_action = True
diff --git a/latex/latex/editor.py b/latex/latex/editor.py
index ff2a457..0a88d8d 100644
--- a/latex/latex/editor.py
+++ b/latex/latex/editor.py
@@ -122,36 +122,6 @@ class LaTeXEditor(Editor, IIssueHandler, IPreferencesMonitor):
 			else:
 				self._window_context._window_decorator._toolbar.hide()
 	
-	def _ctrl_left_clicked(self, it):
-		"""
-		For synchronization by synctex
-		"""
-		# Editor._ctrl_left_clicked
-		
-		tab = self.tab_decorator.tab
-		line = it.get_line() + 1
-		column = it.get_line_offset() + 1
-		source_file = "%s/%s" % (self._file.dirname, self._file.basename)
-		# We use self.file and not self._file here, to get the 
-		# master document, because the output file will have the 
-		# name of the master document
-		try:
-			output_file = "%s.pdf" % self.file.shortname
-		except:
-			# Is this due to a bug ? Or is there a method I 
-			# don't know to check wether a file has/is a 
-			# master file or doesn't/couldn't have one ?
-			self.__log.debug("Error while trying to get the output file path. No master document ?")
-			return
-		
-		from livepreview import LaTeXPreviews
-		
-		if self._window_context.latex_previews == None:
-			self._window_context.latex_previews = LaTeXPreviews(self._window_context)
-			
-		latex_previews = self._window_context.latex_previews
-		latex_previews.sync_view(tab, source_file, line, column, output_file)
-	
 	def drag_drop_received(self, files):
 		# see base.Editor.drag_drop_received
 		
diff --git a/latex/latex/views.py b/latex/latex/views.py
index f2189ef..d651deb 100755
--- a/latex/latex/views.py
+++ b/latex/latex/views.py
@@ -286,13 +286,6 @@ class LaTeXOutlineView(BaseOutlineView):
 			# open/activate the referenced file, if the node is 'foreign'
 			if node.file != self._editor.edited_file:
 				self._context.activate_editor(node.file)
-			else:
-				# act as if the user Ctrl+clicked on the region of the activated node
-				
-				# FIXME: this doesn't belong here, what if an implementation of _ctrl_left_clicked requires
-				# a Gdk.Event for e.g. displaying a context menu?
-				it = self._editor._text_buffer.get_iter_at_offset(node.start)
-				self._editor._ctrl_left_clicked(it)
 	
 	def _on_tables_toggled(self, toggle_button):
 		value = toggle_button.get_active()
diff --git a/latex/tools.xml b/latex/tools.xml
index 0c3decc..c2b0c71 100644
--- a/latex/tools.xml
+++ b/latex/tools.xml
@@ -3,9 +3,6 @@
 		<job mustSucceed="True" postProcessor="RubberPostProcessor">rubber --inplace --maxerr -1 --short --force --warn all --pdf "$filename"</job>
 		<job mustSucceed="True" postProcessor="GenericPostProcessor">gnome-open "$shortname.pdf"</job>
 	</tool>
-	<tool description="Create a PDF from LaTeX source and show in embedded preview" extensions=".tex" id="2" label="LaTeX â PDF (Embedded Preview)">
-		<job mustSucceed="true" postProcessor="RubberPostProcessor">rubber --inplace --maxerr -1 --short --force --warn all --pdf "$filename"</job>
-	</tool>
 	<tool description="Create a PostScript from LaTeX source" extensions=".tex" id="3" label="LaTeX â PS">
 		<job mustSucceed="true" postProcessor="RubberPostProcessor">rubber --inplace --maxerr -1 --short --force --warn all --ps "$filename"</job>
 		<job mustSucceed="true" postProcessor="GenericPostProcessor">gnome-open "$shortname.ps"</job>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]