[gedit-latex] Move PanelView to an standalone file.



commit 51133f78181e27f51477aefa228d628c643208ab
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Sun Oct 2 10:02:40 2011 +0200

    Move PanelView to an standalone file.

 latex/Makefile.am          |    1 +
 latex/base/__init__.py     |   29 +-------------------------
 latex/latex/views.py       |    2 +-
 latex/outline.py           |    2 +-
 latex/panelview.py         |   49 ++++++++++++++++++++++++++++++++++++++++++++
 latex/tools/views.py       |    2 +-
 latex/views.py             |    2 +-
 latex/windowactivatable.py |    3 +-
 8 files changed, 57 insertions(+), 33 deletions(-)
---
diff --git a/latex/Makefile.am b/latex/Makefile.am
index bc153f1..d16ed5a 100644
--- a/latex/Makefile.am
+++ b/latex/Makefile.am
@@ -10,6 +10,7 @@ plugin_PYTHON = \
 	__init__.py \
 	issues.py \
 	outline.py \
+	panelview.py \
 	resources.py \
 	singleton.py \
 	snippetmanager.py \
diff --git a/latex/base/__init__.py b/latex/base/__init__.py
index d650521..17f9b89 100644
--- a/latex/base/__init__.py
+++ b/latex/base/__init__.py
@@ -26,36 +26,12 @@ These classes form the interface exposed by the plugin base layer.
 
 import logging
 
-from gi.repository import Gtk, Gdk
+from gi.repository import GObject, 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
-class PanelView(Gtk.Box):
-    """
-    Base class for a View
-    """
-
-    SCOPE_EDITOR = 1
-
-    def __init__(self, context):
-        Gtk.Box.__init__(self)
-        self._context = context
-
-    # these should be overriden by subclasses
-
-    # a label string used for this view
-    def get_label(self):
-        raise NotImplementedError
-
-    # an icon for this view (Gtk.Image or a stock_id string)
-    def get_icon(self):
-        return None
-
 class Template(object):
     """
     This one is exposed and should be used by the 'real' plugin code
@@ -71,9 +47,6 @@ class Template(object):
         return self._expression
 
 
-from gi.repository import GObject
-
-
 class WindowContext(object):
     """
     The WindowContext is passed to Editors and is used to
diff --git a/latex/latex/views.py b/latex/latex/views.py
index 5cef793..cdad4a9 100644
--- a/latex/latex/views.py
+++ b/latex/latex/views.py
@@ -32,7 +32,7 @@ from os import system
 from os.path import basename
 
 from ..preferences import Preferences
-from ..base import PanelView
+from ..panelview import PanelView
 from ..file import File
 from ..resources import Resources
 from ..snippetmanager import SnippetManager
diff --git a/latex/outline.py b/latex/outline.py
index a8cf629..a3286ce 100644
--- a/latex/outline.py
+++ b/latex/outline.py
@@ -27,7 +27,7 @@ Classes used for creating an outline view of LaTeX and BibTeX files
 from logging import getLogger
 from gi.repository import Gtk, GdkPixbuf
 
-from base import PanelView
+from panelview import PanelView
 from preferences import Preferences
 from resources import Resources
 from gldefs import _
diff --git a/latex/panelview.py b/latex/panelview.py
new file mode 100644
index 0000000..e7ab8eb
--- /dev/null
+++ b/latex/panelview.py
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+
+# This file is part of the Gedit LaTeX Plugin
+#
+# Copyright (C) 2010 Michael Zeising
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public Licence as published by the Free Software
+# Foundation; either version 2 of the Licence, or (at your option) any later
+# version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU General Public Licence for more
+# details.
+#
+# You should have received a copy of the GNU General Public Licence along with
+# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
+# Street, Fifth Floor, Boston, MA  02110-1301, USA
+
+import logging
+
+from gi.repository import Gtk
+
+LOG = logging.getLogger(__name__)
+
+#FIXME: this should probably be just a Gtk.Orientable iface
+# HORIZONTAL: means Bottom Panel
+# VERTICAL: means Side Panel
+class PanelView(Gtk.Box):
+    """
+    Base class for a View
+    """
+
+    def __init__(self, context):
+        Gtk.Box.__init__(self)
+        self._context = context
+
+    # these should be overriden by subclasses
+
+    # a label string used for this view
+    def get_label(self):
+        raise NotImplementedError
+
+    # an icon for this view (Gtk.Image or a stock_id string)
+    def get_icon(self):
+        return None
+
+# ex:ts=4:et:
diff --git a/latex/tools/views.py b/latex/tools/views.py
index e931d98..d4c4d9e 100644
--- a/latex/tools/views.py
+++ b/latex/tools/views.py
@@ -27,7 +27,7 @@ import logging
 from gi.repository import Gtk, GdkPixbuf
 
 from ..resources import Resources
-from ..base import PanelView
+from ..panelview import PanelView
 from ..issues import Issue, IStructuredIssueHandler
 from ..gldefs import _
 
diff --git a/latex/views.py b/latex/views.py
index 277d8c9..25dd246 100644
--- a/latex/views.py
+++ b/latex/views.py
@@ -27,7 +27,7 @@ from logging import getLogger
 
 from preferences import Preferences
 from resources import Resources
-from base import PanelView
+from panelview import PanelView
 from issues import Issue
 from util import escape
 from gldefs import _
diff --git a/latex/windowactivatable.py b/latex/windowactivatable.py
index 75e6de4..74784a5 100644
--- a/latex/windowactivatable.py
+++ b/latex/windowactivatable.py
@@ -33,9 +33,10 @@ from .preferences.tools import ToolPreferences
 from .tools import ToolAction
 from .resources import Resources
 from .file import File
+from .panelview import PanelView
 from .base.config import EDITOR_SCOPE_VIEWS, ACTIONS
 from .base.tabdecorator import GeditTabDecorator
-from .base import PanelView, WindowContext
+from .base import WindowContext
 
 LOG = logging.getLogger(__name__)
 



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