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