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.agw.customtreectrl as CT |
---|
18 | from sans.guiframe.dataFitting import Data1D |
---|
19 | from sans.guiframe.dataFitting import Data2D |
---|
20 | from sans.guiframe.panel_base import PanelBase |
---|
21 | |
---|
22 | PANEL_WIDTH = 200 |
---|
23 | |
---|
24 | class DataTreeCtrl(CT.CustomTreeCtrl): |
---|
25 | """ |
---|
26 | Check list control to be used for Data Panel |
---|
27 | """ |
---|
28 | def __init__(self, parent,*args, **kwds): |
---|
29 | kwds['style']= wx.SUNKEN_BORDER|CT.TR_HAS_BUTTONS| CT.TR_HIDE_ROOT| \ |
---|
30 | CT.TR_HAS_VARIABLE_ROW_HEIGHT|wx.WANTS_CHARS |
---|
31 | CT.CustomTreeCtrl.__init__(self, parent, *args, **kwds) |
---|
32 | self.root = self.AddRoot("Available Data") |
---|
33 | |
---|
34 | class DataPanel(ScrolledPanel, PanelBase): |
---|
35 | """ |
---|
36 | This panel displays data available in the application and widgets to |
---|
37 | interact with data. |
---|
38 | """ |
---|
39 | ## Internal name for the AUI manager |
---|
40 | window_name = "Data Panel" |
---|
41 | ## Title to appear on top of the window |
---|
42 | window_caption = "Data Panel" |
---|
43 | #type of window |
---|
44 | window_type = "Data Panel" |
---|
45 | ## Flag to tell the GUI manager that this panel is not |
---|
46 | # tied to any perspective |
---|
47 | #ALWAYS_ON = True |
---|
48 | def __init__(self, parent, list=[],list_of_perspective=[], |
---|
49 | size=(PANEL_WIDTH,560), manager=None, *args, **kwds): |
---|
50 | kwds['size']= size |
---|
51 | ScrolledPanel.__init__(self, parent=parent, *args, **kwds) |
---|
52 | PanelBase.__init__(self) |
---|
53 | self.SetupScrolling() |
---|
54 | |
---|
55 | self.parent = parent |
---|
56 | self.manager = manager |
---|
57 | self.list_of_data = list |
---|
58 | self.list_of_perspective = list_of_perspective |
---|
59 | self.list_rb_perspectives= [] |
---|
60 | self.list_cb_data =[] |
---|
61 | self.list_cb_theory =[] |
---|
62 | self.owner = None |
---|
63 | self.do_layout() |
---|
64 | |
---|
65 | def do_layout(self): |
---|
66 | """ |
---|
67 | """ |
---|
68 | self.define_panel_structure() |
---|
69 | self.layout_selection() |
---|
70 | self.layout_list() |
---|
71 | self.layout_button() |
---|
72 | self.layout_batch() |
---|
73 | |
---|
74 | def define_panel_structure(self): |
---|
75 | """ |
---|
76 | Define the skeleton of the panel |
---|
77 | """ |
---|
78 | w, h = self.parent.GetSize() |
---|
79 | self.vbox = wx.BoxSizer(wx.VERTICAL) |
---|
80 | self.sizer1 = wx.BoxSizer(wx.VERTICAL) |
---|
81 | self.sizer1.SetMinSize((w/12, h/2)) |
---|
82 | self.sizer2 = wx.BoxSizer(wx.VERTICAL) |
---|
83 | self.sizer3 = wx.GridBagSizer(5,5) |
---|
84 | self.sizer4 = wx.BoxSizer(wx.HORIZONTAL) |
---|
85 | self.sizer5 = wx.BoxSizer(wx.HORIZONTAL) |
---|
86 | #self.sizer3.SetMinSize((w-60, -1)) |
---|
87 | |
---|
88 | self.vbox.Add(self.sizer5, 0,wx.EXPAND|wx.ALL,10) |
---|
89 | self.vbox.Add(self.sizer1, 0,wx.EXPAND|wx.ALL,0) |
---|
90 | self.vbox.Add(self.sizer2, 0,wx.EXPAND|wx.ALL,10) |
---|
91 | self.vbox.Add(self.sizer3, 0,wx.EXPAND|wx.ALL,10) |
---|
92 | self.vbox.Add(self.sizer4, 0,wx.EXPAND|wx.ALL,10) |
---|
93 | |
---|
94 | self.SetSizer(self.vbox) |
---|
95 | |
---|
96 | def layout_selection(self): |
---|
97 | """ |
---|
98 | """ |
---|
99 | select_txt = wx.StaticText(self, -1, 'Selection Options') |
---|
100 | self.selection_cbox = wx.ComboBox(self, -1, style=wx.CB_READONLY) |
---|
101 | list_of_options = ['Select all Data', |
---|
102 | 'Unselect all Data', |
---|
103 | 'Select all Data 1D', |
---|
104 | 'Unselect all Data 1D', |
---|
105 | 'Select all Data 2D', |
---|
106 | 'Unselect all Data 2D' ] |
---|
107 | for option in list_of_options: |
---|
108 | self.selection_cbox.Append(str(option)) |
---|
109 | self.selection_cbox.SetValue('None') |
---|
110 | wx.EVT_COMBOBOX(self.selection_cbox,-1, self._on_selection_type) |
---|
111 | self.sizer5.AddMany([(select_txt,0, wx.ALL,5), |
---|
112 | (self.selection_cbox,0, wx.ALL,5)]) |
---|
113 | def layout_perspective(self, list_of_perspective=[]): |
---|
114 | """ |
---|
115 | Layout widgets related to the list of plug-ins of the gui_manager |
---|
116 | """ |
---|
117 | if len(list_of_perspective)==0: |
---|
118 | return |
---|
119 | w, h = self.parent.GetSize() |
---|
120 | box_description_2= wx.StaticBox(self, -1, "Set Active Perspective") |
---|
121 | self.boxsizer_2 = wx.StaticBoxSizer(box_description_2, wx.HORIZONTAL) |
---|
122 | self.sizer_perspective = wx.GridBagSizer(5,5) |
---|
123 | self.boxsizer_2.Add(self.sizer_perspective) |
---|
124 | self.sizer2.Add(self.boxsizer_2,1, wx.ALL, 10) |
---|
125 | self.list_of_perspective = list_of_perspective |
---|
126 | self.sizer_perspective.Clear(True) |
---|
127 | self.list_rb_perspectives = [] |
---|
128 | |
---|
129 | nb_active_perspective = 0 |
---|
130 | if list_of_perspective: |
---|
131 | ix = 0 |
---|
132 | iy = 0 |
---|
133 | for perspective_name, is_active in list_of_perspective: |
---|
134 | |
---|
135 | if is_active: |
---|
136 | nb_active_perspective += 1 |
---|
137 | if nb_active_perspective == 1: |
---|
138 | rb = wx.RadioButton(self, -1, perspective_name, style=wx.RB_GROUP) |
---|
139 | rb.SetToolTipString("Data will be applied to this perspective") |
---|
140 | rb.SetValue(is_active) |
---|
141 | else: |
---|
142 | rb = wx.RadioButton(self, -1, perspective_name) |
---|
143 | rb.SetToolTipString("Data will be applied to this perspective") |
---|
144 | #only one perpesctive can be active |
---|
145 | rb.SetValue(False) |
---|
146 | |
---|
147 | self.Bind(wx.EVT_RADIOBUTTON, self.on_set_active_perspective, |
---|
148 | id=rb.GetId()) |
---|
149 | self.list_rb_perspectives.append(rb) |
---|
150 | self.sizer_perspective.Add(rb,(iy, ix),(1,1), |
---|
151 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10) |
---|
152 | iy += 1 |
---|
153 | else: |
---|
154 | rb = wx.RadioButton(self, -1, 'No Perspective', |
---|
155 | style=wx.RB_GROUP) |
---|
156 | rb.SetValue(True) |
---|
157 | rb.Disable() |
---|
158 | ix = 0 |
---|
159 | iy = 0 |
---|
160 | self.sizer_perspective.Add(rb,(iy, ix),(1,1), |
---|
161 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10) |
---|
162 | |
---|
163 | def _on_selection_type(self, event): |
---|
164 | """ |
---|
165 | Select data according to patterns |
---|
166 | """ |
---|
167 | option = self.selection_cbox.GetValue() |
---|
168 | if option == 'Select all Data': |
---|
169 | print "on select" |
---|
170 | |
---|
171 | def on_set_active_perspective(self, event): |
---|
172 | """ |
---|
173 | Select the active perspective |
---|
174 | """ |
---|
175 | ctrl = event.GetEventObject() |
---|
176 | |
---|
177 | def layout_button(self): |
---|
178 | """ |
---|
179 | Layout widgets related to buttons |
---|
180 | """ |
---|
181 | self.bt_import = wx.Button(self, wx.NewId(), "Send To") |
---|
182 | self.bt_import.SetToolTipString("Send set of Data to active perspective") |
---|
183 | wx.EVT_BUTTON(self, self.bt_import.GetId(), self.on_import) |
---|
184 | |
---|
185 | self.bt_append_plot = wx.Button(self, wx.NewId(), "Append Plot To") |
---|
186 | self.bt_append_plot.SetToolTipString("Plot the selected data in the active panel") |
---|
187 | wx.EVT_BUTTON(self, self.bt_append_plot.GetId(), self.on_append_plot) |
---|
188 | |
---|
189 | self.bt_plot = wx.Button(self, wx.NewId(), "New Plot") |
---|
190 | self.bt_plot.SetToolTipString("To trigger plotting") |
---|
191 | wx.EVT_BUTTON(self, self.bt_plot.GetId(), self.on_plot) |
---|
192 | |
---|
193 | self.bt_remove = wx.Button(self, wx.NewId(), "Delete Data") |
---|
194 | self.bt_remove.SetToolTipString("Delete data from the application") |
---|
195 | wx.EVT_BUTTON(self, self.bt_remove.GetId(), self.on_remove) |
---|
196 | |
---|
197 | self.tctrl_perspective = wx.StaticText(self, -1, 'No Active Application') |
---|
198 | self.tctrl_perspective.SetToolTipString("Active Application") |
---|
199 | self.tctrl_plotpanel = wx.StaticText(self, -1, 'No Plot panel on focus') |
---|
200 | self.tctrl_plotpanel.SetToolTipString("Active Plot Panel") |
---|
201 | #self.sizer3.AddMany([(self.bt_import,0, wx.ALL,5), |
---|
202 | # (self.bt_append_plot,0, wx.ALL,5), |
---|
203 | # (self.bt_plot, 0, wx.ALL,5), |
---|
204 | # (self.bt_remove,0, wx.ALL,5)]) |
---|
205 | ix = 0 |
---|
206 | iy = 0 |
---|
207 | self.sizer3.Add(self.bt_import,( iy, ix),(1,1), |
---|
208 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
209 | ix += 1 |
---|
210 | self.sizer3.Add(self.tctrl_perspective,(iy, ix),(1,1), |
---|
211 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
212 | ix = 0 |
---|
213 | iy += 1 |
---|
214 | self.sizer3.Add(self.bt_append_plot,( iy, ix),(1,1), |
---|
215 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
216 | ix += 1 |
---|
217 | self.sizer3.Add(self.tctrl_plotpanel,(iy, ix),(1,1), |
---|
218 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
219 | ix = 0 |
---|
220 | iy += 1 |
---|
221 | self.sizer3.Add(self.bt_plot,( iy, ix),(1,1), |
---|
222 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
223 | ix = 0 |
---|
224 | iy += 1 |
---|
225 | self.sizer3.Add(self.bt_remove,( iy, ix),(1,1), |
---|
226 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
227 | |
---|
228 | |
---|
229 | def layout_batch(self): |
---|
230 | """ |
---|
231 | """ |
---|
232 | |
---|
233 | self.rb_single_mode = wx.RadioButton(self, -1, 'Single Mode', |
---|
234 | style=wx.RB_GROUP) |
---|
235 | self.rb_batch_mode = wx.RadioButton(self, -1, 'Batch Mode') |
---|
236 | |
---|
237 | self.rb_single_mode.SetValue(True) |
---|
238 | self.rb_batch_mode.SetValue(False) |
---|
239 | self.sizer4.AddMany([(self.rb_single_mode,0, wx.ALL,5), |
---|
240 | (self.rb_batch_mode,0, wx.ALL,5)]) |
---|
241 | |
---|
242 | def layout_list(self): |
---|
243 | """ |
---|
244 | Add a listcrtl in the panel |
---|
245 | """ |
---|
246 | self.tree_ctrl = DataTreeCtrl(parent=self) |
---|
247 | self.tree_ctrl.Bind(CT.EVT_TREE_ITEM_CHECKED, self.on_check_item) |
---|
248 | self.tree_ctrl.Bind(CT.EVT_TREE_ITEM_RIGHT_CLICK, self.on_right_click) |
---|
249 | self.sizer1.Add(self.tree_ctrl,1, wx.EXPAND|wx.ALL, 20) |
---|
250 | |
---|
251 | def on_right_click(self, event): |
---|
252 | """ |
---|
253 | """ |
---|
254 | ## Create context menu for data |
---|
255 | self.popUpMenu = wx.Menu() |
---|
256 | msg = "Edit %s"%str(self.tree_ctrl.GetItemText(event.GetItem())) |
---|
257 | id = wx.NewId() |
---|
258 | self.edit_data_mitem = wx.MenuItem(self.popUpMenu,id,msg, |
---|
259 | "Edit meta data") |
---|
260 | wx.EVT_MENU(self, id, self.on_edit_data) |
---|
261 | self.popUpMenu.AppendItem(self.edit_data_mitem) |
---|
262 | self.Bind(wx.EVT_CONTEXT_MENU, self.onContextMenu) |
---|
263 | |
---|
264 | def on_edit_data(self, event): |
---|
265 | """ |
---|
266 | """ |
---|
267 | print "editing data" |
---|
268 | |
---|
269 | def onContextMenu(self, event): |
---|
270 | """ |
---|
271 | Retrieve the state selected state |
---|
272 | """ |
---|
273 | # Skipping the save state functionality for release 0.9.0 |
---|
274 | #return |
---|
275 | pos = event.GetPosition() |
---|
276 | pos = self.ScreenToClient(pos) |
---|
277 | self.PopupMenu(self.popUpMenu, pos) |
---|
278 | |
---|
279 | def on_check_item(self, event): |
---|
280 | """ |
---|
281 | """ |
---|
282 | item = event.GetItem() |
---|
283 | name = self.tree_ctrl.GetItemText(item) |
---|
284 | |
---|
285 | def load_data_list(self, list): |
---|
286 | """ |
---|
287 | |
---|
288 | """ |
---|
289 | if not list: |
---|
290 | return |
---|
291 | |
---|
292 | for dstate in list.values(): |
---|
293 | data = dstate.get_data() |
---|
294 | if data is None: |
---|
295 | data_name = str(data) |
---|
296 | data_class = "unkonwn" |
---|
297 | else: |
---|
298 | data_name = data.name |
---|
299 | data_class = data.__class__.__name__ |
---|
300 | path = dstate.get_path() |
---|
301 | theory_list = dstate.get_theory() |
---|
302 | theory = None |
---|
303 | if theory_list: |
---|
304 | theory = theory_list[len(theory_list)-1] |
---|
305 | data_child = None |
---|
306 | for item in self.list_cb_data: |
---|
307 | if self.tree_ctrl.GetItemText(item) == data_name: |
---|
308 | data_child = item |
---|
309 | for process in data.process: |
---|
310 | theory_child = self.tree_ctrl.FindItem(data_child, |
---|
311 | "Available Theories")#, |
---|
312 | if theory is not None: |
---|
313 | av_theory_child =self.tree_ctrl.AppendItem(theory_child, |
---|
314 | theory.name,ct_type=1, data=theory.id) |
---|
315 | self.list_cb_theory.append(av_theory_child) |
---|
316 | av_theory_child_info =self.tree_ctrl.AppendItem(av_theory_child, |
---|
317 | 'info') |
---|
318 | for process in theory.process: |
---|
319 | info_time_child =self.tree_ctrl.AppendItem(av_theory_child_info, |
---|
320 | process.__str__()) |
---|
321 | |
---|
322 | break |
---|
323 | if data_child is None: |
---|
324 | data_child =self.tree_ctrl.InsertItem(self.tree_ctrl.root,0, |
---|
325 | data_name,ct_type=1, data=data.id) |
---|
326 | cb_data = self.tree_ctrl.GetFirstChild(self.tree_ctrl.root) |
---|
327 | item, id = cb_data |
---|
328 | item.Check(True) |
---|
329 | self.list_cb_data.append(item) |
---|
330 | data_info_child =self.tree_ctrl.AppendItem(data_child, 'info')#, |
---|
331 | #wnd=data_info_txt) |
---|
332 | info_class_child =self.tree_ctrl.AppendItem(data_info_child, |
---|
333 | 'Type: %s'%data_class) |
---|
334 | path_class_child =self.tree_ctrl.AppendItem(data_info_child, |
---|
335 | 'Path: %s'%str(path)) |
---|
336 | for process in data.process: |
---|
337 | info_time_child =self.tree_ctrl.AppendItem(data_info_child,process.__str__()) |
---|
338 | theory_child =self.tree_ctrl.AppendItem(data_child, "Available Theories") |
---|
339 | |
---|
340 | if theory_list: |
---|
341 | theory = theory_list[len(theory_list)-1] |
---|
342 | if theory is not None: |
---|
343 | av_theory_child =self.tree_ctrl.AppendItem(theory_child, |
---|
344 | theory.name,ct_type=1) |
---|
345 | self.list_cb_theory.append(av_theory_child) |
---|
346 | av_theory_child_info =self.tree_ctrl.AppendItem(av_theory_child, |
---|
347 | 'info') |
---|
348 | for process in theory.process: |
---|
349 | info_time_child =self.tree_ctrl.AppendItem(av_theory_child_info, |
---|
350 | process.__str__()) |
---|
351 | |
---|
352 | def set_data_helper(self): |
---|
353 | """ |
---|
354 | """ |
---|
355 | data_to_plot = [] |
---|
356 | for item in self.list_cb_data: |
---|
357 | if item.IsChecked(): |
---|
358 | |
---|
359 | data_to_plot.append(self.tree_ctrl.GetItemPyData(item)) |
---|
360 | theory_to_plot = [] |
---|
361 | for item in self.list_cb_theory: |
---|
362 | if item.IsChecked(): |
---|
363 | theory_to_plot.append(self.tree_ctrl.GetItemPyData(item)) |
---|
364 | return data_to_plot, theory_to_plot |
---|
365 | |
---|
366 | def on_remove(self, event): |
---|
367 | data_to_remove, theory_to_remove = self.set_data_helper() |
---|
368 | for item in self.list_cb_data: |
---|
369 | if item.IsChecked()and \ |
---|
370 | self.tree_ctrl.GetItemText(item) in data_to_remove: |
---|
371 | self.tree_ctrl.Delete(item) |
---|
372 | for item in self.list_cb_theory: |
---|
373 | if item.IsChecked()and \ |
---|
374 | self.tree_ctrl.GetItemText(item) in theory_to_remove: |
---|
375 | self.tree_ctrl.Delete(item) |
---|
376 | delete_all = False |
---|
377 | if data_to_remove: |
---|
378 | delete_all = True |
---|
379 | self.parent.delete_data(data_id=data_to_remove, |
---|
380 | theory_id=theory_to_remove, |
---|
381 | delete_all=delete_all) |
---|
382 | |
---|
383 | def on_import(self, event=None): |
---|
384 | """ |
---|
385 | Get all select data and set them to the current active perspetive |
---|
386 | """ |
---|
387 | self.post_helper(plot=False) |
---|
388 | |
---|
389 | def on_append_plot(self, event=None): |
---|
390 | """ |
---|
391 | append plot to plot panel on focus |
---|
392 | """ |
---|
393 | self.post_helper(plot=True, append=True) |
---|
394 | |
---|
395 | def on_plot(self, event=None): |
---|
396 | """ |
---|
397 | Send a list of data names to plot |
---|
398 | """ |
---|
399 | self.post_helper(plot=True) |
---|
400 | |
---|
401 | def set_active_perspective(self, name): |
---|
402 | """ |
---|
403 | set the active perspective |
---|
404 | """ |
---|
405 | self.tctrl_perspective.SetLabel(str(name)) |
---|
406 | |
---|
407 | def set_panel_on_focus(self, name): |
---|
408 | """ |
---|
409 | set the plot panel on focus |
---|
410 | """ |
---|
411 | self.tctrl_plotpanel.SetLabel(str(name)) |
---|
412 | |
---|
413 | def post_helper(self, plot=False, append=False): |
---|
414 | """ |
---|
415 | """ |
---|
416 | data_to_plot, theory_to_plot = self.set_data_helper() |
---|
417 | |
---|
418 | if self.parent is not None: |
---|
419 | self.parent.get_data_from_panel(data_id=data_to_plot, plot=plot, |
---|
420 | append=append) |
---|
421 | |
---|
422 | |
---|
423 | class DataFrame(wx.Frame): |
---|
424 | ## Internal name for the AUI manager |
---|
425 | window_name = "Data Panel" |
---|
426 | ## Title to appear on top of the window |
---|
427 | window_caption = "Data Panel" |
---|
428 | ## Flag to tell the GUI manager that this panel is not |
---|
429 | # tied to any perspective |
---|
430 | ALWAYS_ON = True |
---|
431 | |
---|
432 | def __init__(self, parent=None, owner=None, manager=None,size=(600, 600), |
---|
433 | list_of_perspective=[],list=[], *args, **kwds): |
---|
434 | #kwds['size'] = size |
---|
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 | size=size, |
---|
443 | list_of_perspective=list_of_perspective) |
---|
444 | |
---|
445 | def load_data_list(self, list=[]): |
---|
446 | """ |
---|
447 | Fill the list inside its panel |
---|
448 | """ |
---|
449 | self.panel.load_data_list(list=list) |
---|
450 | |
---|
451 | def layout_perspective(self, list_of_perspective=[]): |
---|
452 | """ |
---|
453 | """ |
---|
454 | self.panel.layout_perspective(list_of_perspective=list_of_perspective) |
---|
455 | |
---|
456 | |
---|
457 | from dataFitting import Data1D |
---|
458 | from dataFitting import Data2D, Theory1D |
---|
459 | from data_state import DataState |
---|
460 | import sys |
---|
461 | class State(): |
---|
462 | def __init__(self): |
---|
463 | self.msg = "" |
---|
464 | def __str__(self): |
---|
465 | self.msg = "model mane : model1\n" |
---|
466 | self.msg += "params : \n" |
---|
467 | self.msg += "name value\n" |
---|
468 | return msg |
---|
469 | def set_data_state(data, path, theory, state): |
---|
470 | dstate = DataState(data=data) |
---|
471 | dstate.set_path(path=path) |
---|
472 | dstate.set_theory(theory) |
---|
473 | dstate.set_state(state) |
---|
474 | return dstate |
---|
475 | """' |
---|
476 | data_list = [1:('Data1', 'Data1D', '07/01/2010', "theory1d", "state1"), |
---|
477 | ('Data2', 'Data2D', '07/03/2011', "theory2d", "state1"), |
---|
478 | ('Data3', 'Theory1D', '06/01/2010', "theory1d", "state1"), |
---|
479 | ('Data4', 'Theory2D', '07/01/2010', "theory2d", "state1"), |
---|
480 | ('Data5', 'Theory2D', '07/02/2010', "theory2d", "state1")] |
---|
481 | """ |
---|
482 | if __name__ == "__main__": |
---|
483 | |
---|
484 | app = wx.App() |
---|
485 | try: |
---|
486 | list_of_perspective = [('perspective2', False), ('perspective1', True)] |
---|
487 | data_list = {} |
---|
488 | data = Data1D() |
---|
489 | data.name = "data1" |
---|
490 | data.id = 1 |
---|
491 | #data.append_process() |
---|
492 | #process = data.process[len(data.process)-1] |
---|
493 | #process.data = "07/01/2010" |
---|
494 | theory = Theory1D() |
---|
495 | theory.id = 34 |
---|
496 | theory.pseudo_name = "theory1" |
---|
497 | path = "path1" |
---|
498 | state = State() |
---|
499 | data_list['1']=set_data_state(data, path,theory, state) |
---|
500 | |
---|
501 | data = Data1D() |
---|
502 | data.name = "data2" |
---|
503 | data.id = 76 |
---|
504 | theory = Theory1D() |
---|
505 | theory.id = 78 |
---|
506 | theory.name = "CoreShell 07/24/25" |
---|
507 | theory.pseudo_name = "CoreShell" |
---|
508 | path = "path2" |
---|
509 | state = State() |
---|
510 | data_list['2']=set_data_state(data, path,theory, state) |
---|
511 | data = Data1D() |
---|
512 | data.id = 3 |
---|
513 | data.name = "data2" |
---|
514 | theory = Theory1D() |
---|
515 | theory.name = "CoreShell" |
---|
516 | theory.pseudo_name = "CoreShell" |
---|
517 | theory.id = 4 |
---|
518 | #theory.append_process() |
---|
519 | #process = theory.process[len(theory.process)-1] |
---|
520 | #process.description = "this is my description" |
---|
521 | path = "path3" |
---|
522 | #data.append_process() |
---|
523 | #process = data.process[len(data.process)-1] |
---|
524 | #process.data = "07/22/2010" |
---|
525 | data_list['4']=set_data_state(data, path,theory, state) |
---|
526 | |
---|
527 | data = Data2D() |
---|
528 | data.name = "data3" |
---|
529 | data.id = 5 |
---|
530 | #data.append_process() |
---|
531 | #process = data.process[len(data.process)-1] |
---|
532 | #process.data = "07/01/2010" |
---|
533 | theory = Theory1D() |
---|
534 | theory.pseudo_name = "Cylinder" |
---|
535 | path = "path2" |
---|
536 | state = State() |
---|
537 | dstate= set_data_state(data, path,theory, state) |
---|
538 | theory = Theory1D() |
---|
539 | theory.id = 6 |
---|
540 | theory.pseudo_name = "Sphere" |
---|
541 | dstate.set_theory(theory) |
---|
542 | data_list['3']=dstate |
---|
543 | |
---|
544 | window = DataFrame(list=data_list) |
---|
545 | window.load_data_list(list=data_list) |
---|
546 | window.layout_perspective(list_of_perspective=list_of_perspective) |
---|
547 | window.Show(True) |
---|
548 | except: |
---|
549 | #raise |
---|
550 | print "error",sys.exc_value |
---|
551 | app.MainLoop() |
---|
552 | |
---|
553 | |
---|