1 # Copyright (C) 2010-2012 W. Trevor King <wking@drexel.edu>
3 # This file is part of Hooke.
5 # Hooke is free software: you can redistribute it and/or modify it
6 # under the terms of the GNU Lesser General Public License as
7 # published by the Free Software Foundation, either version 3 of the
8 # License, or (at your option) any later version.
10 # Hooke is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
13 # Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with Hooke. If not, see
17 # <http://www.gnu.org/licenses/>.
19 """The `panel` module provides optional submodules that add GUI panels.
22 from ....util.pluggable import IsSubclass, construct_odict
36 """List of panel modules. TODO: autodiscovery
40 """Base class for Hooke GUI panels.
42 :attr:`name` identifies the request type and should match the
45 def __init__(self, name=None, callbacks=None, **kwargs):
46 super(Panel, self).__init__(**kwargs)
48 self.managed_name = name.capitalize()
49 self._hooke_frame = kwargs.get('parent', None)
52 self._callbacks = callbacks
55 PANELS = construct_odict(
56 this_modname=__name__,
57 submodnames=PANEL_MODULES,
58 class_selector=IsSubclass(Panel, blacklist=[Panel]),
60 """:class:`hooke.compat.odict.odict` of :class:`Panel`
61 instances keyed by `.name`.