1 # Copyright (C) 2010-2012 W. Trevor King <wking@tremily.us>
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/>.
21 class StringPopup (wx.Dialog):
24 'text': wx.StaticText(
25 parent=self, label=message, style=wx.ALIGN_CENTRE),
26 'button': wx.Button(parent=self, id=button_id),
27 'cancel': wx.Button(self, wx.ID_CANCEL),
29 size = wx.Size(175, 200)
30 if selection_style == 'single':
31 self._c['listbox'] = wx.ListBox(
32 parent=self, size=size, list=options)
34 self._c['listbox'].SetSelection(default)
36 assert selection_style == 'multiple', selection_style
37 self._c['listbox'] = wx.CheckListBox(
38 parent=self, size=size, list=options)
40 self._c['listbox'].Check(default)
41 self.Bind(wx.EVT_BUTTON, self.button, self._c['button'])
42 self.Bind(wx.EVT_BUTTON, self.cancel, self._c['cancel'])
46 b = wx.BoxSizer(wx.HORIZONTAL)
47 b.Add(window=self._c['button'],
48 flag=wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL,
50 b.Add(window=self._c['cancel'],
51 flag=wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL,
54 v = wx.BoxSizer(wx.VERTICAL)
55 v.Add(window=self._c['text'],
56 flag=wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL,
58 v.Add(window=self._c['listbox'],
60 flag=wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.ALL,
62 v.Add(window=wx.StaticLine(
63 parent=self, size=(20,-1), style=wx.LI_HORIZONTAL),
67 flag=wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_CENTER_HORIZONTAL|wx.ALL,