1
#Boa:FramePanel:PathsPanel
3
from wxPython.wx import *
4
from wxPython.grid import *
6
[wxID_PATHSPANEL, wxID_PATHSPANELADD_BTN, wxID_PATHSPANELGRID,
7
wxID_PATHSPANELREMOVE_BTN, wxID_PATHSPANELSTATICBOX1,
8
] = map(lambda _init_ctrls: wxNewId(), range(5))
10
class PathsPanel(wxPanel):
11
def _init_coll_staticBoxSizer1_Items(self, parent):
12
# generated method, don't edit
14
parent.AddWindow(self.grid, 1, border=8, flag=wxALL | wxGROW)
15
parent.AddSizer(self.boxSizer1, 0, border=0, flag=wxALIGN_RIGHT)
17
def _init_coll_boxSizer1_Items(self, parent):
18
# generated method, don't edit
20
parent.AddWindow(self.add_btn, 0, border=8, flag=wxALL | wxALIGN_RIGHT)
21
parent.AddWindow(self.remove_btn, 0, border=8,
22
flag=wxBOTTOM | wxTOP | wxRIGHT)
24
def _init_sizers(self):
25
# generated method, don't edit
26
self.staticBoxSizer1 = wxStaticBoxSizer(box=self.staticBox1,
29
self.boxSizer1 = wxBoxSizer(orient=wxHORIZONTAL)
31
self._init_coll_staticBoxSizer1_Items(self.staticBoxSizer1)
32
self._init_coll_boxSizer1_Items(self.boxSizer1)
34
self.SetSizer(self.staticBoxSizer1)
36
def _init_ctrls(self, prnt):
37
# generated method, don't edit
38
wxPanel.__init__(self, id=wxID_PATHSPANEL, name='PathsPanel',
39
parent=prnt, pos=wxPoint(316, 277), size=wxSize(523, 274),
40
style=wxTAB_TRAVERSAL)
41
self.SetClientSize(wxSize(515, 247))
43
self.staticBox1 = wxStaticBox(id=wxID_PATHSPANELSTATICBOX1,
44
label='Sever to client filepath mappings', name='staticBox1',
45
parent=self, pos=wxPoint(0, 0), size=wxSize(515, 247), style=0)
47
self.grid = wxGrid(id=wxID_PATHSPANELGRID, name='grid', parent=self,
48
pos=wxPoint(13, 21), size=wxSize(489, 173),
49
style=wxSUNKEN_BORDER)
50
self.grid.SetDefaultRowSize(20)
51
self.grid.SetColLabelSize(20)
52
self.grid.SetRowLabelSize(0)
54
self.add_btn = wxButton(id=wxID_PATHSPANELADD_BTN, label='Add',
55
name='add_btn', parent=self, pos=wxPoint(344, 210),
56
size=wxSize(75, 24), style=0)
57
EVT_BUTTON(self.add_btn, wxID_PATHSPANELADD_BTN, self.OnAdd_btnButton)
59
self.remove_btn = wxButton(id=wxID_PATHSPANELREMOVE_BTN, label='Remove',
60
name='remove_btn', parent=self, pos=wxPoint(427, 210),
61
size=wxSize(75, 24), style=0)
62
EVT_BUTTON(self.remove_btn, wxID_PATHSPANELREMOVE_BTN,
63
self.OnRemove_btnButton)
67
def __init__(self, parent, id, pos, size, style, name):
68
self._init_ctrls(parent)
70
self.SetDimensions(pos.x, pos.y, size.x, size.y)
72
def init_paths(self, paths):
74
numRows = len(self.paths)
75
self.grid.CreateGrid(numRows, 2)
76
self.grid.SetColLabelValue(0, 'Map server filenames starting with')
77
self.grid.SetColLabelValue(1, 'To client filenames starting with')
78
colWidth = self.grid.GetClientSize().x/2
79
self.grid.SetColSize(0, colWidth)
80
self.grid.SetColSize(1, colWidth)
82
for row, (svr, clnt) in zip(range(numRows), self.paths):
83
self.grid.SetCellValue(row, 0, svr)
84
self.grid.SetCellValue(row, 1, clnt)
85
self.grid.ForceRefresh()
88
self.grid.SaveEditControlValue()
89
return [(self.grid.GetCellValue(row, 0), self.grid.GetCellValue(row, 1))
90
for row in range(self.grid.GetNumberRows())]
92
def OnAdd_btnButton(self, event):
93
self.grid.AppendRows(1)
95
def OnRemove_btnButton(self, event):
96
row = self.grid.GetGridCursorRow()
98
self.grid.DeleteRows(row, 1)
1
#Boa:FramePanel:PathsPanel
6
[wxID_PATHSPANEL, wxID_PATHSPANELADD_BTN, wxID_PATHSPANELGRID,
7
wxID_PATHSPANELREMOVE_BTN, wxID_PATHSPANELSTATICBOX1,
8
] = [wx.NewId() for _init_ctrls in range(5)]
10
class PathsPanel(wx.Panel):
11
def _init_coll_staticBoxSizer1_Items(self, parent):
12
# generated method, don't edit
14
parent.AddWindow(self.grid, 1, border=8, flag=wx.ALL | wx.GROW)
15
parent.AddSizer(self.boxSizer1, 0, border=0, flag=wx.ALIGN_RIGHT)
17
def _init_coll_boxSizer1_Items(self, parent):
18
# generated method, don't edit
20
parent.AddWindow(self.add_btn, 0, border=8,
21
flag=wx.ALL | wx.ALIGN_RIGHT)
22
parent.AddWindow(self.remove_btn, 0, border=8,
23
flag=wx.BOTTOM | wx.TOP | wx.RIGHT)
25
def _init_sizers(self):
26
# generated method, don't edit
27
self.staticBoxSizer1 = wx.StaticBoxSizer(box=self.staticBox1,
30
self.boxSizer1 = wx.BoxSizer(orient=wx.HORIZONTAL)
32
self._init_coll_staticBoxSizer1_Items(self.staticBoxSizer1)
33
self._init_coll_boxSizer1_Items(self.boxSizer1)
35
self.SetSizer(self.staticBoxSizer1)
37
def _init_ctrls(self, prnt):
38
# generated method, don't edit
39
wx.Panel.__init__(self, id=wxID_PATHSPANEL, name='PathsPanel',
40
parent=prnt, pos=wx.Point(316, 277), size=wx.Size(523, 274),
41
style=wx.TAB_TRAVERSAL)
42
self.SetClientSize(wx.Size(515, 247))
44
self.staticBox1 = wx.StaticBox(id=wxID_PATHSPANELSTATICBOX1,
45
label='Sever to client filepath mappings', name='staticBox1',
46
parent=self, pos=wx.Point(0, 0), size=wx.Size(515, 247), style=0)
48
self.grid = wx.grid.Grid(id=wxID_PATHSPANELGRID, name='grid',
49
parent=self, pos=wx.Point(13, 25), size=wx.Size(489, 169),
50
style=wx.SUNKEN_BORDER)
51
self.grid.SetDefaultRowSize(20)
52
self.grid.SetColLabelSize(20)
53
self.grid.SetRowLabelSize(0)
55
self.add_btn = wx.Button(id=wxID_PATHSPANELADD_BTN, label='Add',
56
name='add_btn', parent=self, pos=wx.Point(344, 210),
57
size=wx.Size(75, 24), style=0)
58
self.add_btn.Bind(wx.EVT_BUTTON, self.OnAdd_btnButton,
59
id=wxID_PATHSPANELADD_BTN)
61
self.remove_btn = wx.Button(id=wxID_PATHSPANELREMOVE_BTN,
62
label='Remove', name='remove_btn', parent=self, pos=wx.Point(427,
63
210), size=wx.Size(75, 24), style=0)
64
self.remove_btn.Bind(wx.EVT_BUTTON, self.OnRemove_btnButton,
65
id=wxID_PATHSPANELREMOVE_BTN)
69
def __init__(self, parent, id, pos, size, style, name):
70
self._init_ctrls(parent)
72
self.SetDimensions(pos.x, pos.y, size.x, size.y)
74
def init_paths(self, paths):
76
numRows = len(self.paths)
77
self.grid.CreateGrid(numRows, 2)
78
self.grid.SetColLabelValue(0, 'Map server filenames starting with')
79
self.grid.SetColLabelValue(1, 'To client filenames starting with')
80
colWidth = self.grid.GetClientSize().x/2
81
self.grid.SetColSize(0, colWidth)
82
self.grid.SetColSize(1, colWidth)
84
for row, (svr, clnt) in zip(range(numRows), self.paths):
85
self.grid.SetCellValue(row, 0, svr)
86
self.grid.SetCellValue(row, 1, clnt)
87
self.grid.ForceRefresh()
90
self.grid.SaveEditControlValue()
91
return [(self.grid.GetCellValue(row, 0), self.grid.GetCellValue(row, 1))
92
for row in range(self.grid.GetNumberRows())]
94
def OnAdd_btnButton(self, event):
95
self.grid.AppendRows(1)
97
def OnRemove_btnButton(self, event):
98
row = self.grid.GetGridCursorRow()
100
self.grid.DeleteRows(row, 1)