1 # Copyright (C) 2010-2011 Rolf Schmidt <rschmidt@alcor.concordia.ca>
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 """Note panel for Hooke.
25 from ....util.callback import callback, in_callback
29 class NotePanel (Panel, wx.Panel):
30 def __init__(self, callbacks=None, **kwargs):
31 super(NotePanel, self).__init__(
32 name='note', callbacks=callbacks, **kwargs)
35 'editor': wx.TextCtrl(
37 style=wx.TE_MULTILINE),
42 sizer = wx.BoxSizer(wx.VERTICAL)
43 sizer.Add(self._c['editor'], 1, wx.EXPAND)
44 sizer.Add(self._c['update'], 0, wx.EXPAND)
46 self.SetAutoLayout(True)
48 self.Bind(wx.EVT_BUTTON, self._on_update)
50 def set_text(self, text):
51 self._c['editor'].SetValue(text)
53 def _on_update(self, event):
54 text = self._c['editor'].GetValue()
55 in_callback(self, text)