[gedit-latex] Remove SideView and BottomView and make a PanelView.
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit-latex] Remove SideView and BottomView and make a PanelView.
- Date: Sun, 3 Jul 2011 09:40:54 +0000 (UTC)
commit 6f4cb636374d21c8468c52f5f16a29211d306af0
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Sat Jul 2 16:18:11 2011 +0200
Remove SideView and BottomView and make a PanelView.
They were inheriting from View because of Gtk[VH]Box, if we use
a Gtk.Box as main abstract class this is not neccessary anymore.
See also that I made some clean up in the inheritance.
latex/base/__init__.py | 129 ++++++---------------------------------
latex/base/windowactivatable.py | 31 +++++-----
latex/bibtex/views.py | 10 +---
latex/latex/views.py | 81 +++++++++++--------------
latex/outline.py | 55 +++++------------
latex/tools/views.py | 29 +++------
latex/views.py | 54 +++++++---------
7 files changed, 124 insertions(+), 265 deletions(-)
---
diff --git a/latex/base/__init__.py b/latex/base/__init__.py
index 53daf9f..ec840ab 100644
--- a/latex/base/__init__.py
+++ b/latex/base/__init__.py
@@ -27,132 +27,43 @@ These classes form the interface exposed by the plugin base layer.
from logging import getLogger
from gi.repository import Gtk, Gdk
-
-class View(object):
+#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
+ Base class for a View
"""
- _log = getLogger("View")
+ _log = getLogger("PanelView")
- # TODO: this doesn't belong to the interface of base
- # TODO: call destroy()
+ SCOPE_WINDOW = 0
+ SCOPE_EDITOR = 1
- SCOPE_WINDOW, SCOPE_EDITOR = 0, 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
- label = ""
+ def get_label(self):
+ raise NotImplementedError
# an icon for this view (Gtk.Image or a stock_id string)
- icon = None
+ def get_icon(self):
+ return None
- # the scope of this View:
- # SCOPE_WINDOW: the View is created with the window and the same instance is passed to every Editor
+ # FIXME: this doesn't seems to be used, should we remove it?
+ # the scope of this PanelView:
+ # SCOPE_WINDOW: the View is created with the window and the same instance is passed to every Editor
# SCOPE_EDITOR: the View is created with the Editor and destroyed with it
- scope = SCOPE_WINDOW
-
- def init(self, context):
- """
- To be overridden
- """
-
- def destroy(self):
- """
- To be overridden
- """
+ def get_scope(self):
+ return self.SCOPE_WINDOW
def __del__(self):
self._log.debug("Properly destroyed %s" % self)
-
-class SideView(View, Gtk.VBox):
- """
- """
- def __init__(self, context):
- GObject.GObject.__init__(self)
-
- self._context = context
- self._initialized = False
-
- # connect to expose event and init() on first expose
- self._expose_handler = self.connect("draw", self._on_expose_event)
-
- def _on_expose_event(self, *args):
- """
- The View has been exposed for the first time
- """
- self._do_init()
-
- def _do_init(self):
- self.disconnect(self._expose_handler)
- self.init(self._context)
- self.show_all()
- self._initialized = True
-
- def assure_init(self):
- """
- This may be called by the subclassing instance to assure that the View
- has been initialized.
-
- This is necessary because methods of the instance may be called before
- init() as the View is initialized on the first exposure.
- """
- if not self._initialized:
- self._do_init()
-
- def destroy(self):
- if not self._initialized:
- self.disconnect(self._expose_handler)
- Gtk.VBox.destroy(self)
- self._context = None
-
-
-class BottomView(View, Gtk.HBox):
- """
- """
- def __init__(self, context):
- GObject.GObject.__init__(self)
-
- self._context = context
- self._initialized = False
-
- # connect to expose event and init() on first expose
- self._expose_handler = self.connect("draw", self._on_expose_event)
-
- def _on_expose_event(self, *args):
- """
- The View has been exposed for the first time
- """
- self._do_init()
-
- def _do_init(self):
- self.disconnect(self._expose_handler)
- self.init(self._context)
- self.show_all()
- self._initialized = True
-
- def assure_init(self):
- """
- This may be called by the subclassing instance to assure that the View
- has been initialized.
-
- This is necessary because methods of the instance may be called before
- init() as the View is initialized on the first exposure.
- """
- if not self._initialized:
- self._do_init()
-
- def destroy(self):
- if not self._initialized:
- self.disconnect(self._expose_handler)
- Gtk.HBox.destroy(self)
- self._context = None
-
-
class Template(object):
"""
This one is exposed and should be used by the 'real' plugin code
diff --git a/latex/base/windowactivatable.py b/latex/base/windowactivatable.py
index 1125e15..8180f63 100644
--- a/latex/base/windowactivatable.py
+++ b/latex/base/windowactivatable.py
@@ -36,7 +36,7 @@ from ..tools.views import ToolView
from .config import WINDOW_SCOPE_VIEWS, EDITOR_SCOPE_VIEWS, ACTIONS
from .decorators import GeditTabDecorator
from .resources import Resources
-from . import File, SideView, BottomView, WindowContext
+from . import File, PanelView, WindowContext
class LaTeXWindowActivatable(GObject.Object, Gedit.WindowActivatable, PeasGtk.Configurable):
__gtype_name__ = "LaTeXWindowActivatable"
@@ -181,7 +181,7 @@ class LaTeXWindowActivatable(GObject.Object, Gedit.WindowActivatable, PeasGtk.Co
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.label, tool_view.icon)
+ bottom_panel.add_item(tool_view, "ToolViewid", tool_view.get_label(), tool_view.get_icon())
#self._window_bottom_views.append(tool_view)
# update window context
@@ -478,10 +478,11 @@ class LaTeXWindowActivatable(GObject.Object, Gedit.WindowActivatable, PeasGtk.Co
if tab_decorator.editor:
editor_views = self._window_context.editor_scope_views[tab_decorator.editor]
for id, view in editor_views.iteritems():
- if isinstance(view, BottomView):
- after_bottom_views.add(view)
- elif isinstance(view, SideView):
- after_side_views.add(view)
+ if isinstance(view, PanelView):
+ if view.get_orientation() == Gtk.Orientation.HORIZONTAL:
+ after_bottom_views.add(view)
+ else:
+ after_side_views.add(view)
else:
raise RuntimeError("Invalid view type: %s" % view)
@@ -498,13 +499,12 @@ class LaTeXWindowActivatable(GObject.Object, Gedit.WindowActivatable, PeasGtk.Co
i = 1
for view in after_side_views.difference(before_side_views):
i += 1
- self.window.get_side_panel().add_item(view, "after_side_view_id" + str(i), view.label, view.icon)
+ self.window.get_side_panel().add_item(view, "after_side_view_id" + str(i), view.get_label(), view.get_icon())
self._side_views.append(view)
i = 1
for view in after_bottom_views.difference(before_bottom_views):
i += 1
- print view.label, view.icon
- self.window.get_bottom_panel().add_item(view, "bottom_view_id" + str(i), view.label, view.icon)
+ self.window.get_bottom_panel().add_item(view, "bottom_view_id" + str(i), view.get_label(), view.get_icon())
self._bottom_views.append(view)
#
@@ -533,10 +533,11 @@ class LaTeXWindowActivatable(GObject.Object, Gedit.WindowActivatable, PeasGtk.Co
clazz.__init__(view, self._window_context)
self._views[id] = view
- if isinstance(view, BottomView):
- after_window_bottom_views.add(view)
- elif isinstance(view, SideView):
- after_window_side_views.add(view)
+ if isinstance(view, PanelView):
+ if view.get_orientation() == Gtk.Orientation.HORIZONTAL:
+ after_window_bottom_views.add(view)
+ else:
+ after_window_side_views.add(view)
else:
raise RuntimeError("Invalid view type: %s" % view)
except KeyError:
@@ -555,11 +556,11 @@ class LaTeXWindowActivatable(GObject.Object, Gedit.WindowActivatable, PeasGtk.Co
i = 1
for view in after_window_side_views.difference(before_window_side_views):
i += 1
- self.window.get_side_panel().add_item(view, "WHATView" + str(i), view.label, view.icon)
+ self.window.get_side_panel().add_item(view, "WHATView" + str(i), view.get_label(), view.get_icon())
self._window_side_views.append(view)
for view in after_window_bottom_views.difference(before_window_bottom_views):
- self.window.get_bottom_panel().add_item(view, view.label, view.icon)
+ self.window.get_bottom_panel().add_item(view, view.get_label(), view.get_icon())
self._window_bottom_views.append(view)
#
diff --git a/latex/bibtex/views.py b/latex/bibtex/views.py
index cdaa5a0..555cf7a 100644
--- a/latex/bibtex/views.py
+++ b/latex/bibtex/views.py
@@ -52,9 +52,6 @@ class BibTeXOutlineView(BaseOutlineView):
BaseOutlineView.__init__(self, context, editor)
self._handlers = {}
- def init(self, context):
- BaseOutlineView.init(self, context)
-
self._grouping = GROUP_NONE
# add grouping controls to toolbar
@@ -94,6 +91,8 @@ class BibTeXOutlineView(BaseOutlineView):
self._toolbar.insert(tool_button, -1)
+ self.show_all()
+
def _on_grouping_toggled(self, toggle_button):
if self._item_none.get_active():
self._grouping = GROUP_NONE
@@ -132,11 +131,6 @@ class BibTeXOutlineView(BaseOutlineView):
if isinstance(node, Entry):
self._editor.select(node.start, node.end)
- def destroy(self):
- for obj in self._handlers:
- obj.disconnect(self._handlers[obj])
- BaseOutlineView.destroy(self)
-
class OutlineConverter(object):
"""
diff --git a/latex/latex/views.py b/latex/latex/views.py
index 56c2271..5b47aef 100644
--- a/latex/latex/views.py
+++ b/latex/latex/views.py
@@ -30,7 +30,7 @@ from logging import getLogger
import xml.etree.ElementTree as ElementTree
from ..preferences import Preferences
-from ..base import View, SideView
+from ..base import PanelView
from ..base.resources import Resources
from ..base.templates import Template
from ..issues import Issue
@@ -78,40 +78,46 @@ class SymbolCollection(object):
self.groups.append(group)
-class LaTeXSymbolMapView(SideView):
+class LaTeXSymbolMapView(PanelView):
"""
"""
- __log = getLogger("LaTeXSymbolMapView")
+ _log = getLogger("LaTeXSymbolMapView")
- label = _("Symbols")
- icon = Gtk.Image.new_from_stock(Gtk.STOCK_INDEX,Gtk.IconSize.MENU)
- scope = View.SCOPE_WINDOW
+ def __init__(self, context):
+ PanelView.__init__(self, context)
- def init(self, context):
- self.__log.debug("init")
+ self._log.debug("init")
- self.__context = context
- self.__preferences = Preferences()
+ self.set_orientation(Gtk.Orientation.VERTICAL)
+
+ self._preferences = Preferences()
scrolled = Gtk.ScrolledWindow()
scrolled.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
scrolled.set_shadow_type(Gtk.ShadowType.NONE)
- self.__box = Gtk.VBox()
- scrolled.add_with_viewport(self.__box)
+ self._box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
+ self._box.set_vexpand(True)
+ scrolled.add_with_viewport(self._box)
self.add(scrolled)
self.show_all()
- self.__load_collection(SymbolCollection())
+ self._load_collection(SymbolCollection())
+
+ def get_label(self):
+ return _("Symbols")
- def __load_collection(self, collection):
- self.__expanded_groups = set(self.__preferences.get("expanded-symbol-groups", "").split(","))
+ def get_icon(self):
+ return Gtk.Image.new_from_stock(Gtk.STOCK_INDEX,Gtk.IconSize.MENU)
+
+ def _load_collection(self, collection):
+ self._expanded_groups = set(self._preferences.get("expanded-symbol-groups", "").split(","))
for group in collection.groups:
- self.__add_group(group)
+ self._add_group(group)
- def __add_group(self, group):
+ def _add_group(self, group):
model = Gtk.ListStore(GdkPixbuf.Pixbuf, str, object) # icon, tooltip, Template
for symbol in group.symbols:
@@ -123,7 +129,7 @@ class LaTeXSymbolMapView(SideView):
view = Gtk.IconView(model=model)
view.set_pixbuf_column(0)
view.set_selection_mode(Gtk.SelectionMode.SINGLE)
- view.connect("selection-changed", self.__on_symbol_selected)
+ view.connect("selection-changed", self._on_symbol_selected)
view.set_item_width(-1)
view.set_spacing(0)
view.set_column_spacing(0)
@@ -139,25 +145,25 @@ class LaTeXSymbolMapView(SideView):
expander.add(view)
expander.show_all()
- if group.label in self.__expanded_groups:
+ if group.label in self._expanded_groups:
expander.set_expanded(True)
- expander.connect("notify::expanded", self.__on_group_expanded, group.label)
+ expander.connect("notify::expanded", self._on_group_expanded, group.label)
- self.__box.pack_start(expander, False, False, 0)
+ self._box.pack_start(expander, False, False, 0)
- def __on_group_expanded(self, expander, paramSpec, group_label):
+ def _on_group_expanded(self, expander, paramSpec, group_label):
"""
The Expander for a symbol group has been expanded
"""
if expander.get_expanded():
- self.__expanded_groups.add(group_label)
+ self._expanded_groups.add(group_label)
else:
- self.__expanded_groups.remove(group_label)
+ self._expanded_groups.remove(group_label)
- self.__preferences.set("expanded-symbol-groups", ",".join(self.__expanded_groups))
+ self._preferences.set("expanded-symbol-groups", ",".join(self._expanded_groups))
- def __on_symbol_selected(self, icon_view):
+ def _on_symbol_selected(self, icon_view):
"""
A symbol has been selected
@@ -167,7 +173,7 @@ class LaTeXSymbolMapView(SideView):
path = icon_view.get_selected_items()[0]
template = icon_view.get_model()[path][2]
- self.__context.active_editor.insert(template)
+ self._context.active_editor.insert(template)
icon_view.unselect_all()
except IndexError:
@@ -188,22 +194,10 @@ class LaTeXOutlineView(BaseOutlineView):
_log = getLogger("LaTeXOutlineView")
- label = _("Outline")
- scope = View.SCOPE_EDITOR
-
def __init__(self, context, editor):
BaseOutlineView.__init__(self, context, editor)
self._handlers = {}
- @property
- def icon(self):
- image = Gtk.Image()
- image.set_from_file(Resources().get_icon("outline.png"))
- return image
-
- def init(self, context):
- BaseOutlineView.init(self, context)
-
self._offset_map = OutlineOffsetMap()
# additional toolbar buttons
@@ -223,14 +217,14 @@ class LaTeXOutlineView(BaseOutlineView):
self._handlers[btn_graphics] = btn_graphics.connect("toggled", self._on_graphics_toggled)
self._handlers[btn_tables] = btn_tables.connect("toggled", self._on_tables_toggled)
+ self.show_all()
+
def set_outline(self, outline):
"""
Load a new outline model
"""
self._log.debug("set_outline")
- self.assure_init()
-
self._save_state()
self._offset_map = OutlineOffsetMap()
@@ -299,11 +293,6 @@ class LaTeXOutlineView(BaseOutlineView):
# self.trigger("graphicsToggled", value)
Preferences().set("outline-show-graphics", value)
- def destroy(self):
- for obj in self._handlers:
- obj.disconnect(self._handlers[obj])
- BaseOutlineView.destroy(self)
-
from os.path import basename
diff --git a/latex/outline.py b/latex/outline.py
index 3041f68..f781f6e 100644
--- a/latex/outline.py
+++ b/latex/outline.py
@@ -27,52 +27,40 @@ 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 View, SideView
+from base import PanelView
from preferences import Preferences
from base.resources import Resources
+from gldefs import _
-
-class BaseOutlineView(SideView):
+class BaseOutlineView(PanelView):
"""
Base class for the BibTeX and LaTeX outline views
"""
__log = getLogger("BaseOutlineView")
- label = "Outline"
- scope = View.SCOPE_EDITOR
-
def __init__(self, context, editor):
- SideView.__init__(self, context)
+ PanelView.__init__(self, context)
self._editor = editor
self._base_handlers = {}
- @property
- def icon(self):
- image = Gtk.Image()
- image.set_from_file(Resources().get_icon("outline.png"))
- return image
-
- def init(self, context):
- self._log.debug("init")
-
- self._context = context
+ self.set_orientation(Gtk.Orientation.VERTICAL)
self._preferences = Preferences()
# toolbar
btn_follow = Gtk.ToggleToolButton.new_from_stock(Gtk.STOCK_CONNECT)
- btn_follow.set_tooltip_text("Follow Editor")
+ btn_follow.set_tooltip_text(_("Follow Editor"))
btn_follow.set_active(self._preferences.get_bool("outline-connect-to-editor"))
self._base_handlers[btn_follow] = btn_follow.connect("toggled", self._on_follow_toggled)
btn_expand = Gtk.ToolButton.new_from_stock(Gtk.STOCK_ZOOM_IN)
- btn_expand.set_tooltip_text("Expand All")
+ btn_expand.set_tooltip_text(_("Expand All"))
self._base_handlers[btn_expand] = btn_expand.connect("clicked", self._on_expand_clicked)
btn_collapse = Gtk.ToolButton.new_from_stock(Gtk.STOCK_ZOOM_OUT)
- btn_collapse.set_tooltip_text("Collapse All")
+ btn_collapse.set_tooltip_text(_("Collapse All"))
self._base_handlers[btn_collapse] = btn_collapse.connect("clicked", self._on_collapse_clicked)
self._toolbar = Gtk.Toolbar()
@@ -114,18 +102,17 @@ class BaseOutlineView(SideView):
self.pack_start(scrolled, True, True, 0)
- # theme like gtk3
- ctx = scrolled.get_style_context()
- ctx.set_junction_sides(Gtk.JunctionSides.TOP)
-
- ctx = self._toolbar.get_style_context()
- ctx.set_junction_sides(Gtk.JunctionSides.TOP | Gtk.JunctionSides.BOTTOM)
- ctx.add_class("inline-toolbar")
-
# this holds a list of the currently expanded paths
self._expandedPaths = None
- self.show_all()
+ def get_label(self):
+ return _("Outline")
+
+ def get_icon(self):
+ return Gtk.Image.new_from_file(Resources().get_icon("outline.png"))
+
+ def get_scope(self):
+ return self.SCOPE_EDITOR
def _on_follow_toggled(self, toggle_button):
value = toggle_button.get_active()
@@ -143,8 +130,6 @@ class BaseOutlineView(SideView):
Called by the Editor
"""
- self.assure_init()
-
try:
path = self._offset_map.lookup(offset)
self._select_path(path)
@@ -226,13 +211,6 @@ class BaseOutlineView(SideView):
To be overridden
"""
- def destroy(self):
- self._view.disconnect(self._cursor_changed_id)
- for obj in self._base_handlers:
- obj.disconnect(self._base_handlers[obj])
- del self._editor
- SideView.destroy(self)
-
class Item(object):
def __init__(self, key, value):
@@ -334,5 +312,4 @@ class OutlineOffsetMap(object):
s += "\n</OutlineOffsetMap>"
return s
-
# ex:ts=4:et:
diff --git a/latex/tools/views.py b/latex/tools/views.py
index 99e60dc..7f5f5d4 100644
--- a/latex/tools/views.py
+++ b/latex/tools/views.py
@@ -27,24 +27,21 @@ from logging import getLogger
from gi.repository import Gtk, GdkPixbuf
from ..base.resources import Resources
-from ..base import View, BottomView
+from ..base import PanelView
from ..issues import Issue, IStructuredIssueHandler
from ..gldefs import _
-class ToolView(BottomView, IStructuredIssueHandler):
+class ToolView(PanelView, IStructuredIssueHandler):
"""
"""
_log = getLogger("ToolView")
- label = _("Tools")
- icon = Gtk.Image.new_from_stock(Gtk.STOCK_CONVERT, Gtk.IconSize.MENU)
- scope = View.SCOPE_WINDOW
-
def __init__(self, context):
- BottomView.__init__(self, context)
+ PanelView.__init__(self, context)
self._handlers = {}
+
self._ICON_RUN = GdkPixbuf.Pixbuf.new_from_file(Resources().get_icon("run.png"))
self._ICON_FAIL = GdkPixbuf.Pixbuf.new_from_file(Resources().get_icon("error.png"))
self._ICON_SUCCESS = GdkPixbuf.Pixbuf.new_from_file(Resources().get_icon("okay.png"))
@@ -52,11 +49,6 @@ class ToolView(BottomView, IStructuredIssueHandler):
self._ICON_WARNING = GdkPixbuf.Pixbuf.new_from_file(Resources().get_icon("warning.png"))
self._ICON_ABORT = GdkPixbuf.Pixbuf.new_from_file(Resources().get_icon("abort.png"))
- def init(self, context):
- self._log.debug("init")
-
- self._context = context
-
self._scroll = Gtk.ScrolledWindow()
self._scroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
self._scroll.set_shadow_type(Gtk.ShadowType.IN)
@@ -114,6 +106,13 @@ class ToolView(BottomView, IStructuredIssueHandler):
ctx.set_junction_sides(Gtk.JunctionSides.LEFT | Gtk.JunctionSides.RIGHT)
ctx.add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR)
+ self.show_all()
+
+ def get_label(self):
+ return _("Tools")
+
+ def get_icon(self):
+ return Gtk.Image.new_from_stock(Gtk.STOCK_CONVERT, Gtk.IconSize.MENU)
def _on_abort_clicked(self, button):
self._abort_method.__call__()
@@ -191,10 +190,4 @@ class ToolView(BottomView, IStructuredIssueHandler):
self._view.expand_all()
- def destroy(self):
- for obj in self._handlers:
- obj.disconnect(self._handlers[obj])
- BottomView.destroy(self)
-
-
# ex:ts=4:et:
diff --git a/latex/views.py b/latex/views.py
index ee01e87..2457d37 100644
--- a/latex/views.py
+++ b/latex/views.py
@@ -27,37 +27,30 @@ from logging import getLogger
from preferences import Preferences
from base.resources import Resources
-from base import View, BottomView
+from base import PanelView
from issues import Issue
from util import escape
from gldefs import _
-class IssueView(BottomView):
+class IssueView(PanelView):
"""
"""
_log = getLogger("IssueView")
- label = _("Issues")
- icon = Gtk.Image.new_from_stock(Gtk.STOCK_DIALOG_INFO, Gtk.IconSize.MENU)
- scope = View.SCOPE_EDITOR
-
def __init__(self, context, editor):
- BottomView.__init__(self, context)
- self._editor = editor
- self._handlers = {}
-
- def init(self, context):
+ PanelView.__init__(self, context)
self._log.debug("init")
+ self._editor = editor
+ self._handlers = {}
self._preferences = Preferences()
+
self._preferences.connect("preferences-changed", self._on_preferences_changed)
self._show_tasks = self._preferences.get_bool("issues-show-tasks")
self._show_warnings = self._preferences.get_bool("issues-show-warnings")
- self._context = context
-
self._icons = { Issue.SEVERITY_WARNING : GdkPixbuf.Pixbuf.new_from_file(Resources().get_icon("warning.png")),
Issue.SEVERITY_ERROR : GdkPixbuf.Pixbuf.new_from_file(Resources().get_icon("error.png")),
Issue.SEVERITY_INFO : None,
@@ -97,7 +90,6 @@ class IssueView(BottomView):
self.pack_start(self._scr, True, True, 0)
# toolbar
-
self._button_warnings = Gtk.ToggleToolButton()
self._button_warnings.set_tooltip_text(_("Show/Hide Warnings"))
image = Gtk.Image()
@@ -133,8 +125,19 @@ class IssueView(BottomView):
self._issues = []
+ self.show_all()
+
self._log.debug("init finished")
+ def get_label(self):
+ return _("Issues")
+
+ def get_icon(self):
+ return Gtk.Image.new_from_stock(Gtk.STOCK_DIALOG_INFO, Gtk.IconSize.MENU)
+
+ def get_scope(self):
+ return self.SCOPE_EDITOR
+
def _on_row_activated(self, view, path, column):
"""
A row has been double-clicked on
@@ -153,7 +156,7 @@ class IssueView(BottomView):
# update filter
self._store.clear()
for issue, local in self._issues:
- self.__append_issue_filtered(issue, local)
+ self._append_issue_filtered(issue, local)
def __on_tasks_toggled(self, togglebutton):
self._show_tasks = togglebutton.get_active()
@@ -167,7 +170,6 @@ class IssueView(BottomView):
"""
Remove all issues from the view
"""
- self.assure_init()
self._store.clear()
self._issues = []
@@ -178,21 +180,20 @@ class IssueView(BottomView):
@param issue: the Issue object
@param local: indicates whether the Issue occured in the edited file or not
"""
- self.assure_init()
self._issues.append((issue, local))
- self.__append_issue_filtered(issue, local)
+ self._append_issue_filtered(issue, local)
- def __append_issue_filtered(self, issue, local):
+ def _append_issue_filtered(self, issue, local):
if issue.severity == Issue.SEVERITY_WARNING:
if self._show_warnings:
- self.__do_append_issue(issue, local)
+ self._do_append_issue(issue, local)
elif issue.severity == Issue.SEVERITY_TASK:
if self._show_tasks:
- self.__do_append_issue(issue, local)
+ self._do_append_issue(issue, local)
else:
- self.__do_append_issue(issue, local)
+ self._do_append_issue(issue, local)
- def __do_append_issue(self, issue, local):
+ def _do_append_issue(self, issue, local):
if local:
message = issue.message
filename = escape(issue.file.basename)
@@ -201,11 +202,4 @@ class IssueView(BottomView):
filename = "<span color='%s'>%s</span>" % (self._preferences.get("light-foreground-color"), issue.file.basename)
self._store.append([self._icons[issue.severity], message, filename, issue])
- def destroy(self):
- del self._editor
- for obj in self._handlers:
- obj.disconnect(self._handlers[obj])
- BottomView.destroy(self)
-
-
# ex:ts=4:et:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]