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
6 # under the terms of the GNU Lesser General Public License as
7 # published by the Free Software Foundation, either version 3 of the
8 # License, or (at your option) any later version.
10 # Hooke is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
13 # Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with Hooke. If not, see
17 # <http://www.gnu.org/licenses/>.
22 class StringPopup (wx.Dialog):
25 'text': wx.StaticText(
26 parent=self, label=message, style=wx.ALIGN_CENTRE),
27 'button': wx.Button(parent=self, id=button_id),
28 'cancel': wx.Button(self, wx.ID_CANCEL),
30 size = wx.Size(175, 200)
31 if selection_style == 'single':
32 self._c['listbox'] = wx.ListBox(
33 parent=self, size=size, list=options)
35 self._c['listbox'].SetSelection(default)
37 assert selection_style == 'multiple', selection_style
38 self._c['listbox'] = wx.CheckListBox(
39 parent=self, size=size, list=options)
41 self._c['listbox'].Check(default)
42 self.Bind(wx.EVT_BUTTON, self.button, self._c['button'])
43 self.Bind(wx.EVT_BUTTON, self.cancel, self._c['cancel'])
47 b = wx.BoxSizer(wx.HORIZONTAL)
48 b.Add(window=self._c['button'],
49 flag=wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL,
51 b.Add(window=self._c['cancel'],
52 flag=wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL,
55 v = wx.BoxSizer(wx.VERTICAL)
56 v.Add(window=self._c['text'],
57 flag=wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL,
59 v.Add(window=self._c['listbox'],
61 flag=wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL,
63 v.Add(window=wx.StaticLine(
64 parent=self, size=(20,-1), style=wx.LI_HORIZONTAL),
68 flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_CENTER_HORIZONTAL|wx.ALL,