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 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 """Note panel for Hooke.
23 from ....util.callback import callback, in_callback
27 class NotePanel (Panel, wx.Panel):
28 def __init__(self, callbacks=None, **kwargs):
29 super(NotePanel, self).__init__(
30 name='note', callbacks=callbacks, **kwargs)
33 'editor': wx.TextCtrl(
35 style=wx.TE_MULTILINE),
40 sizer = wx.BoxSizer(wx.VERTICAL)
41 sizer.Add(self._c['editor'], 1, wx.EXPAND)
42 sizer.Add(self._c['update'], 0, wx.EXPAND)
44 self.SetAutoLayout(True)
46 self.Bind(wx.EVT_BUTTON, self._on_update)
48 def set_text(self, text):
49 self._c['editor'].SetValue(text)
51 def _on_update(self, event):
52 text = self._c['editor'].GetValue()
53 in_callback(self, text)