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