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 os |
---|
14 | import wx |
---|
15 | import sys |
---|
16 | import warnings |
---|
17 | from wx.lib.scrolledpanel import ScrolledPanel |
---|
18 | import wx.lib.agw.customtreectrl as CT |
---|
19 | from sans.guiframe.dataFitting import Data1D |
---|
20 | from sans.guiframe.dataFitting import Data2D |
---|
21 | from sans.guiframe.panel_base import PanelBase |
---|
22 | from sans.guiframe.events import StatusEvent |
---|
23 | from DataLoader.loader import Loader |
---|
24 | import logging |
---|
25 | |
---|
26 | try: |
---|
27 | # Try to find a local config |
---|
28 | import imp |
---|
29 | path = os.getcwd() |
---|
30 | if(os.path.isfile("%s/%s.py" % (path, 'local_config'))) or \ |
---|
31 | (os.path.isfile("%s/%s.pyc" % (path, 'local_config'))): |
---|
32 | fObj, path, descr = imp.find_module('local_config', [path]) |
---|
33 | config = imp.load_module('local_config', fObj, path, descr) |
---|
34 | else: |
---|
35 | # Try simply importing local_config |
---|
36 | import local_config as config |
---|
37 | except: |
---|
38 | # Didn't find local config, load the default |
---|
39 | import config |
---|
40 | |
---|
41 | extension_list = [] |
---|
42 | if config.APPLICATION_STATE_EXTENSION is not None: |
---|
43 | extension_list.append(config.APPLICATION_STATE_EXTENSION) |
---|
44 | EXTENSIONS = config.PLUGIN_STATE_EXTENSIONS + extension_list |
---|
45 | |
---|
46 | PANEL_WIDTH = 250 |
---|
47 | PANEL_HEIGHT = 700 |
---|
48 | CBOX_WIDTH = 140 |
---|
49 | STYLE_FLAG =wx.RAISED_BORDER|CT.TR_HAS_BUTTONS| CT.TR_HIDE_ROOT|\ |
---|
50 | wx.WANTS_CHARS|CT.TR_HAS_VARIABLE_ROW_HEIGHT |
---|
51 | |
---|
52 | |
---|
53 | class DataTreeCtrl(CT.CustomTreeCtrl): |
---|
54 | """ |
---|
55 | Check list control to be used for Data Panel |
---|
56 | """ |
---|
57 | def __init__(self, parent,*args, **kwds): |
---|
58 | #agwstyle is introduced in wx.2.8.11 but is not working for mac |
---|
59 | if sys.platform.count("darwin") != 0: |
---|
60 | try: |
---|
61 | kwds['style'] = STYLE_FLAG |
---|
62 | except: |
---|
63 | raise |
---|
64 | else: |
---|
65 | #agwstyle is introduced in wx.2.8.11 .argument working only for windows |
---|
66 | try: |
---|
67 | kwds['agwStyle'] = STYLE_FLAG |
---|
68 | except: |
---|
69 | try: |
---|
70 | kwds['style'] = STYLE_FLAG |
---|
71 | except: |
---|
72 | raise |
---|
73 | |
---|
74 | CT.CustomTreeCtrl.__init__(self, parent, *args, **kwds) |
---|
75 | self.root = self.AddRoot("Available Data") |
---|
76 | |
---|
77 | class DataPanel(ScrolledPanel, PanelBase): |
---|
78 | """ |
---|
79 | This panel displays data available in the application and widgets to |
---|
80 | interact with data. |
---|
81 | """ |
---|
82 | ## Internal name for the AUI manager |
---|
83 | window_name = "Data Panel" |
---|
84 | ## Title to appear on top of the window |
---|
85 | window_caption = "Data Explorer" |
---|
86 | #type of window |
---|
87 | window_type = "Data Panel" |
---|
88 | ## Flag to tell the GUI manager that this panel is not |
---|
89 | # tied to any perspective |
---|
90 | #ALWAYS_ON = True |
---|
91 | def __init__(self, parent, |
---|
92 | list=None, |
---|
93 | size=(PANEL_WIDTH, PANEL_HEIGHT), |
---|
94 | list_of_perspective=None, manager=None, *args, **kwds): |
---|
95 | |
---|
96 | kwds['size']= size |
---|
97 | kwds['style'] = STYLE_FLAG |
---|
98 | ScrolledPanel.__init__(self, parent=parent, *args, **kwds) |
---|
99 | PanelBase.__init__(self) |
---|
100 | self.SetupScrolling() |
---|
101 | self.loader = Loader() |
---|
102 | #Default location |
---|
103 | self._default_save_location = None |
---|
104 | self.all_data1d = True |
---|
105 | self.parent = parent |
---|
106 | self.manager = manager |
---|
107 | if list is None: |
---|
108 | list = [] |
---|
109 | self.list_of_data = list |
---|
110 | if list_of_perspective is None: |
---|
111 | list_of_perspective = [] |
---|
112 | self.list_of_perspective = list_of_perspective |
---|
113 | self.list_rb_perspectives= [] |
---|
114 | self.list_cb_data = {} |
---|
115 | self.list_cb_theory = {} |
---|
116 | self.tree_ctrl = None |
---|
117 | self.tree_ctrl_theory = None |
---|
118 | self.perspective_cbox = None |
---|
119 | |
---|
120 | self.owner = None |
---|
121 | self.do_layout() |
---|
122 | self.fill_cbox_analysis(self.list_of_perspective) |
---|
123 | self.Bind(wx.EVT_SHOW, self.on_close_page) |
---|
124 | |
---|
125 | |
---|
126 | def do_layout(self): |
---|
127 | """ |
---|
128 | """ |
---|
129 | self.define_panel_structure() |
---|
130 | self.layout_selection() |
---|
131 | self.layout_data_list() |
---|
132 | self.layout_button() |
---|
133 | #self.layout_batch() |
---|
134 | |
---|
135 | def define_panel_structure(self): |
---|
136 | """ |
---|
137 | Define the skeleton of the panel |
---|
138 | """ |
---|
139 | w, h = self.parent.GetSize() |
---|
140 | self.vbox = wx.BoxSizer(wx.VERTICAL) |
---|
141 | self.sizer1 = wx.BoxSizer(wx.VERTICAL) |
---|
142 | self.sizer1.SetMinSize((w/13, h*2/5)) |
---|
143 | |
---|
144 | self.sizer2 = wx.BoxSizer(wx.VERTICAL) |
---|
145 | self.sizer3 = wx.FlexGridSizer(5, 2, 0, 0) |
---|
146 | self.sizer4 = wx.BoxSizer(wx.HORIZONTAL) |
---|
147 | self.sizer5 = wx.BoxSizer(wx.VERTICAL) |
---|
148 | |
---|
149 | self.vbox.Add(self.sizer5, 0, wx.EXPAND|wx.ALL,1) |
---|
150 | self.vbox.Add(self.sizer1, 0, wx.EXPAND|wx.ALL,0) |
---|
151 | self.vbox.Add(self.sizer2, 0, wx.EXPAND|wx.ALL,1) |
---|
152 | self.vbox.Add(self.sizer3, 0, wx.EXPAND|wx.ALL,1) |
---|
153 | self.vbox.Add(self.sizer4, 0, wx.EXPAND|wx.ALL,5) |
---|
154 | |
---|
155 | self.SetSizer(self.vbox) |
---|
156 | |
---|
157 | def layout_selection(self): |
---|
158 | """ |
---|
159 | """ |
---|
160 | select_txt = wx.StaticText(self, -1, 'Selection Options') |
---|
161 | select_txt.SetForegroundColour('blue') |
---|
162 | self.selection_cbox = wx.ComboBox(self, -1, style=wx.CB_READONLY) |
---|
163 | list_of_options = ['Select all Data', |
---|
164 | 'Unselect all Data', |
---|
165 | 'Select all Data 1D', |
---|
166 | 'Unselect all Data 1D', |
---|
167 | 'Select all Data 2D', |
---|
168 | 'Unselect all Data 2D' ] |
---|
169 | for option in list_of_options: |
---|
170 | self.selection_cbox.Append(str(option)) |
---|
171 | self.selection_cbox.SetValue('Select all Data') |
---|
172 | wx.EVT_COMBOBOX(self.selection_cbox,-1, self._on_selection_type) |
---|
173 | self.sizer5.AddMany([(select_txt,0, wx.ALL,5), |
---|
174 | (self.selection_cbox,0, wx.ALL,5)]) |
---|
175 | self.enable_selection() |
---|
176 | |
---|
177 | |
---|
178 | def _on_selection_type(self, event): |
---|
179 | """ |
---|
180 | Select data according to patterns |
---|
181 | """ |
---|
182 | |
---|
183 | list_of_options = ['Select all Data', |
---|
184 | 'Unselect all Data', |
---|
185 | 'Select all Data 1D', |
---|
186 | 'Unselect all Data 1D', |
---|
187 | 'Select all Data 2D', |
---|
188 | 'Unselect all Data 2D' ] |
---|
189 | option = self.selection_cbox.GetValue() |
---|
190 | |
---|
191 | pos = self.selection_cbox.GetSelection() |
---|
192 | if pos == wx.NOT_FOUND: |
---|
193 | return |
---|
194 | option = self.selection_cbox.GetString(pos) |
---|
195 | for item in self.list_cb_data.values(): |
---|
196 | data_ctrl, _, _, _,_, _ = item |
---|
197 | data_id, data_class, _ = self.tree_ctrl.GetItemPyData(data_ctrl) |
---|
198 | if option == 'Select all Data': |
---|
199 | self.tree_ctrl.CheckItem(data_ctrl, True) |
---|
200 | elif option == 'Unselect all Data': |
---|
201 | self.tree_ctrl.CheckItem(data_ctrl, False) |
---|
202 | elif option == 'Select all Data 1D': |
---|
203 | if data_class == 'Data1D': |
---|
204 | self.tree_ctrl.CheckItem(data_ctrl, True) |
---|
205 | elif option == 'Unselect all Data 1D': |
---|
206 | if data_class == 'Data1D': |
---|
207 | self.tree_ctrl.CheckItem(data_ctrl, False) |
---|
208 | elif option == 'Select all Data 1D': |
---|
209 | if data_class == 'Data1D': |
---|
210 | self.tree_ctrl.CheckItem(data_ctrl, True) |
---|
211 | elif option == 'Select all Data 2D': |
---|
212 | if data_class == 'Data2D': |
---|
213 | self.tree_ctrl.CheckItem(data_ctrl, True) |
---|
214 | elif option == 'Unselect all Data 2D': |
---|
215 | if data_class == 'Data2D': |
---|
216 | self.tree_ctrl.CheckItem(data_ctrl, False) |
---|
217 | self.enable_append() |
---|
218 | self.enable_freeze() |
---|
219 | self.enable_plot() |
---|
220 | self.enable_import() |
---|
221 | #self.enable_remove() |
---|
222 | |
---|
223 | def layout_button(self): |
---|
224 | """ |
---|
225 | Layout widgets related to buttons |
---|
226 | """ |
---|
227 | w, _ = self.GetSize() |
---|
228 | self.bt_add = wx.Button(self, wx.NewId(), "Load Data") |
---|
229 | self.bt_add.SetToolTipString("Add data from the application") |
---|
230 | wx.EVT_BUTTON(self, self.bt_add.GetId(), self._load_data) |
---|
231 | #self.bt_remove = wx.Button(self, wx.NewId(), "Remove Data") |
---|
232 | #self.bt_remove.SetToolTipString("Remove data from the application") |
---|
233 | #wx.EVT_BUTTON(self, self.bt_remove.GetId(), self.on_remove) |
---|
234 | self.bt_import = wx.Button(self, wx.NewId(), "Send To") |
---|
235 | self.bt_import.SetToolTipString("Send set of Data to active perspective") |
---|
236 | wx.EVT_BUTTON(self, self.bt_import.GetId(), self.on_import) |
---|
237 | self.perspective_cbox = wx.ComboBox(self, -1, size=(CBOX_WIDTH, -1), |
---|
238 | style=wx.CB_READONLY) |
---|
239 | wx.EVT_COMBOBOX(self.perspective_cbox,-1, |
---|
240 | self._on_perspective_selection) |
---|
241 | |
---|
242 | self.bt_append_plot = wx.Button(self, wx.NewId(), "Append Plot To") |
---|
243 | self.bt_append_plot.SetToolTipString("Plot the selected data in the active panel") |
---|
244 | wx.EVT_BUTTON(self, self.bt_append_plot.GetId(), self.on_append_plot) |
---|
245 | |
---|
246 | self.bt_plot = wx.Button(self, wx.NewId(), "New Plot") |
---|
247 | self.bt_plot.SetToolTipString("To trigger plotting") |
---|
248 | wx.EVT_BUTTON(self, self.bt_plot.GetId(), self.on_plot) |
---|
249 | |
---|
250 | self.bt_freeze = wx.Button(self, wx.NewId(), "Freeze Theory") |
---|
251 | self.bt_freeze.SetToolTipString("To trigger freeze a theory") |
---|
252 | wx.EVT_BUTTON(self, self.bt_freeze.GetId(), self.on_freeze) |
---|
253 | |
---|
254 | self.cb_plotpanel = wx.ComboBox(self, -1, size=(CBOX_WIDTH, -1), |
---|
255 | style=wx.CB_READONLY|wx.CB_SORT) |
---|
256 | wx.EVT_COMBOBOX(self.cb_plotpanel,-1, self._on_plot_selection) |
---|
257 | self.cb_plotpanel.Disable() |
---|
258 | |
---|
259 | self.sizer3.AddMany([(self.bt_add), |
---|
260 | ((10, 10)), |
---|
261 | (self.bt_import), |
---|
262 | (self.perspective_cbox, wx.EXPAND), |
---|
263 | (self.bt_append_plot), |
---|
264 | (self.cb_plotpanel, wx.EXPAND), |
---|
265 | (self.bt_plot), |
---|
266 | ((10, 10)), |
---|
267 | (self.bt_freeze)]) |
---|
268 | self.sizer3.AddGrowableCol(1, 1) |
---|
269 | |
---|
270 | #self.enable_remove() |
---|
271 | self.enable_import() |
---|
272 | self.enable_plot() |
---|
273 | self.enable_append() |
---|
274 | self.enable_freeze() |
---|
275 | |
---|
276 | def layout_batch(self): |
---|
277 | """ |
---|
278 | """ |
---|
279 | self.rb_single_mode = wx.RadioButton(self, -1, 'Single Mode', |
---|
280 | style=wx.RB_GROUP) |
---|
281 | self.rb_batch_mode = wx.RadioButton(self, -1, 'Batch Mode') |
---|
282 | |
---|
283 | self.rb_single_mode.SetValue(True) |
---|
284 | self.rb_batch_mode.SetValue(False) |
---|
285 | self.sizer4.AddMany([(self.rb_single_mode,0, wx.ALL,5), |
---|
286 | (self.rb_batch_mode,0, wx.ALL,5)]) |
---|
287 | |
---|
288 | def layout_data_list(self): |
---|
289 | """ |
---|
290 | Add a listcrtl in the panel |
---|
291 | """ |
---|
292 | tree_ctrl_label = wx.StaticText(self, -1, "Data") |
---|
293 | tree_ctrl_label.SetForegroundColour('blue') |
---|
294 | self.tree_ctrl = DataTreeCtrl(parent=self) |
---|
295 | self.tree_ctrl.Bind(CT.EVT_TREE_ITEM_CHECKING, self.on_check_item) |
---|
296 | tree_ctrl_theory_label = wx.StaticText(self, -1, "Theory") |
---|
297 | tree_ctrl_theory_label.SetForegroundColour('blue') |
---|
298 | self.tree_ctrl_theory = DataTreeCtrl(parent=self) |
---|
299 | self.tree_ctrl_theory.Bind(CT.EVT_TREE_ITEM_CHECKING, self.on_check_item) |
---|
300 | self.sizer1.Add(tree_ctrl_label, 0, wx.LEFT, 10) |
---|
301 | self.sizer1.Add(self.tree_ctrl, 1, wx.EXPAND|wx.ALL, 10) |
---|
302 | self.sizer1.Add(tree_ctrl_theory_label, 0, wx.LEFT, 10) |
---|
303 | self.sizer1.Add(self.tree_ctrl_theory, 1, wx.EXPAND|wx.ALL, 10) |
---|
304 | |
---|
305 | def onContextMenu(self, event): |
---|
306 | """ |
---|
307 | Retrieve the state selected state |
---|
308 | """ |
---|
309 | # Skipping the save state functionality for release 0.9.0 |
---|
310 | #return |
---|
311 | pos = event.GetPosition() |
---|
312 | pos = self.ScreenToClient(pos) |
---|
313 | self.PopupMenu(self.popUpMenu, pos) |
---|
314 | |
---|
315 | |
---|
316 | def on_check_item(self, event): |
---|
317 | """ |
---|
318 | """ |
---|
319 | item = event.GetItem() |
---|
320 | item.Check(not item.IsChecked()) |
---|
321 | self.enable_append() |
---|
322 | self.enable_freeze() |
---|
323 | self.enable_plot() |
---|
324 | self.enable_import() |
---|
325 | #self.enable_remove() |
---|
326 | event.Skip() |
---|
327 | |
---|
328 | def fill_cbox_analysis(self, plugin): |
---|
329 | """ |
---|
330 | fill the combobox with analysis name |
---|
331 | """ |
---|
332 | self.list_of_perspective = plugin |
---|
333 | if self.parent is None or \ |
---|
334 | not hasattr(self.parent, "get_current_perspective") or \ |
---|
335 | len(self.list_of_perspective) == 0: |
---|
336 | return |
---|
337 | if self.parent is not None and self.perspective_cbox is not None: |
---|
338 | for plug in self.list_of_perspective: |
---|
339 | if plug.get_perspective(): |
---|
340 | self.perspective_cbox.Append(plug.sub_menu, plug) |
---|
341 | |
---|
342 | curr_pers = self.parent.get_current_perspective() |
---|
343 | self.perspective_cbox.SetStringSelection(curr_pers.sub_menu) |
---|
344 | self.enable_import() |
---|
345 | |
---|
346 | def load_data_list(self, list): |
---|
347 | """ |
---|
348 | add need data with its theory under the tree |
---|
349 | """ |
---|
350 | if list: |
---|
351 | for state_id, dstate in list.iteritems(): |
---|
352 | data = dstate.get_data() |
---|
353 | theory_list = dstate.get_theory() |
---|
354 | if data is not None: |
---|
355 | data_name = data.name |
---|
356 | data_class = data.__class__.__name__ |
---|
357 | path = dstate.get_path() |
---|
358 | process_list = data.process |
---|
359 | data_id = data.id |
---|
360 | |
---|
361 | if state_id not in self.list_cb_data: |
---|
362 | #new state |
---|
363 | data_c = self.tree_ctrl.InsertItem(self.tree_ctrl.root,0, |
---|
364 | data_name, ct_type=1, |
---|
365 | data=(data_id, data_class, state_id)) |
---|
366 | data_c.Check(True) |
---|
367 | d_i_c = self.tree_ctrl.AppendItem(data_c, 'Info') |
---|
368 | i_c_c = self.tree_ctrl.AppendItem(d_i_c, |
---|
369 | 'Type: %s' % data_class) |
---|
370 | p_c_c = self.tree_ctrl.AppendItem(d_i_c, |
---|
371 | 'Path: %s' % str(path)) |
---|
372 | d_p_c = self.tree_ctrl.AppendItem(d_i_c, 'Process') |
---|
373 | |
---|
374 | for process in process_list: |
---|
375 | i_t_c = self.tree_ctrl.AppendItem(d_p_c, |
---|
376 | process.__str__()) |
---|
377 | theory_child = self.tree_ctrl.AppendItem(data_c, "THEORIES") |
---|
378 | |
---|
379 | self.list_cb_data[state_id] = [data_c, |
---|
380 | d_i_c, |
---|
381 | i_c_c, |
---|
382 | p_c_c, |
---|
383 | d_p_c, |
---|
384 | theory_child] |
---|
385 | else: |
---|
386 | data_ctrl_list = self.list_cb_data[state_id] |
---|
387 | #This state is already display replace it contains |
---|
388 | data_c, d_i_c, i_c_c, p_c_c, d_p_c, t_c = data_ctrl_list |
---|
389 | self.tree_ctrl.SetItemText(data_c, data_name) |
---|
390 | temp = (data_id, data_class, state_id) |
---|
391 | self.tree_ctrl.SetItemPyData(data_c, temp) |
---|
392 | self.tree_ctrl.SetItemText(i_c_c, 'Type: %s' % data_class) |
---|
393 | self.tree_ctrl.SetItemText(p_c_c, 'Path: %s' % str(path)) |
---|
394 | self.tree_ctrl.DeleteChildren(d_p_c) |
---|
395 | for process in process_list: |
---|
396 | i_t_c = self.tree_ctrl.AppendItem(d_p_c, |
---|
397 | process.__str__()) |
---|
398 | self.append_theory(state_id, theory_list) |
---|
399 | #self.enable_remove() |
---|
400 | self.enable_import() |
---|
401 | self.enable_plot() |
---|
402 | self.enable_freeze() |
---|
403 | self.enable_selection() |
---|
404 | |
---|
405 | def _uncheck_all(self): |
---|
406 | """ |
---|
407 | Uncheck all check boxes |
---|
408 | """ |
---|
409 | for item in self.list_cb_data.values(): |
---|
410 | data_ctrl, _, _, _,_, _ = item |
---|
411 | self.tree_ctrl.CheckItem(data_ctrl, False) |
---|
412 | self.enable_append() |
---|
413 | self.enable_freeze() |
---|
414 | self.enable_plot() |
---|
415 | self.enable_import() |
---|
416 | #self.enable_remove() |
---|
417 | |
---|
418 | def append_theory(self, state_id, theory_list): |
---|
419 | """ |
---|
420 | append theory object under data from a state of id = state_id |
---|
421 | replace that theory if already displayed |
---|
422 | """ |
---|
423 | if not theory_list: |
---|
424 | return |
---|
425 | if state_id not in self.list_cb_data.keys(): |
---|
426 | root = self.tree_ctrl_theory.root |
---|
427 | tree = self.tree_ctrl_theory |
---|
428 | else: |
---|
429 | item = self.list_cb_data[state_id] |
---|
430 | data_c, _, _, _, _, _ = item |
---|
431 | root = data_c |
---|
432 | tree = self.tree_ctrl |
---|
433 | if root is not None: |
---|
434 | self.append_theory_helper(tree=tree, root=root, |
---|
435 | state_id=state_id, |
---|
436 | theory_list=theory_list) |
---|
437 | |
---|
438 | |
---|
439 | def append_theory_helper(self, tree, root, state_id, theory_list): |
---|
440 | """ |
---|
441 | """ |
---|
442 | if state_id in self.list_cb_theory.keys(): |
---|
443 | #update current list of theory for this data |
---|
444 | theory_list_ctrl = self.list_cb_theory[state_id] |
---|
445 | |
---|
446 | for theory_id, item in theory_list.iteritems(): |
---|
447 | theory_data, theory_state = item |
---|
448 | if theory_data is None: |
---|
449 | name = "Unknown" |
---|
450 | theory_class = "Unknown" |
---|
451 | theory_id = "Unknown" |
---|
452 | temp = (None, None, None) |
---|
453 | else: |
---|
454 | name = theory_data.name |
---|
455 | theory_class = theory_data.__class__.__name__ |
---|
456 | theory_id = theory_data.id |
---|
457 | #if theory_state is not None: |
---|
458 | # name = theory_state.model.name |
---|
459 | temp = (theory_id, theory_class, state_id) |
---|
460 | if theory_id not in theory_list_ctrl: |
---|
461 | #add new theory |
---|
462 | t_child = tree.AppendItem(root, |
---|
463 | name, ct_type=1, data=temp) |
---|
464 | t_i_c = tree.AppendItem(t_child, 'Info') |
---|
465 | i_c_c = tree.AppendItem(t_i_c, |
---|
466 | 'Type: %s' % theory_class) |
---|
467 | t_p_c = tree.AppendItem(t_i_c, 'Process') |
---|
468 | |
---|
469 | for process in theory_data.process: |
---|
470 | i_t_c = tree.AppendItem(t_p_c, |
---|
471 | process.__str__()) |
---|
472 | theory_list_ctrl[theory_id] = [t_child, |
---|
473 | i_c_c, |
---|
474 | t_p_c] |
---|
475 | else: |
---|
476 | #replace theory |
---|
477 | t_child, i_c_c, t_p_c = theory_list_ctrl[theory_id] |
---|
478 | tree.SetItemText(t_child, name) |
---|
479 | tree.SetItemPyData(t_child, temp) |
---|
480 | tree.SetItemText(i_c_c, 'Type: %s' % theory_class) |
---|
481 | tree.DeleteChildren(t_p_c) |
---|
482 | for process in theory_data.process: |
---|
483 | i_t_c = tree.AppendItem(t_p_c, |
---|
484 | process.__str__()) |
---|
485 | |
---|
486 | else: |
---|
487 | #data didn't have a theory associated it before |
---|
488 | theory_list_ctrl = {} |
---|
489 | for theory_id, item in theory_list.iteritems(): |
---|
490 | theory_data, theory_state = item |
---|
491 | if theory_data is not None: |
---|
492 | name = theory_data.name |
---|
493 | theory_class = theory_data.__class__.__name__ |
---|
494 | theory_id = theory_data.id |
---|
495 | #if theory_state is not None: |
---|
496 | # name = theory_state.model.name |
---|
497 | temp = (theory_id, theory_class, state_id) |
---|
498 | t_child = tree.AppendItem(root, |
---|
499 | name, ct_type=1, |
---|
500 | data=(theory_data.id, theory_class, state_id)) |
---|
501 | t_i_c = tree.AppendItem(t_child, 'Info') |
---|
502 | i_c_c = tree.AppendItem(t_i_c, |
---|
503 | 'Type: %s' % theory_class) |
---|
504 | t_p_c = tree.AppendItem(t_i_c, 'Process') |
---|
505 | |
---|
506 | for process in theory_data.process: |
---|
507 | i_t_c = tree.AppendItem(t_p_c, |
---|
508 | process.__str__()) |
---|
509 | |
---|
510 | theory_list_ctrl[theory_id] = [t_child, i_c_c, t_p_c] |
---|
511 | #self.list_cb_theory[data_id] = theory_list_ctrl |
---|
512 | self.list_cb_theory[state_id] = theory_list_ctrl |
---|
513 | |
---|
514 | |
---|
515 | |
---|
516 | def set_data_helper(self): |
---|
517 | """ |
---|
518 | """ |
---|
519 | data_to_plot = [] |
---|
520 | state_to_plot = [] |
---|
521 | theory_to_plot = [] |
---|
522 | for value in self.list_cb_data.values(): |
---|
523 | item, _, _, _, _, _ = value |
---|
524 | if item.IsChecked(): |
---|
525 | data_id, _, state_id = self.tree_ctrl.GetItemPyData(item) |
---|
526 | data_to_plot.append(data_id) |
---|
527 | if state_id not in state_to_plot: |
---|
528 | state_to_plot.append(state_id) |
---|
529 | |
---|
530 | for theory_dict in self.list_cb_theory.values(): |
---|
531 | for key, value in theory_dict.iteritems(): |
---|
532 | item, _, _ = value |
---|
533 | if item.IsChecked(): |
---|
534 | theory_id, _, state_id = self.tree_ctrl.GetItemPyData(item) |
---|
535 | theory_to_plot.append(theory_id) |
---|
536 | if state_id not in state_to_plot: |
---|
537 | state_to_plot.append(state_id) |
---|
538 | return data_to_plot, theory_to_plot, state_to_plot |
---|
539 | |
---|
540 | def remove_by_id(self, id): |
---|
541 | """ |
---|
542 | """ |
---|
543 | for item in self.list_cb_data.values(): |
---|
544 | data_c, _, _, _, _, theory_child = item |
---|
545 | data_id, _, state_id = self.tree_ctrl.GetItemPyData(data_c) |
---|
546 | if id == data_id: |
---|
547 | self.tree_ctrl.Delete(data_c) |
---|
548 | del self.list_cb_data[state_id] |
---|
549 | del self.list_cb_theory[data_id] |
---|
550 | |
---|
551 | def load_error(self, error=None): |
---|
552 | """ |
---|
553 | Pop up an error message. |
---|
554 | |
---|
555 | :param error: details error message to be displayed |
---|
556 | """ |
---|
557 | message = "The data file you selected could not be loaded.\n" |
---|
558 | message += "Make sure the content of your file" |
---|
559 | message += " is properly formatted.\n\n" |
---|
560 | |
---|
561 | if error is not None: |
---|
562 | message += "When contacting the DANSE team, mention the" |
---|
563 | message += " following:\n%s" % str(error) |
---|
564 | dial = wx.MessageDialog(self.parent, message, 'Error Loading File', |
---|
565 | wx.OK | wx.ICON_EXCLAMATION) |
---|
566 | dial.ShowModal() |
---|
567 | |
---|
568 | def _load_data(self, event): |
---|
569 | """ |
---|
570 | Load data |
---|
571 | """ |
---|
572 | path = None |
---|
573 | if self._default_save_location == None: |
---|
574 | self._default_save_location = os.getcwd() |
---|
575 | |
---|
576 | cards = self.loader.get_wildcards() |
---|
577 | wlist = '|'.join(cards) |
---|
578 | style = wx.OPEN|wx.FD_MULTIPLE |
---|
579 | dlg = wx.FileDialog(self.parent, |
---|
580 | "Choose a file", |
---|
581 | self._default_save_location, "", |
---|
582 | wlist, |
---|
583 | style=style) |
---|
584 | if dlg.ShowModal() == wx.ID_OK: |
---|
585 | file_list = dlg.GetPaths() |
---|
586 | if len(file_list) >= 0 and not(file_list[0]is None): |
---|
587 | self._default_save_location = os.path.dirname(file_list[0]) |
---|
588 | path = self._default_save_location |
---|
589 | dlg.Destroy() |
---|
590 | |
---|
591 | if path is None or not file_list or file_list[0] is None: |
---|
592 | return |
---|
593 | self._get_data(file_list) |
---|
594 | |
---|
595 | def _get_data(self, path, format=None): |
---|
596 | """ |
---|
597 | """ |
---|
598 | message = "" |
---|
599 | log_msg = '' |
---|
600 | output = {} |
---|
601 | error_message = "" |
---|
602 | for p_file in path: |
---|
603 | basename = os.path.basename(p_file) |
---|
604 | root, extension = os.path.splitext(basename) |
---|
605 | if extension.lower() in EXTENSIONS: |
---|
606 | log_msg = "Data Loader cannot " |
---|
607 | log_msg += "load: %s\n" % str(p_file) |
---|
608 | log_msg += "Try File opening ...." |
---|
609 | logging.info(log_msg) |
---|
610 | continue |
---|
611 | |
---|
612 | try: |
---|
613 | temp = self.loader.load(p_file, format) |
---|
614 | if temp.__class__.__name__ == "list": |
---|
615 | for item in temp: |
---|
616 | data = self.parent.create_gui_data(item, p_file) |
---|
617 | output[data.id] = data |
---|
618 | else: |
---|
619 | data = self.parent.create_gui_data(temp, p_file) |
---|
620 | output[data.id] = data |
---|
621 | message = "Loading Data..." + str(p_file) + "\n" |
---|
622 | self.load_update(output=output, message=message) |
---|
623 | except: |
---|
624 | error_message = "Error while loading Data: %s\n" % str(p_file) |
---|
625 | error_message += str(sys.exc_value) + "\n" |
---|
626 | self.load_update(output=output, message=error_message) |
---|
627 | |
---|
628 | message = "Loading Data Complete! " |
---|
629 | message += log_msg |
---|
630 | self.load_complete(output=output, error_message=error_message, |
---|
631 | message=message, path=path) |
---|
632 | |
---|
633 | def load_update(self, output=None, message=""): |
---|
634 | """ |
---|
635 | print update on the status bar |
---|
636 | """ |
---|
637 | if message != "" and self.parent is not None: |
---|
638 | wx.PostEvent(self.parent, StatusEvent(status=message, |
---|
639 | type="progress", |
---|
640 | info="warning")) |
---|
641 | |
---|
642 | def load_complete(self, output, message="", error_message="", path=None): |
---|
643 | """ |
---|
644 | post message to status bar and return list of data |
---|
645 | """ |
---|
646 | if self.parent is not None: |
---|
647 | wx.PostEvent(self.parent, StatusEvent(status=message, |
---|
648 | info="warning", |
---|
649 | type="stop")) |
---|
650 | if error_message != "": |
---|
651 | self.load_error(error_message) |
---|
652 | if self.parent is not None: |
---|
653 | self.parent.add_data(data_list=output) |
---|
654 | |
---|
655 | def on_remove(self, event): |
---|
656 | """ |
---|
657 | Get a list of item checked and remove them from the treectrl |
---|
658 | Ask the parent to remove reference to this item |
---|
659 | """ |
---|
660 | data_to_remove, theory_to_remove, _ = self.set_data_helper() |
---|
661 | data_key = [] |
---|
662 | theory_key = [] |
---|
663 | #remove data from treectrl |
---|
664 | for d_key, item in self.list_cb_data.iteritems(): |
---|
665 | data_c, d_i_c, i_c_c, p_c_c, d_p_c, t_c = item |
---|
666 | if data_c.IsChecked(): |
---|
667 | self.tree_ctrl.Delete(data_c) |
---|
668 | data_key.append(d_key) |
---|
669 | if d_key in self.list_cb_theory.keys(): |
---|
670 | theory_list_ctrl = self.list_cb_theory[d_key] |
---|
671 | theory_to_remove += theory_list_ctrl.keys() |
---|
672 | # Remove theory from treectrl |
---|
673 | for t_key, theory_dict in self.list_cb_theory.iteritems(): |
---|
674 | for key, value in theory_dict.iteritems(): |
---|
675 | item, _, _ = value |
---|
676 | if item.IsChecked(): |
---|
677 | self.tree_ctrl.Delete(item) |
---|
678 | theory_key.append(key) |
---|
679 | #Remove data and related theory references |
---|
680 | for key in data_key: |
---|
681 | del self.list_cb_data[key] |
---|
682 | if key in theory_key: |
---|
683 | del self.list_cb_theory[key] |
---|
684 | #remove theory references independently of data |
---|
685 | for key in theory_key: |
---|
686 | for t_key, theory_dict in self.list_cb_theory.iteritems(): |
---|
687 | if key in theory_dict: |
---|
688 | del theory_dict[key] |
---|
689 | |
---|
690 | self.parent.remove_data(data_id=data_to_remove, |
---|
691 | theory_id=theory_to_remove) |
---|
692 | #self.enable_remove() |
---|
693 | self.enable_freeze() |
---|
694 | |
---|
695 | def on_import(self, event=None): |
---|
696 | """ |
---|
697 | Get all select data and set them to the current active perspetive |
---|
698 | """ |
---|
699 | data_id, theory_id, state_id = self.set_data_helper() |
---|
700 | self.parent.set_data(data_id) |
---|
701 | self.parent.set_data(data_id=state_id, theory_id=theory_id) |
---|
702 | |
---|
703 | def on_append_plot(self, event=None): |
---|
704 | """ |
---|
705 | append plot to plot panel on focus |
---|
706 | """ |
---|
707 | self._on_plot_selection() |
---|
708 | data_id, theory_id, state_id = self.set_data_helper() |
---|
709 | self.parent.plot_data(data_id=data_id, |
---|
710 | state_id=state_id, |
---|
711 | theory_id=theory_id, |
---|
712 | append=True) |
---|
713 | |
---|
714 | def on_plot(self, event=None): |
---|
715 | """ |
---|
716 | Send a list of data names to plot |
---|
717 | """ |
---|
718 | data_id, theory_id, state_id = self.set_data_helper() |
---|
719 | self.parent.plot_data(data_id=data_id, |
---|
720 | state_id=state_id, |
---|
721 | theory_id=theory_id, |
---|
722 | append=False) |
---|
723 | |
---|
724 | def on_close_page(self, event=None): |
---|
725 | """ |
---|
726 | On close |
---|
727 | """ |
---|
728 | if event != None: |
---|
729 | event.Skip() |
---|
730 | # send parent to update menu with no show nor hide action |
---|
731 | self.parent.show_data_panel(action=False) |
---|
732 | |
---|
733 | def on_freeze(self, event): |
---|
734 | """ |
---|
735 | """ |
---|
736 | _, theory_id, state_id = self.set_data_helper() |
---|
737 | self.parent.freeze(data_id=state_id, theory_id=theory_id) |
---|
738 | |
---|
739 | def set_active_perspective(self, name): |
---|
740 | """ |
---|
741 | set the active perspective |
---|
742 | """ |
---|
743 | self.perspective_cbox.SetStringSelection(name) |
---|
744 | self.enable_import() |
---|
745 | |
---|
746 | def set_panel_on_focus(self, name=None): |
---|
747 | """ |
---|
748 | set the plot panel on focus |
---|
749 | """ |
---|
750 | for key, value in self.parent.plot_panels.iteritems(): |
---|
751 | name_plot_panel = str(value.window_caption) |
---|
752 | if name_plot_panel not in self.cb_plotpanel.GetItems(): |
---|
753 | self.cb_plotpanel.Append(name_plot_panel, value) |
---|
754 | if name != None and name == name_plot_panel: |
---|
755 | self.cb_plotpanel.SetStringSelection(name_plot_panel) |
---|
756 | break |
---|
757 | self.enable_append() |
---|
758 | |
---|
759 | def _on_perspective_selection(self, event=None): |
---|
760 | """ |
---|
761 | select the current perspective for guiframe |
---|
762 | """ |
---|
763 | selection = self.perspective_cbox.GetSelection() |
---|
764 | |
---|
765 | if self.perspective_cbox.GetValue() != 'None': |
---|
766 | perspective = self.perspective_cbox.GetClientData(selection) |
---|
767 | perspective.on_perspective(event=None) |
---|
768 | |
---|
769 | def _on_plot_selection(self, event = None): |
---|
770 | """ |
---|
771 | On source combobox selection |
---|
772 | """ |
---|
773 | if event != None: |
---|
774 | combo = event.GetEventObject() |
---|
775 | event.Skip() |
---|
776 | else: |
---|
777 | combo = self.cb_plotpanel |
---|
778 | selection = combo.GetSelection() |
---|
779 | |
---|
780 | if combo.GetValue() != 'None': |
---|
781 | panel = combo.GetClientData(selection) |
---|
782 | self.parent.on_set_plot_focus(panel) |
---|
783 | |
---|
784 | def enable_remove(self): |
---|
785 | """ |
---|
786 | enable or disable remove button |
---|
787 | """ |
---|
788 | n_t = self.tree_ctrl.GetCount() |
---|
789 | n_t_t = self.tree_ctrl_theory.GetCount() |
---|
790 | if n_t + n_t_t <= 0: |
---|
791 | self.bt_remove.Disable() |
---|
792 | else: |
---|
793 | self.bt_remove.Enable() |
---|
794 | |
---|
795 | def enable_import(self): |
---|
796 | """ |
---|
797 | enable or disable send button |
---|
798 | """ |
---|
799 | n_t = 0 |
---|
800 | if self.tree_ctrl != None: |
---|
801 | n_t = self.tree_ctrl.GetCount() |
---|
802 | if n_t > 0 and len(self.list_of_perspective) > 0: |
---|
803 | self.bt_import.Enable() |
---|
804 | else: |
---|
805 | self.bt_import.Disable() |
---|
806 | if len(self.list_of_perspective) <= 0 or \ |
---|
807 | self.perspective_cbox.GetValue() in ["None", |
---|
808 | "No Active Application"]: |
---|
809 | self.perspective_cbox.Disable() |
---|
810 | else: |
---|
811 | self.perspective_cbox.Enable() |
---|
812 | |
---|
813 | def enable_plot(self): |
---|
814 | """ |
---|
815 | enable or disable plot button |
---|
816 | """ |
---|
817 | n_t = 0 |
---|
818 | n_t_t = 0 |
---|
819 | if self.tree_ctrl != None: |
---|
820 | n_t = self.tree_ctrl.GetCount() |
---|
821 | if self.tree_ctrl_theory != None: |
---|
822 | n_t_t = self.tree_ctrl_theory.GetCount() |
---|
823 | if n_t + n_t_t <= 0: |
---|
824 | self.bt_plot.Disable() |
---|
825 | else: |
---|
826 | self.bt_plot.Enable() |
---|
827 | self.enable_append() |
---|
828 | |
---|
829 | def enable_append(self): |
---|
830 | """ |
---|
831 | enable or disable append button |
---|
832 | """ |
---|
833 | n_t = 0 |
---|
834 | n_t_t = 0 |
---|
835 | if self.tree_ctrl != None: |
---|
836 | n_t = self.tree_ctrl.GetCount() |
---|
837 | if self.tree_ctrl_theory != None: |
---|
838 | n_t_t = self.tree_ctrl_theory.GetCount() |
---|
839 | if n_t + n_t_t <= 0: |
---|
840 | self.bt_append_plot.Disable() |
---|
841 | self.cb_plotpanel.Disable() |
---|
842 | elif self.cb_plotpanel.GetCount() <= 0: |
---|
843 | self.cb_plotpanel.Disable() |
---|
844 | self.bt_append_plot.Disable() |
---|
845 | else: |
---|
846 | self.bt_append_plot.Enable() |
---|
847 | self.cb_plotpanel.Enable() |
---|
848 | |
---|
849 | def check_theory_to_freeze(self): |
---|
850 | """ |
---|
851 | """ |
---|
852 | def enable_freeze(self): |
---|
853 | """ |
---|
854 | enable or disable the freeze button |
---|
855 | """ |
---|
856 | n_t_t = 0 |
---|
857 | n_l = 0 |
---|
858 | if self.tree_ctrl_theory != None: |
---|
859 | n_t_t = self.tree_ctrl_theory.GetCount() |
---|
860 | n_l = len(self.list_cb_theory) |
---|
861 | if (n_t_t + n_l > 0): |
---|
862 | self.bt_freeze.Enable() |
---|
863 | else: |
---|
864 | self.bt_freeze.Disable() |
---|
865 | |
---|
866 | def enable_selection(self): |
---|
867 | """ |
---|
868 | enable or disable combobo box selection |
---|
869 | """ |
---|
870 | n_t = 0 |
---|
871 | n_t_t = 0 |
---|
872 | if self.tree_ctrl != None: |
---|
873 | n_t = self.tree_ctrl.GetCount() |
---|
874 | if self.tree_ctrl_theory != None: |
---|
875 | n_t_t = self.tree_ctrl_theory.GetCount() |
---|
876 | if n_t + n_t_t > 0 and self.selection_cbox != None: |
---|
877 | self.selection_cbox.Enable() |
---|
878 | else: |
---|
879 | self.selection_cbox.Disable() |
---|
880 | |
---|
881 | |
---|
882 | |
---|
883 | class DataFrame(wx.Frame): |
---|
884 | ## Internal name for the AUI manager |
---|
885 | window_name = "Data Panel" |
---|
886 | ## Title to appear on top of the window |
---|
887 | window_caption = "Data Panel" |
---|
888 | ## Flag to tell the GUI manager that this panel is not |
---|
889 | # tied to any perspective |
---|
890 | ALWAYS_ON = True |
---|
891 | |
---|
892 | def __init__(self, parent=None, owner=None, manager=None,size=(300, 800), |
---|
893 | list_of_perspective=[],list=[], *args, **kwds): |
---|
894 | kwds['size'] = size |
---|
895 | kwds['id'] = -1 |
---|
896 | kwds['title']= "Loaded Data" |
---|
897 | wx.Frame.__init__(self, parent=parent, *args, **kwds) |
---|
898 | self.parent = parent |
---|
899 | self.owner = owner |
---|
900 | self.manager = manager |
---|
901 | self.panel = DataPanel(parent=self, |
---|
902 | #size=size, |
---|
903 | list_of_perspective=list_of_perspective) |
---|
904 | |
---|
905 | def load_data_list(self, list=[]): |
---|
906 | """ |
---|
907 | Fill the list inside its panel |
---|
908 | """ |
---|
909 | self.panel.load_data_list(list=list) |
---|
910 | |
---|
911 | |
---|
912 | |
---|
913 | from dataFitting import Data1D |
---|
914 | from dataFitting import Data2D, Theory1D |
---|
915 | from data_state import DataState |
---|
916 | import sys |
---|
917 | class State(): |
---|
918 | def __init__(self): |
---|
919 | self.msg = "" |
---|
920 | def __str__(self): |
---|
921 | self.msg = "model mane : model1\n" |
---|
922 | self.msg += "params : \n" |
---|
923 | self.msg += "name value\n" |
---|
924 | return msg |
---|
925 | def set_data_state(data=None, path=None, theory=None, state=None): |
---|
926 | dstate = DataState(data=data) |
---|
927 | dstate.set_path(path=path) |
---|
928 | dstate.set_theory(theory, state) |
---|
929 | |
---|
930 | return dstate |
---|
931 | """' |
---|
932 | data_list = [1:('Data1', 'Data1D', '07/01/2010', "theory1d", "state1"), |
---|
933 | ('Data2', 'Data2D', '07/03/2011', "theory2d", "state1"), |
---|
934 | ('Data3', 'Theory1D', '06/01/2010', "theory1d", "state1"), |
---|
935 | ('Data4', 'Theory2D', '07/01/2010', "theory2d", "state1"), |
---|
936 | ('Data5', 'Theory2D', '07/02/2010', "theory2d", "state1")] |
---|
937 | """ |
---|
938 | if __name__ == "__main__": |
---|
939 | |
---|
940 | app = wx.App() |
---|
941 | try: |
---|
942 | list_of_perspective = [('perspective2', False), ('perspective1', True)] |
---|
943 | data_list = {} |
---|
944 | # state 1 |
---|
945 | data = Data2D() |
---|
946 | data.name = "data2" |
---|
947 | data.id = 1 |
---|
948 | data.append_empty_process() |
---|
949 | process = data.process[len(data.process)-1] |
---|
950 | process.data = "07/01/2010" |
---|
951 | theory = Data2D() |
---|
952 | theory.id = 34 |
---|
953 | theory.name = "theory1" |
---|
954 | path = "path1" |
---|
955 | state = State() |
---|
956 | data_list['1']=set_data_state(data, path,theory, state) |
---|
957 | #state 2 |
---|
958 | data = Data2D() |
---|
959 | data.name = "data2" |
---|
960 | data.id = 76 |
---|
961 | theory = Data2D() |
---|
962 | theory.id = 78 |
---|
963 | theory.name = "CoreShell 07/24/25" |
---|
964 | path = "path2" |
---|
965 | #state3 |
---|
966 | state = State() |
---|
967 | data_list['2']=set_data_state(data, path,theory, state) |
---|
968 | data = Data1D() |
---|
969 | data.id = 3 |
---|
970 | data.name = "data2" |
---|
971 | theory = Theory1D() |
---|
972 | theory.name = "CoreShell" |
---|
973 | theory.id = 4 |
---|
974 | theory.append_empty_process() |
---|
975 | process = theory.process[len(theory.process)-1] |
---|
976 | process.description = "this is my description" |
---|
977 | path = "path3" |
---|
978 | data.append_empty_process() |
---|
979 | process = data.process[len(data.process)-1] |
---|
980 | process.data = "07/22/2010" |
---|
981 | data_list['4']=set_data_state(data, path,theory, state) |
---|
982 | #state 4 |
---|
983 | temp_data_list = {} |
---|
984 | data.name = "data5 erasing data2" |
---|
985 | temp_data_list['4'] = set_data_state(data, path,theory, state) |
---|
986 | #state 5 |
---|
987 | data = Data2D() |
---|
988 | data.name = "data3" |
---|
989 | data.id = 5 |
---|
990 | data.append_empty_process() |
---|
991 | process = data.process[len(data.process)-1] |
---|
992 | process.data = "07/01/2010" |
---|
993 | theory = Theory1D() |
---|
994 | theory.name = "Cylinder" |
---|
995 | path = "path2" |
---|
996 | state = State() |
---|
997 | dstate= set_data_state(data, path,theory, state) |
---|
998 | theory = Theory1D() |
---|
999 | theory.id = 6 |
---|
1000 | theory.name = "CoreShell" |
---|
1001 | dstate.set_theory(theory) |
---|
1002 | theory = Theory1D() |
---|
1003 | theory.id = 6 |
---|
1004 | theory.name = "CoreShell replacing coreshell in data3" |
---|
1005 | dstate.set_theory(theory) |
---|
1006 | data_list['3'] = dstate |
---|
1007 | #state 6 |
---|
1008 | data_list['6']=set_data_state(None, path,theory, state) |
---|
1009 | data_list['6']=set_data_state(theory=theory, state=None) |
---|
1010 | theory = Theory1D() |
---|
1011 | theory.id = 7 |
---|
1012 | data_list['6']=set_data_state(theory=theory, state=None) |
---|
1013 | data_list['7']=set_data_state(theory=theory, state=None) |
---|
1014 | window = DataFrame(list=data_list) |
---|
1015 | window.load_data_list(list=data_list) |
---|
1016 | window.Show(True) |
---|
1017 | window.load_data_list(list=temp_data_list) |
---|
1018 | except: |
---|
1019 | #raise |
---|
1020 | print "error",sys.exc_value |
---|
1021 | |
---|
1022 | app.MainLoop() |
---|
1023 | |
---|
1024 | |
---|