1 | ################################################################################ |
---|
2 | #This software was developed by the University of Tennessee as part of the |
---|
3 | #Distributed Data Analysis of Neutron Scattering Experiments (DANSE) |
---|
4 | #project funded by the US National Science Foundation. |
---|
5 | # |
---|
6 | #See the license text in license.txt |
---|
7 | # |
---|
8 | #copyright 2010, University of Tennessee |
---|
9 | ################################################################################ |
---|
10 | """ |
---|
11 | This module provides Graphic interface for the data_manager module. |
---|
12 | """ |
---|
13 | import wx |
---|
14 | import sys |
---|
15 | #import warnings |
---|
16 | from wx.lib.scrolledpanel import ScrolledPanel |
---|
17 | import wx.lib.mixins.listctrl as listmix |
---|
18 | #from sans.guicomm.events import NewPlotEvent |
---|
19 | |
---|
20 | class CheckListCtrl(wx.ListCtrl, listmix.CheckListCtrlMixin, |
---|
21 | listmix.ListCtrlAutoWidthMixin): |
---|
22 | """ |
---|
23 | Check list control to be used for Data Panel |
---|
24 | """ |
---|
25 | def __init__(self, parent, *args, **kwds): |
---|
26 | kwds['style'] = wx.LC_REPORT|wx.SUNKEN_BORDER |
---|
27 | wx.ListCtrl.__init__(self, parent, -1, *args, **kwds) |
---|
28 | listmix.CheckListCtrlMixin.__init__(self) |
---|
29 | listmix.ListCtrlAutoWidthMixin.__init__(self) |
---|
30 | |
---|
31 | class DataPanel(ScrolledPanel): |
---|
32 | """ |
---|
33 | This panel displays data available in the application and widgets to |
---|
34 | interact with data. |
---|
35 | """ |
---|
36 | def __init__(self, parent, list=None, list_of_perspective=[], |
---|
37 | *args, **kwds): |
---|
38 | ScrolledPanel.__init__(self, parent=parent, *args, **kwds) |
---|
39 | self.SetupScrolling() |
---|
40 | self.parent = parent |
---|
41 | self.manager = None |
---|
42 | self.owner = None |
---|
43 | if list is None: |
---|
44 | list = [] |
---|
45 | self.list_of_data = list |
---|
46 | self.perspectives = [] |
---|
47 | #layout widgets |
---|
48 | self.sizer4 = None |
---|
49 | self.sizer5 = None |
---|
50 | self.sizer1 = None |
---|
51 | self.sizer2 = None |
---|
52 | self.sizer3 = None |
---|
53 | self.sizer4 = None |
---|
54 | self.sizer5 = None |
---|
55 | self.vbox = None |
---|
56 | self.list_ctrl = None |
---|
57 | self.boxsizer_2_2 = None |
---|
58 | self.cb_select_data1d = None |
---|
59 | self.cb_select_data2d = None |
---|
60 | self.cb_select_all = None |
---|
61 | self.cb_theory = None |
---|
62 | self.bt_import = None |
---|
63 | self.bt_plot = None |
---|
64 | self.bt_close = None |
---|
65 | |
---|
66 | self.define_panel_structure() |
---|
67 | self.layout_list() |
---|
68 | self.layout_selection() |
---|
69 | self.layout_perspective(list_of_perspective=list_of_perspective) |
---|
70 | self.load_list() |
---|
71 | self.layout_theory() |
---|
72 | self.layout_button() |
---|
73 | |
---|
74 | def define_panel_structure(self): |
---|
75 | """ |
---|
76 | Define the skeleton of the panel |
---|
77 | """ |
---|
78 | self.vbox = wx.BoxSizer(wx.VERTICAL) |
---|
79 | self.sizer1 = wx.BoxSizer(wx.VERTICAL) |
---|
80 | |
---|
81 | box_description_2 = wx.StaticBox(self, -1, "Selection Patterns") |
---|
82 | self.boxsizer_2 = wx.StaticBoxSizer(box_description_2, wx.HORIZONTAL) |
---|
83 | box_description_2_2 = wx.StaticBox(self, -1, "Set Active Perspective") |
---|
84 | self.boxsizer_2_2 = wx.StaticBoxSizer(box_description_2_2, |
---|
85 | wx.HORIZONTAL) |
---|
86 | |
---|
87 | w, h = self.parent.GetSize() |
---|
88 | self.sizer2 = wx.BoxSizer(wx.HORIZONTAL) |
---|
89 | self.sizer2.Add(self.boxsizer_2, 1, wx.ALL, 10) |
---|
90 | self.sizer2.Add(self.boxsizer_2_2, 1, wx.ALL, 10) |
---|
91 | |
---|
92 | box_description_3 = wx.StaticBox(self, -1, |
---|
93 | "Import to Active perspective") |
---|
94 | self.boxsizer_3 = wx.StaticBoxSizer(box_description_3, wx.HORIZONTAL) |
---|
95 | self.sizer3 = wx.BoxSizer(wx.HORIZONTAL) |
---|
96 | self.sizer3.Add(self.boxsizer_3, 1, wx.ALL, 10) |
---|
97 | |
---|
98 | self.sizer4 = wx.BoxSizer(wx.HORIZONTAL) |
---|
99 | self.sizer5 = wx.BoxSizer(wx.HORIZONTAL) |
---|
100 | self.sizer1.SetMinSize((w-10, h/3)) |
---|
101 | self.sizer2.SetMinSize((w-10, -1)) |
---|
102 | self.sizer3.SetMinSize((w-10, -1)) |
---|
103 | self.sizer4.SetMinSize((w-10, -1)) |
---|
104 | self.sizer5.SetMinSize((w-10, -1)) |
---|
105 | self.vbox.Add(self.sizer1) |
---|
106 | self.vbox.Add(self.sizer2) |
---|
107 | self.vbox.Add(self.sizer3) |
---|
108 | self.vbox.Add(wx.StaticLine(self, -1), 0, wx.EXPAND, 0) |
---|
109 | self.vbox.Add(self.sizer4) |
---|
110 | self.vbox.Add(self.sizer5) |
---|
111 | self.SetSizer(self.vbox) |
---|
112 | |
---|
113 | def GetListCtrl(self): |
---|
114 | """ |
---|
115 | """ |
---|
116 | return self.list_ctrl |
---|
117 | |
---|
118 | def layout_list(self): |
---|
119 | """ |
---|
120 | Add a listcrtl in the panel |
---|
121 | """ |
---|
122 | self.list_ctrl = CheckListCtrl(parent=self) |
---|
123 | |
---|
124 | self.list_ctrl.InsertColumn(0, 'Name') |
---|
125 | self.list_ctrl.InsertColumn(1, 'Type') |
---|
126 | self.list_ctrl.InsertColumn(2, 'Date Modified') |
---|
127 | self.sizer1.Add(self.list_ctrl, 1, wx.EXPAND|wx.ALL, 10) |
---|
128 | |
---|
129 | def layout_perspective(self, list_of_perspective=None): |
---|
130 | """ |
---|
131 | Layout widgets related to the list of plug-ins of the gui_manager |
---|
132 | """ |
---|
133 | if list_of_perspective is None: |
---|
134 | list_of_perspective = [] |
---|
135 | self.boxsizer_2_2.Clear(True) |
---|
136 | self.perspectives = [] |
---|
137 | sizer = wx.GridBagSizer(5, 5) |
---|
138 | |
---|
139 | if list_of_perspective: |
---|
140 | item = list_of_perspective[0].sub_menu |
---|
141 | rb = wx.RadioButton(self, -1, item, style=wx.RB_GROUP) |
---|
142 | rb.SetToolTipString("Data will be applied to this perspective") |
---|
143 | if hasattr(item, "set_default_perspective"): |
---|
144 | if item.set_default_perspective(): |
---|
145 | rb.SetValue(item.set_default_perspective()) |
---|
146 | self.Bind(wx.EVT_RADIOBUTTON, self.on_set_active_perspective, |
---|
147 | id=rb.GetId()) |
---|
148 | self.perspectives.append(rb) |
---|
149 | ix = 0 |
---|
150 | iy = 0 |
---|
151 | sizer.Add(rb, (iy, ix), (1, 1), |
---|
152 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10) |
---|
153 | for index in range(1, len(list_of_perspective)): |
---|
154 | item = list_of_perspective[index].sub_menu |
---|
155 | rb = wx.RadioButton(self, -1, item) |
---|
156 | rb.SetToolTipString("Data will be applied to this perspective") |
---|
157 | self.Bind(wx.EVT_RADIOBUTTON, self.on_set_active_perspective, |
---|
158 | id=rb.GetId()) |
---|
159 | self.perspectives.append(rb) |
---|
160 | iy += 1 |
---|
161 | sizer.Add(rb, (iy, ix), (1, 1), |
---|
162 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10) |
---|
163 | if hasattr(item,"set_default_perspective"): |
---|
164 | if item.set_default_perspective(): |
---|
165 | rb.SetValue(item.set_default_perspective()) |
---|
166 | else: |
---|
167 | rb = wx.RadioButton(self, -1, 'No Perspective', |
---|
168 | style=wx.RB_GROUP) |
---|
169 | rb.SetValue(True) |
---|
170 | rb.Disable() |
---|
171 | ix = 0 |
---|
172 | iy = 0 |
---|
173 | sizer.Add(rb, (iy, ix), (1, 1), |
---|
174 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10) |
---|
175 | self.boxsizer_2_2.Add(sizer) |
---|
176 | |
---|
177 | def layout_selection(self): |
---|
178 | """ |
---|
179 | Layout widgets related to selection patterns |
---|
180 | """ |
---|
181 | sizer = wx.GridBagSizer(5, 5) |
---|
182 | self.cb_select_data1d = wx.CheckBox(self, -1, |
---|
183 | "Select/Unselect Data 1D", (10, 10)) |
---|
184 | msg_data1d = "To check/uncheck to select/unselect all Data 1D" |
---|
185 | self.cb_select_data1d.SetToolTipString(msg_data1d) |
---|
186 | wx.EVT_CHECKBOX(self, self.cb_select_data1d.GetId(), |
---|
187 | self.on_select_all_data1d) |
---|
188 | self.cb_select_data2d = wx.CheckBox(self, -1, |
---|
189 | "Select/Unselect all Data 2D", (10, 10)) |
---|
190 | msg_data2d = "To check/uncheck to select/unselect all Data 2D" |
---|
191 | self.cb_select_data2d.SetToolTipString(msg_data2d) |
---|
192 | wx.EVT_CHECKBOX(self, self.cb_select_data2d.GetId(), |
---|
193 | self.on_select_all_data2d) |
---|
194 | self.cb_select_theory1d = wx.CheckBox(self, -1, |
---|
195 | "Select/Unselect all Theory 1D", (10, 10)) |
---|
196 | msg_theory1d = "To check/uncheck to select/unselect all Theory 1D" |
---|
197 | self.cb_select_theory1d.SetToolTipString(msg_theory1d) |
---|
198 | wx.EVT_CHECKBOX(self, self.cb_select_theory1d.GetId(), |
---|
199 | self.on_select_all_theory1d) |
---|
200 | self.cb_select_theory2d = wx.CheckBox(self, -1, |
---|
201 | "Select/Unselect all Theory 2D", (10, 10)) |
---|
202 | msg_theory2d = "To check/uncheck to select/unselect all Theory 2D" |
---|
203 | self.cb_select_theory2d.SetToolTipString(msg_theory2d) |
---|
204 | wx.EVT_CHECKBOX(self, self.cb_select_theory2d.GetId(), |
---|
205 | self.on_select_all_theory2d) |
---|
206 | self.cb_select_all = wx.CheckBox(self, -1, "Select/Unselect all", |
---|
207 | (10, 10)) |
---|
208 | msg_select_all = "To check/uncheck to select/unselect all" |
---|
209 | self.cb_select_all.SetToolTipString(msg_select_all) |
---|
210 | wx.EVT_CHECKBOX(self, self.cb_select_all.GetId(), self.on_select_all) |
---|
211 | iy = 0 |
---|
212 | ix = 0 |
---|
213 | sizer.Add(self.cb_select_data1d, (iy, ix), (1, 1), |
---|
214 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10) |
---|
215 | iy += 1 |
---|
216 | sizer.Add(self.cb_select_data2d, (iy, ix), (1, 1), |
---|
217 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10) |
---|
218 | iy += 1 |
---|
219 | sizer.Add(self.cb_select_theory1d, (iy, ix), (1, 1), |
---|
220 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10) |
---|
221 | iy += 1 |
---|
222 | sizer.Add( self.cb_select_theory2d, (iy, ix), (1, 1), |
---|
223 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10) |
---|
224 | iy += 1 |
---|
225 | sizer.Add(self.cb_select_all,(iy, ix), (1, 1), |
---|
226 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10) |
---|
227 | self.boxsizer_2.Add(sizer) |
---|
228 | |
---|
229 | def layout_theory(self): |
---|
230 | """ |
---|
231 | Layout widget related to theory to import |
---|
232 | """ |
---|
233 | msg = "Import the Selected Theory\n" |
---|
234 | msg += "to active perspective." |
---|
235 | st_description = wx.StaticText(self, -1, msg) |
---|
236 | self.cb_theory = wx.ComboBox(self, -1) |
---|
237 | wx.EVT_COMBOBOX(self.cb_theory,-1, self.on_select_theory) |
---|
238 | |
---|
239 | self.boxsizer_3.AddMany([(st_description, 0, wx.ALL, 10), |
---|
240 | (self.cb_theory, 0, wx.ALL, 10)]) |
---|
241 | self.load_theory(list=[]) |
---|
242 | |
---|
243 | def layout_button(self): |
---|
244 | """ |
---|
245 | Layout widgets related to buttons |
---|
246 | """ |
---|
247 | self.bt_import = wx.Button(self, wx.NewId(), "Import", (30, 10)) |
---|
248 | hint_msg = "Import set of Data to active perspective" |
---|
249 | self.bt_import.SetToolTipString(hint_msg) |
---|
250 | wx.EVT_BUTTON(self, self.bt_import.GetId(), self.on_import) |
---|
251 | |
---|
252 | self.bt_plot = wx.Button(self, wx.NewId(), "Plot", (30, 10)) |
---|
253 | self.bt_plot.SetToolTipString("To trigger plotting") |
---|
254 | wx.EVT_BUTTON(self, self.bt_plot.GetId(), self.on_plot) |
---|
255 | |
---|
256 | self.bt_close = wx.Button(self, wx.NewId(), "Close", (30, 10)) |
---|
257 | self.bt_close.SetToolTipString("close the current window") |
---|
258 | wx.EVT_BUTTON(self, self.bt_close.GetId(), self.on_close) |
---|
259 | |
---|
260 | self.sizer5.AddMany([((40, 40), 0, wx.LEFT|wx.ADJUST_MINSIZE, 180), |
---|
261 | (self.bt_import, 0, wx.ALL,5), |
---|
262 | (self.bt_plot, 0, wx.ALL,5), |
---|
263 | (self.bt_close, 0, wx.ALL, 5 )]) |
---|
264 | |
---|
265 | def set_manager(self, manager): |
---|
266 | """ |
---|
267 | :param manager: object responsible of filling on empty the listcrtl of |
---|
268 | this panel. for sansview manager is data_manager |
---|
269 | """ |
---|
270 | self.manager = manager |
---|
271 | |
---|
272 | def set_owner(self, owner): |
---|
273 | """ |
---|
274 | :param owner: is the main widget creating this frame |
---|
275 | for sansview owner is gui_manager |
---|
276 | """ |
---|
277 | self.owner = owner |
---|
278 | |
---|
279 | def load_theory(self, list=None): |
---|
280 | """ |
---|
281 | Recieve a list of theory name and fill the combobox with that list |
---|
282 | """ |
---|
283 | if list is None: |
---|
284 | list = [] |
---|
285 | for theory in list: |
---|
286 | self.cb_theory.Append(theory) |
---|
287 | if list: |
---|
288 | self.cb_theory.Enable() |
---|
289 | else: |
---|
290 | self.cb_theory.Disable() |
---|
291 | |
---|
292 | def load_list(self, list=None): |
---|
293 | """ |
---|
294 | Get a list of turple and store each string in these turples in |
---|
295 | the column of the listctrl. |
---|
296 | |
---|
297 | :param list: list of turples containing string only. |
---|
298 | """ |
---|
299 | if list is None: |
---|
300 | return |
---|
301 | for i in list: |
---|
302 | index = self.list_ctrl.InsertStringItem(sys.maxint, i[0]) |
---|
303 | self.list_ctrl.SetStringItem(index, 1, i[1]) |
---|
304 | self.list_ctrl.SetStringItem(index, 2, i[2]) |
---|
305 | |
---|
306 | def set_perspective(self, sub_menu): |
---|
307 | """ |
---|
308 | Receive the name of the current perspective and set |
---|
309 | the active perspective |
---|
310 | """ |
---|
311 | for item in self.perspectives: |
---|
312 | if item.GetLabelText()== sub_menu: |
---|
313 | item.SetValue(True) |
---|
314 | else: |
---|
315 | item.SetValue(False) |
---|
316 | |
---|
317 | def select_data_type(self, type='Data1D', check=False): |
---|
318 | """ |
---|
319 | check item in the list according to a type. |
---|
320 | :param check: if check true set checkboxes toTrue else to False |
---|
321 | :param type: type of data to select |
---|
322 | """ |
---|
323 | num = self.list_ctrl.GetItemCount() |
---|
324 | for index in range(num): |
---|
325 | if self.list_ctrl.GetItem(index, 1).GetText() == type: |
---|
326 | self.list_ctrl.CheckItem(index, check) |
---|
327 | |
---|
328 | def on_select_all_data1d(self, event): |
---|
329 | """ |
---|
330 | check/ uncheck list of all data 1D |
---|
331 | """ |
---|
332 | ctrl = event.GetEventObject() |
---|
333 | self.select_data_type(type='Data1D', check=ctrl.GetValue()) |
---|
334 | |
---|
335 | def on_select_all_data2d(self, event): |
---|
336 | """ |
---|
337 | check/ uncheck list of all data 2D |
---|
338 | """ |
---|
339 | ctrl = event.GetEventObject() |
---|
340 | self.select_data_type(type='Data2D', check=ctrl.GetValue()) |
---|
341 | |
---|
342 | def on_select_all_theory1d(self, event): |
---|
343 | """ |
---|
344 | check/ uncheck list of all theory 1D |
---|
345 | """ |
---|
346 | ctrl = event.GetEventObject() |
---|
347 | self.select_data_type(type='Theory1D', check=ctrl.GetValue()) |
---|
348 | |
---|
349 | def on_select_all_theory2d(self, event): |
---|
350 | """ |
---|
351 | check/ uncheck list of all theory 2D |
---|
352 | """ |
---|
353 | ctrl = event.GetEventObject() |
---|
354 | self.select_data_type(type='Theory2D', check=ctrl.GetValue()) |
---|
355 | |
---|
356 | def on_select_all(self, event): |
---|
357 | """ |
---|
358 | Check or uncheck all data listed |
---|
359 | """ |
---|
360 | ctrl = event.GetEventObject() |
---|
361 | self.cb_select_data1d.SetValue(ctrl.GetValue()) |
---|
362 | self.cb_select_data2d.SetValue(ctrl.GetValue()) |
---|
363 | self.cb_select_theory1d.SetValue(ctrl.GetValue()) |
---|
364 | self.cb_select_theory2d.SetValue(ctrl.GetValue()) |
---|
365 | num = self.list_ctrl.GetItemCount() |
---|
366 | for i in range(num): |
---|
367 | self.list_ctrl.CheckItem(i, ctrl.GetValue()) |
---|
368 | |
---|
369 | def on_select_theory(self, event): |
---|
370 | """ |
---|
371 | Select the theory to import in the active perspective |
---|
372 | """ |
---|
373 | |
---|
374 | def on_set_active_perspective(self, event): |
---|
375 | """ |
---|
376 | Select the active perspective |
---|
377 | """ |
---|
378 | ctrl = event.GetEventObject() |
---|
379 | |
---|
380 | def set_data_helper(self): |
---|
381 | """ |
---|
382 | """ |
---|
383 | data_to_plot = [] |
---|
384 | |
---|
385 | num = self.list_ctrl.GetItemCount() |
---|
386 | for index in range(num): |
---|
387 | if self.list_ctrl.IsChecked(index): |
---|
388 | data_to_plot.append(self.list_ctrl.GetItemText(index)) |
---|
389 | return data_to_plot |
---|
390 | |
---|
391 | def on_import(self, event=None): |
---|
392 | """ |
---|
393 | Get all select data and set them to the current active perspetive |
---|
394 | """ |
---|
395 | data_to_plot = self.set_data_helper() |
---|
396 | current_perspective = None |
---|
397 | if self.perspectives: |
---|
398 | for item in self.perspectives: |
---|
399 | if item.GetValue(): |
---|
400 | current_perspective = item.GetLabelText() |
---|
401 | if self.manager is not None: |
---|
402 | self.manager.post_data(data_name_list=data_to_plot, |
---|
403 | perspective=current_perspective, plot=False) |
---|
404 | |
---|
405 | def on_plot(self, event=None): |
---|
406 | """ |
---|
407 | Send a list of data names to plot |
---|
408 | """ |
---|
409 | data_to_plot = self.set_data_helper() |
---|
410 | if self.manager is not None: |
---|
411 | self.manager.post_data(data_name_list=data_to_plot, plot=True) |
---|
412 | |
---|
413 | def on_close(self, event): |
---|
414 | """ |
---|
415 | Close the current panel's parent |
---|
416 | """ |
---|
417 | self.parent._onClose() |
---|
418 | |
---|
419 | |
---|
420 | from sans.guiframe.dataFitting import Data1D |
---|
421 | from DataLoader.loader import Loader |
---|
422 | |
---|
423 | list = Loader().load('latex_smeared.xml') |
---|
424 | data_list = [('Data1', list[0], '07/01/2010'), |
---|
425 | ('Data2', list[1], '07/03/2011'), |
---|
426 | ('Data3', 'Theory1D', '06/01/2010'), |
---|
427 | ('Data4', 'Theory2D', '07/01/2010'), |
---|
428 | ('Data5', 'Theory2D', '07/02/2010')] |
---|
429 | |
---|
430 | class DataFrame(wx.Frame): |
---|
431 | def __init__(self, parent=None, owner=None, |
---|
432 | list_of_perspective=None, list=None, |
---|
433 | manager=None, *args, **kwds): |
---|
434 | kwds['size'] = (500, 500) |
---|
435 | kwds['id'] = -1 |
---|
436 | kwds['title'] = "Loaded Data" |
---|
437 | wx.Frame.__init__(self, parent=parent, *args, **kwds) |
---|
438 | self.parent = parent |
---|
439 | self.owner = owner |
---|
440 | self.manager = manager |
---|
441 | self.panel = DataPanel(parent=self, |
---|
442 | list_of_perspective=list_of_perspective) |
---|
443 | self.panel.load_list(list=list) |
---|
444 | wx.EVT_CLOSE(self, self._onClose) |
---|
445 | |
---|
446 | def set_owner(self, owner): |
---|
447 | """ |
---|
448 | :param owner: is the main widget creating this frame |
---|
449 | for sansview owner is gui_manager |
---|
450 | """ |
---|
451 | self.owner = owner |
---|
452 | self.panel.set_owner(owner=self.owner) |
---|
453 | |
---|
454 | def set_manager(self, manager): |
---|
455 | """ |
---|
456 | :param manager: object responsible of filling on empty the listcrtl of |
---|
457 | this panel. for sansview manager is data_manager |
---|
458 | |
---|
459 | """ |
---|
460 | self.manager = manager |
---|
461 | self.panel.set_manager(manager=self.manager) |
---|
462 | |
---|
463 | def load_list(self, list=None): |
---|
464 | """ |
---|
465 | Fill the list inside its panel |
---|
466 | """ |
---|
467 | self.panel.load_list(list=list) |
---|
468 | |
---|
469 | def layout_perspective(self, list_of_perspective=None): |
---|
470 | """ |
---|
471 | fill the panel with list of perspective |
---|
472 | """ |
---|
473 | self.panel.layout_perspective(list_of_perspective=list_of_perspective) |
---|
474 | |
---|
475 | def set_perspective(self, sub_menu): |
---|
476 | """ |
---|
477 | Receive the name of the current perspective and set |
---|
478 | the active perspective |
---|
479 | """ |
---|
480 | self.panel.set_perspective(sub_menu=sub_menu) |
---|
481 | |
---|
482 | def _onClose(self, event=None): |
---|
483 | """ |
---|
484 | this frame can only be hidden unless the application destroys it |
---|
485 | """ |
---|
486 | self.Hide() |
---|
487 | |
---|
488 | if __name__ == "__main__": |
---|
489 | app = wx.App() |
---|
490 | window = DataFrame(list=data_list) |
---|
491 | window.Show(True) |
---|
492 | app.MainLoop() |
---|
493 | |
---|
494 | |
---|