[gedit-latex] Try to get ToolView working again
- From: John Stowers <jstowers src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit-latex] Try to get ToolView working again
- Date: Thu, 1 Sep 2011 01:13:18 +0000 (UTC)
commit 1d71ef00bd88d1d8d1b63b58e22acd4e8110cccb
Author: John Stowers <john stowers gmail com>
Date: Thu Sep 1 13:11:31 2011 +1200
Try to get ToolView working again
latex/base/__init__.py | 23 ++++++++++-------------
latex/base/config.py | 6 +++---
latex/base/windowactivatable.py | 17 -----------------
latex/tools/views.py | 2 +-
4 files changed, 14 insertions(+), 34 deletions(-)
---
diff --git a/latex/base/__init__.py b/latex/base/__init__.py
index 9412d0b..878d731 100644
--- a/latex/base/__init__.py
+++ b/latex/base/__init__.py
@@ -24,10 +24,14 @@ base
These classes form the interface exposed by the plugin base layer.
"""
-from logging import getLogger
+import logging
+
from gi.repository import Gtk, Gdk
+
from .file import File
+LOG = logging.getLogger(__name__)
+
#FIXME: this should probably be just a Gtk.Orientable iface
# HORIZONTAL: means Bottom Panel
# VERTICAL: means Side Panel
@@ -36,8 +40,6 @@ class PanelView(Gtk.Box):
Base class for a View
"""
- _log = getLogger("PanelView")
-
SCOPE_EDITOR = 1
def __init__(self, context):
@@ -82,8 +84,6 @@ class WindowContext(object):
This also creates and destroys the View instances.
"""
- _log = getLogger("WindowContext")
-
def __init__(self, window_decorator, editor_scope_view_classes):
"""
@param window_decorator: the GeditWindowDecorator this context corresponds to
@@ -94,8 +94,6 @@ class WindowContext(object):
self.editor_scope_views = {} # maps Editor object to a map from ID to View object
- self._log.debug("init")
-
def create_editor_views(self, editor, file):
"""
Create instances of the editor specific Views for a given Editor instance
@@ -109,9 +107,9 @@ class WindowContext(object):
# create View instance and add it to the map
self.editor_scope_views[editor][id] = clazz(self, editor)
- self._log.debug("Created view " + id)
+ LOG.debug("Created view " + id)
except KeyError:
- self._log.debug("No views for %s" % file.extension)
+ LOG.debug("No views for %s" % file.extension)
###
# public interface
@@ -139,11 +137,12 @@ class WindowContext(object):
"""
Return a View object
"""
- print self.editor_scope_views, editor, view_id
try:
return self.editor_scope_views[editor][view_id]
except KeyError:
- self._log.critical("Unknown view id: %s" % view_id)
+ LOG.critical("Unknown view id: %s (we have: %s)" % (
+ view_id,
+ ",".join(self.editor_scope_views.get(editor,{}).keys())))
def set_action_enabled(self, action_id, enabled):
"""
@@ -155,7 +154,5 @@ class WindowContext(object):
# unreference the window decorator
del self._window_decorator
- def __del__(self):
- self._log.debug("Properly destroyed %s" % self)
# ex:ts=4:et:
diff --git a/latex/base/config.py b/latex/base/config.py
index 74bbf51..8201bc1 100644
--- a/latex/base/config.py
+++ b/latex/base/config.py
@@ -56,7 +56,7 @@ ACTIONS = [LaTeXMenuAction, LaTeXNewAction, LaTeXChooseMasterAction,
from ..views import IssueView
from ..latex.views import LaTeXSymbolMapView, LaTeXOutlineView
from ..bibtex.views import BibTeXOutlineView
-
+from ..tools.views import ToolView
from ..preferences import Preferences
LATEX_EXTENSIONS = Preferences().get("latex-extensions").split(",")
@@ -65,10 +65,10 @@ BIBTEX_EXTENSIONS = [".bib"]
EDITOR_SCOPE_VIEWS = {}
for e in LATEX_EXTENSIONS:
- EDITOR_SCOPE_VIEWS[e] = {"IssueView": IssueView, "LaTeXOutlineView": LaTeXOutlineView, "LaTeXSymbolMapView": LaTeXSymbolMapView}
+ EDITOR_SCOPE_VIEWS[e] = {"IssueView": IssueView, "LaTeXOutlineView": LaTeXOutlineView, "LaTeXSymbolMapView": LaTeXSymbolMapView, "ToolView": ToolView}
for e in BIBTEX_EXTENSIONS:
- EDITOR_SCOPE_VIEWS[e] = {"IssueView": IssueView, "BibTeXOutlineView": BibTeXOutlineView}
+ EDITOR_SCOPE_VIEWS[e] = {"IssueView": IssueView, "BibTeXOutlineView": BibTeXOutlineView, "ToolView": ToolView}
# editors
diff --git a/latex/base/windowactivatable.py b/latex/base/windowactivatable.py
index 5864c6d..02ef393 100644
--- a/latex/base/windowactivatable.py
+++ b/latex/base/windowactivatable.py
@@ -32,7 +32,6 @@ from ..preferences import Preferences
from ..preferences.dialog import PreferencesDialog
from ..preferences.tools import ToolPreferences
from ..tools import ToolAction
-from ..tools.views import ToolView
from .config import EDITOR_SCOPE_VIEWS, ACTIONS
from .decorators import GeditTabDecorator
from .resources import Resources
@@ -159,22 +158,6 @@ class LaTeXWindowActivatable(GObject.Object, Gedit.WindowActivatable, PeasGtk.Co
self._side_views = []
self._bottom_views = []
- # caches window-scope View instances
- self._views = {}
-
- #
- # init the ToolView, it's always present
- #
- # TODO: position is ignored
- #
- tool_view = ToolView(self._window_context)
- self._views["ToolView"] = tool_view
- #fixme put the id!
- bottom_panel = self.window.get_bottom_panel()
- bottom_panel.add_item(tool_view, "ToolViewid", tool_view.get_label(), tool_view.get_icon())
- #self._window_bottom_views.append(tool_view)
-
-
def _init_actions(self):
"""
Merge the plugin's UI definition with the one of Gedit and hook the actions
diff --git a/latex/tools/views.py b/latex/tools/views.py
index c57deab..0c0daa2 100644
--- a/latex/tools/views.py
+++ b/latex/tools/views.py
@@ -38,7 +38,7 @@ class ToolView(PanelView, IStructuredIssueHandler):
_log = getLogger("ToolView")
- def __init__(self, context):
+ def __init__(self, context, editor):
PanelView.__init__(self, context)
self._handlers = {}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]