Remove 'results' panel from GUI. Use 'block info' instead.
[hooke.git] / hooke / ui / gui / panel / __init__.py
index c5a77e655c59a8d094f7638a8b8a1923937834d1..a63ee461581c98811cc7b82441ce8b3e9ac13a3c 100644 (file)
@@ -1,12 +1,63 @@
-# Copyright\r
-\r
-from . import commands as commands\r
-from . import note as note\r
-from . import playlist as playlist\r
-from . import plot as plot\r
-#from . import propertyeditor as propertyeditor\r
-from . import results as results\r
-from . import selection as selection\r
-\r
-__all__ = [commands, note, playlist, plot, #propertyeditor,\r
-           results, selection]\r
+# Copyright (C) 2010 Massimo Sandal <devicerandom@gmail.com>
+#                    W. Trevor King <wking@drexel.edu>
+#
+# This file is part of Hooke.
+#
+# Hooke is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# Hooke 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 Lesser General
+# Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with Hooke.  If not, see
+# <http://www.gnu.org/licenses/>.
+
+"""The `panel` module provides optional submodules that add GUI panels.
+"""
+
+from ....util.pluggable import IsSubclass, construct_odict
+
+
+PANEL_MODULES = [
+    'commands',
+    'note',
+#    'notebook',
+    'output',
+    'playlist',
+    'plot',
+    'propertyeditor',
+#    'selection',
+#    'welcome',
+    ]
+"""List of panel modules.  TODO: autodiscovery
+"""
+
+class Panel (object):
+    """Base class for Hooke GUI panels.
+    
+    :attr:`name` identifies the request type and should match the
+    module name.
+    """
+    def __init__(self, name=None, callbacks=None, **kwargs):
+        super(Panel, self).__init__(**kwargs)
+        self.name = name
+        self.managed_name = name.capitalize()
+        self._hooke_frame = kwargs.get('parent', None)
+        if callbacks == None:
+            callbacks = {}
+        self._callbacks = callbacks
+
+
+PANELS = construct_odict(
+    this_modname=__name__,
+    submodnames=PANEL_MODULES,
+    class_selector=IsSubclass(Panel, blacklist=[Panel]),
+    instantiate=False)
+""":class:`hooke.compat.odict.odict` of :class:`Panel`
+instances keyed by `.name`.
+"""