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