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
38 """List of panel modules. TODO: autodiscovery
42 """Base class for Hooke GUI panels.
44 :attr:`name` identifies the request type and should match the
47 def __init__(self, name=None, callbacks=None, **kwargs):
48 super(Panel, self).__init__(**kwargs)
50 self.managed_name = name.capitalize()
51 self._hooke_frame = kwargs.get('parent', None)
54 self._callbacks = callbacks
57 PANELS = construct_odict(
58 this_modname=__name__,
59 submodnames=PANEL_MODULES,
60 class_selector=IsSubclass(Panel, blacklist=[Panel]),
62 """:class:`hooke.compat.odict.odict` of :class:`Panel`
63 instances keyed by `.name`.