-
Notifications
You must be signed in to change notification settings - Fork 0
/
search_panel.py
95 lines (73 loc) · 2.84 KB
/
search_panel.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
__author__ = 'joaquin'
import sys
import wx
import wx.lib.mixins.listctrl as listmix
class EditListCtrl(wx.ListCtrl,
listmix.ListCtrlAutoWidthMixin):
def __init__(self, parent, id_, pos=wx.DefaultPosition,
size=wx.DefaultSize, style=0):
wx.ListCtrl.__init__(self, parent, id_, pos, size, style)
listmix.ListCtrlAutoWidthMixin.__init__(self)
# for normal, simple columns, you can add them like this:
for column in range(8):
self.InsertColumn(column, "Column %i" % column)
for row in range(5):
newrow = self.InsertStringItem(sys.maxint, '.')
for column in range(8):
self.SetStringItem(newrow, column, '.')
# self.SetColumnWidth(0, wx.LIST_AUTOSIZE)
def fill_line(self, row, data):
for column, item in enumerate(data):
self.SetStringItem(row, column, item)
class EditListCtrlPanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1, style=wx.WANTS_CHARS)
new_id = wx.NewId()
sizer = wx.BoxSizer(wx.VERTICAL)
self.list = EditListCtrl(self, new_id,
style=wx.LC_REPORT
| wx.BORDER_NONE
| wx.LC_VRULES
| wx.LC_HRULES
)
sizer.Add(self.list, 1, wx.EXPAND)
self.SetSizer(sizer)
self.SetAutoLayout(True)
class DummyFrame(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: MyFrame.__init__
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.button_1 = wx.Button(self, -1, "connect")
self.tune = EditListCtrlPanel(self)
self.__set_properties()
self.__do_layout()
self.Bind(wx.EVT_BUTTON, self.on_connect, self.button_1)
def __set_properties(self):
# begin wxGlade: MyFrame.__set_properties
self.SetMinSize((700, 200))
self.SetTitle("Test Frame")
# end wxGlade
def __do_layout(self):
# begin wxGlade: MyFrame.__do_layout
sizer_1 = wx.BoxSizer(wx.VERTICAL)
sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
sizer_2.Add(self.button_1, 0, 0, 0)
sizer_2.Add(self.tune, 1, wx.EXPAND, 0)
sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
self.SetSizer(sizer_1)
sizer_1.Fit(self)
self.Layout()
# noinspection PyMethodMayBeStatic,PyUnusedLocal
def on_connect(self, evt):
print 'connect'
if __name__ == '__main__':
print 'hello'
app = wx.PySimpleApp(0)
wx.InitAllImageHandlers()
frame_1 = DummyFrame(None, -1, "")
# noinspection PyUnresolvedReferences
app.SetTopWindow(frame_1)
frame_1.Show()
# noinspection PyUnresolvedReferences
app.MainLoop()