[3c44c66] | 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 |
---|
[3feed3e] | 15 | import warnings |
---|
[3c44c66] | 16 | from wx.lib.scrolledpanel import ScrolledPanel |
---|
[3feed3e] | 17 | import wx.lib.agw.customtreectrl as CT |
---|
| 18 | from sans.guiframe.dataFitting import Data1D |
---|
| 19 | from sans.guiframe.dataFitting import Data2D |
---|
[52725d6] | 20 | from sans.guiframe.panel_base import PanelBase |
---|
[3feed3e] | 21 | |
---|
| 22 | PANEL_WIDTH = 200 |
---|
[5c4b674] | 23 | #PANEL_HEIGHT = 560 |
---|
[6d727ae] | 24 | PANEL_HEIGHT = 840 |
---|
[91bdf87] | 25 | STYLE_FLAG = wx.SUNKEN_BORDER|CT.TR_HAS_BUTTONS| CT.TR_HIDE_ROOT|\ |
---|
| 26 | wx.WANTS_CHARS|CT.TR_HAS_VARIABLE_ROW_HEIGHT |
---|
| 27 | |
---|
| 28 | |
---|
[3feed3e] | 29 | class DataTreeCtrl(CT.CustomTreeCtrl): |
---|
[3c44c66] | 30 | """ |
---|
| 31 | Check list control to be used for Data Panel |
---|
| 32 | """ |
---|
[6db811e] | 33 | def __init__(self, parent,*args, **kwds): |
---|
[73581ce] | 34 | #agwstyle is introduced in wx.2.8.11 but is not working for mac |
---|
| 35 | if sys.platform.count("darwin") != 0: |
---|
[91bdf87] | 36 | try: |
---|
| 37 | kwds['style'] = STYLE_FLAG |
---|
| 38 | except: |
---|
| 39 | raise |
---|
[73581ce] | 40 | else: |
---|
| 41 | #agwstyle is introduced in wx.2.8.11 .argument working only for windows |
---|
| 42 | try: |
---|
| 43 | kwds['agwStyle'] = STYLE_FLAG |
---|
| 44 | except: |
---|
| 45 | try: |
---|
| 46 | kwds['style'] = STYLE_FLAG |
---|
| 47 | except: |
---|
| 48 | raise |
---|
[91bdf87] | 49 | |
---|
[3feed3e] | 50 | CT.CustomTreeCtrl.__init__(self, parent, *args, **kwds) |
---|
| 51 | self.root = self.AddRoot("Available Data") |
---|
[3c44c66] | 52 | |
---|
[52725d6] | 53 | class DataPanel(ScrolledPanel, PanelBase): |
---|
[3c44c66] | 54 | """ |
---|
| 55 | This panel displays data available in the application and widgets to |
---|
| 56 | interact with data. |
---|
| 57 | """ |
---|
[3feed3e] | 58 | ## Internal name for the AUI manager |
---|
| 59 | window_name = "Data Panel" |
---|
| 60 | ## Title to appear on top of the window |
---|
| 61 | window_caption = "Data Panel" |
---|
| 62 | #type of window |
---|
| 63 | window_type = "Data Panel" |
---|
| 64 | ## Flag to tell the GUI manager that this panel is not |
---|
| 65 | # tied to any perspective |
---|
| 66 | #ALWAYS_ON = True |
---|
| 67 | def __init__(self, parent, list=[],list_of_perspective=[], |
---|
[5c4b674] | 68 | size=(PANEL_WIDTH,PANEL_HEIGHT), manager=None, *args, **kwds): |
---|
[3feed3e] | 69 | kwds['size']= size |
---|
[3c44c66] | 70 | ScrolledPanel.__init__(self, parent=parent, *args, **kwds) |
---|
[52725d6] | 71 | PanelBase.__init__(self) |
---|
[3c44c66] | 72 | self.SetupScrolling() |
---|
[ee2b492] | 73 | self.all_data1d = True |
---|
[3c44c66] | 74 | self.parent = parent |
---|
[3feed3e] | 75 | self.manager = manager |
---|
[3c44c66] | 76 | self.list_of_data = list |
---|
[3feed3e] | 77 | self.list_of_perspective = list_of_perspective |
---|
| 78 | self.list_rb_perspectives= [] |
---|
[c70eb7c] | 79 | self.list_cb_data = {} |
---|
| 80 | self.list_cb_theory = {} |
---|
| 81 | |
---|
[3feed3e] | 82 | self.owner = None |
---|
| 83 | self.do_layout() |
---|
[6db811e] | 84 | |
---|
[3feed3e] | 85 | def do_layout(self): |
---|
[6db811e] | 86 | """ |
---|
| 87 | """ |
---|
[3c44c66] | 88 | self.define_panel_structure() |
---|
| 89 | self.layout_selection() |
---|
[5c4b674] | 90 | self.layout_data_list() |
---|
[3c44c66] | 91 | self.layout_button() |
---|
[3feed3e] | 92 | self.layout_batch() |
---|
| 93 | |
---|
[3c44c66] | 94 | def define_panel_structure(self): |
---|
| 95 | """ |
---|
| 96 | Define the skeleton of the panel |
---|
| 97 | """ |
---|
[3feed3e] | 98 | w, h = self.parent.GetSize() |
---|
[3c44c66] | 99 | self.vbox = wx.BoxSizer(wx.VERTICAL) |
---|
| 100 | self.sizer1 = wx.BoxSizer(wx.VERTICAL) |
---|
[cc061c3] | 101 | self.sizer1.SetMinSize((w/12, h*2/5)) |
---|
| 102 | |
---|
[3feed3e] | 103 | self.sizer2 = wx.BoxSizer(wx.VERTICAL) |
---|
| 104 | self.sizer3 = wx.GridBagSizer(5,5) |
---|
[3c44c66] | 105 | self.sizer4 = wx.BoxSizer(wx.HORIZONTAL) |
---|
[18ec684] | 106 | self.sizer5 = wx.BoxSizer(wx.VERTICAL) |
---|
| 107 | |
---|
[3feed3e] | 108 | self.vbox.Add(self.sizer5, 0,wx.EXPAND|wx.ALL,10) |
---|
| 109 | self.vbox.Add(self.sizer1, 0,wx.EXPAND|wx.ALL,0) |
---|
| 110 | self.vbox.Add(self.sizer2, 0,wx.EXPAND|wx.ALL,10) |
---|
| 111 | self.vbox.Add(self.sizer3, 0,wx.EXPAND|wx.ALL,10) |
---|
| 112 | self.vbox.Add(self.sizer4, 0,wx.EXPAND|wx.ALL,10) |
---|
| 113 | |
---|
[3c44c66] | 114 | self.SetSizer(self.vbox) |
---|
| 115 | |
---|
[3feed3e] | 116 | def layout_selection(self): |
---|
[3c44c66] | 117 | """ |
---|
| 118 | """ |
---|
[3feed3e] | 119 | select_txt = wx.StaticText(self, -1, 'Selection Options') |
---|
[bffa3d0] | 120 | select_txt.SetForegroundColour('blue') |
---|
[3feed3e] | 121 | self.selection_cbox = wx.ComboBox(self, -1, style=wx.CB_READONLY) |
---|
| 122 | list_of_options = ['Select all Data', |
---|
| 123 | 'Unselect all Data', |
---|
| 124 | 'Select all Data 1D', |
---|
| 125 | 'Unselect all Data 1D', |
---|
| 126 | 'Select all Data 2D', |
---|
| 127 | 'Unselect all Data 2D' ] |
---|
| 128 | for option in list_of_options: |
---|
| 129 | self.selection_cbox.Append(str(option)) |
---|
[18ec684] | 130 | self.selection_cbox.SetValue('Select all Data') |
---|
[3feed3e] | 131 | wx.EVT_COMBOBOX(self.selection_cbox,-1, self._on_selection_type) |
---|
| 132 | self.sizer5.AddMany([(select_txt,0, wx.ALL,5), |
---|
| 133 | (self.selection_cbox,0, wx.ALL,5)]) |
---|
| 134 | def layout_perspective(self, list_of_perspective=[]): |
---|
[3c44c66] | 135 | """ |
---|
| 136 | Layout widgets related to the list of plug-ins of the gui_manager |
---|
| 137 | """ |
---|
[3feed3e] | 138 | if len(list_of_perspective)==0: |
---|
| 139 | return |
---|
| 140 | w, h = self.parent.GetSize() |
---|
| 141 | box_description_2= wx.StaticBox(self, -1, "Set Active Perspective") |
---|
| 142 | self.boxsizer_2 = wx.StaticBoxSizer(box_description_2, wx.HORIZONTAL) |
---|
| 143 | self.sizer_perspective = wx.GridBagSizer(5,5) |
---|
| 144 | self.boxsizer_2.Add(self.sizer_perspective) |
---|
| 145 | self.sizer2.Add(self.boxsizer_2,1, wx.ALL, 10) |
---|
| 146 | self.list_of_perspective = list_of_perspective |
---|
| 147 | self.sizer_perspective.Clear(True) |
---|
| 148 | self.list_rb_perspectives = [] |
---|
| 149 | |
---|
| 150 | nb_active_perspective = 0 |
---|
[3c44c66] | 151 | if list_of_perspective: |
---|
| 152 | ix = 0 |
---|
| 153 | iy = 0 |
---|
[3feed3e] | 154 | for perspective_name, is_active in list_of_perspective: |
---|
| 155 | |
---|
| 156 | if is_active: |
---|
| 157 | nb_active_perspective += 1 |
---|
| 158 | if nb_active_perspective == 1: |
---|
[ea5692d] | 159 | rb = wx.RadioButton(self, -1, perspective_name, |
---|
| 160 | style=wx.RB_GROUP) |
---|
[3feed3e] | 161 | rb.SetToolTipString("Data will be applied to this perspective") |
---|
| 162 | rb.SetValue(is_active) |
---|
| 163 | else: |
---|
| 164 | rb = wx.RadioButton(self, -1, perspective_name) |
---|
| 165 | rb.SetToolTipString("Data will be applied to this perspective") |
---|
| 166 | #only one perpesctive can be active |
---|
| 167 | rb.SetValue(False) |
---|
| 168 | |
---|
| 169 | self.Bind(wx.EVT_RADIOBUTTON, self.on_set_active_perspective, |
---|
| 170 | id=rb.GetId()) |
---|
| 171 | self.list_rb_perspectives.append(rb) |
---|
| 172 | self.sizer_perspective.Add(rb,(iy, ix),(1,1), |
---|
| 173 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10) |
---|
[3c44c66] | 174 | iy += 1 |
---|
| 175 | else: |
---|
| 176 | rb = wx.RadioButton(self, -1, 'No Perspective', |
---|
| 177 | style=wx.RB_GROUP) |
---|
| 178 | rb.SetValue(True) |
---|
| 179 | rb.Disable() |
---|
| 180 | ix = 0 |
---|
| 181 | iy = 0 |
---|
[3feed3e] | 182 | self.sizer_perspective.Add(rb,(iy, ix),(1,1), |
---|
[3c44c66] | 183 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10) |
---|
[3feed3e] | 184 | |
---|
| 185 | def _on_selection_type(self, event): |
---|
[3c44c66] | 186 | """ |
---|
[3feed3e] | 187 | Select data according to patterns |
---|
[3c44c66] | 188 | """ |
---|
[18ec684] | 189 | |
---|
| 190 | list_of_options = ['Select all Data', |
---|
| 191 | 'Unselect all Data', |
---|
| 192 | 'Select all Data 1D', |
---|
| 193 | 'Unselect all Data 1D', |
---|
| 194 | 'Select all Data 2D', |
---|
| 195 | 'Unselect all Data 2D' ] |
---|
[3feed3e] | 196 | option = self.selection_cbox.GetValue() |
---|
[18ec684] | 197 | |
---|
| 198 | pos = self.selection_cbox.GetSelection() |
---|
| 199 | if pos == wx.NOT_FOUND: |
---|
| 200 | return |
---|
| 201 | option = self.selection_cbox.GetString(pos) |
---|
[b5e79f7] | 202 | for item in self.list_cb_data.values(): |
---|
| 203 | data_ctrl, _, _, _,_, _ = item |
---|
| 204 | data_id, data_class, _ = self.tree_ctrl.GetItemPyData(data_ctrl) |
---|
[18ec684] | 205 | if option == 'Select all Data': |
---|
[b5e79f7] | 206 | self.tree_ctrl.CheckItem(data_ctrl, True) |
---|
[18ec684] | 207 | elif option == 'Unselect all Data': |
---|
[b5e79f7] | 208 | self.tree_ctrl.CheckItem(data_ctrl, False) |
---|
[18ec684] | 209 | elif option == 'Select all Data 1D': |
---|
| 210 | if data_class == 'Data1D': |
---|
[b5e79f7] | 211 | self.tree_ctrl.CheckItem(data_ctrl, True) |
---|
[18ec684] | 212 | elif option == 'Unselect all Data 1D': |
---|
[c70eb7c] | 213 | if data_class == 'Data1D': |
---|
[b5e79f7] | 214 | self.tree_ctrl.CheckItem(data_ctrl, False) |
---|
[18ec684] | 215 | elif option == 'Select all Data 1D': |
---|
[c70eb7c] | 216 | if data_class == 'Data1D': |
---|
[b5e79f7] | 217 | self.tree_ctrl.CheckItem(data_ctrl, True) |
---|
[18ec684] | 218 | elif option == 'Select all Data 2D': |
---|
| 219 | if data_class == 'Data2D': |
---|
[b5e79f7] | 220 | self.tree_ctrl.CheckItem(data_ctrl, True) |
---|
[18ec684] | 221 | elif option == 'Unselect all Data 2D': |
---|
| 222 | if data_class == 'Data2D': |
---|
[b5e79f7] | 223 | self.tree_ctrl.CheckItem(data_ctrl, False) |
---|
[18ec684] | 224 | |
---|
[3feed3e] | 225 | def on_set_active_perspective(self, event): |
---|
[3c44c66] | 226 | """ |
---|
[3feed3e] | 227 | Select the active perspective |
---|
| 228 | """ |
---|
| 229 | ctrl = event.GetEventObject() |
---|
[3c44c66] | 230 | |
---|
| 231 | def layout_button(self): |
---|
| 232 | """ |
---|
| 233 | Layout widgets related to buttons |
---|
| 234 | """ |
---|
[3feed3e] | 235 | self.bt_import = wx.Button(self, wx.NewId(), "Send To") |
---|
| 236 | self.bt_import.SetToolTipString("Send set of Data to active perspective") |
---|
[3c44c66] | 237 | wx.EVT_BUTTON(self, self.bt_import.GetId(), self.on_import) |
---|
| 238 | |
---|
[3feed3e] | 239 | self.bt_append_plot = wx.Button(self, wx.NewId(), "Append Plot To") |
---|
[213892bc] | 240 | self.bt_append_plot.SetToolTipString("Plot the selected data in the active panel") |
---|
| 241 | wx.EVT_BUTTON(self, self.bt_append_plot.GetId(), self.on_append_plot) |
---|
[3feed3e] | 242 | |
---|
| 243 | self.bt_plot = wx.Button(self, wx.NewId(), "New Plot") |
---|
[3c44c66] | 244 | self.bt_plot.SetToolTipString("To trigger plotting") |
---|
| 245 | wx.EVT_BUTTON(self, self.bt_plot.GetId(), self.on_plot) |
---|
| 246 | |
---|
[c70eb7c] | 247 | self.bt_freeze = wx.Button(self, wx.NewId(), "Freeze") |
---|
| 248 | self.bt_freeze.SetToolTipString("To trigger freeze") |
---|
| 249 | wx.EVT_BUTTON(self, self.bt_freeze.GetId(), self.on_freeze) |
---|
| 250 | |
---|
[d828481] | 251 | self.bt_remove = wx.Button(self, wx.NewId(), "Remove Data") |
---|
| 252 | self.bt_remove.SetToolTipString("Remove data from the application") |
---|
[3feed3e] | 253 | wx.EVT_BUTTON(self, self.bt_remove.GetId(), self.on_remove) |
---|
| 254 | |
---|
[c5e84fb] | 255 | self.tctrl_perspective = wx.StaticText(self, -1, 'No Active Application') |
---|
[3feed3e] | 256 | self.tctrl_perspective.SetToolTipString("Active Application") |
---|
[213892bc] | 257 | self.tctrl_plotpanel = wx.StaticText(self, -1, 'No Plot panel on focus') |
---|
| 258 | self.tctrl_plotpanel.SetToolTipString("Active Plot Panel") |
---|
[18ec684] | 259 | |
---|
[3feed3e] | 260 | ix = 0 |
---|
| 261 | iy = 0 |
---|
| 262 | self.sizer3.Add(self.bt_import,( iy, ix),(1,1), |
---|
| 263 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 264 | ix += 1 |
---|
| 265 | self.sizer3.Add(self.tctrl_perspective,(iy, ix),(1,1), |
---|
| 266 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 267 | ix = 0 |
---|
| 268 | iy += 1 |
---|
| 269 | self.sizer3.Add(self.bt_append_plot,( iy, ix),(1,1), |
---|
| 270 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 271 | ix += 1 |
---|
| 272 | self.sizer3.Add(self.tctrl_plotpanel,(iy, ix),(1,1), |
---|
| 273 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 274 | ix = 0 |
---|
| 275 | iy += 1 |
---|
| 276 | self.sizer3.Add(self.bt_plot,( iy, ix),(1,1), |
---|
| 277 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 278 | ix = 0 |
---|
| 279 | iy += 1 |
---|
[c70eb7c] | 280 | self.sizer3.Add(self.bt_freeze,( iy, ix),(1,1), |
---|
| 281 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 282 | ix = 0 |
---|
| 283 | iy += 1 |
---|
[3feed3e] | 284 | self.sizer3.Add(self.bt_remove,( iy, ix),(1,1), |
---|
| 285 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 286 | |
---|
[18ec684] | 287 | |
---|
[3feed3e] | 288 | |
---|
| 289 | def layout_batch(self): |
---|
[3c44c66] | 290 | """ |
---|
| 291 | """ |
---|
[3feed3e] | 292 | |
---|
| 293 | self.rb_single_mode = wx.RadioButton(self, -1, 'Single Mode', |
---|
| 294 | style=wx.RB_GROUP) |
---|
| 295 | self.rb_batch_mode = wx.RadioButton(self, -1, 'Batch Mode') |
---|
| 296 | |
---|
| 297 | self.rb_single_mode.SetValue(True) |
---|
| 298 | self.rb_batch_mode.SetValue(False) |
---|
| 299 | self.sizer4.AddMany([(self.rb_single_mode,0, wx.ALL,5), |
---|
| 300 | (self.rb_batch_mode,0, wx.ALL,5)]) |
---|
| 301 | |
---|
[91bdf87] | 302 | def old_layout_data_list(self): |
---|
[3c44c66] | 303 | """ |
---|
[3feed3e] | 304 | Add a listcrtl in the panel |
---|
[3c44c66] | 305 | """ |
---|
[6db811e] | 306 | self.tree_ctrl = DataTreeCtrl(parent=self) |
---|
[ee2b492] | 307 | self.tree_ctrl.Bind(CT.EVT_TREE_ITEM_CHECKING, self.on_check_item) |
---|
[ea5692d] | 308 | self.sizer1.Add(self.tree_ctrl,1, wx.EXPAND|wx.ALL, 10) |
---|
[71bd773] | 309 | self.theory_root = self.tree_ctrl.InsertItem(self.tree_ctrl.root,0, |
---|
| 310 | "THEORIES", ct_type=0) |
---|
[bffa3d0] | 311 | |
---|
[91bdf87] | 312 | def layout_data_list(self): |
---|
[bffa3d0] | 313 | """ |
---|
| 314 | Add a listcrtl in the panel |
---|
| 315 | """ |
---|
| 316 | tree_ctrl_label = wx.StaticText(self, -1, "Data") |
---|
| 317 | tree_ctrl_label.SetForegroundColour('blue') |
---|
| 318 | self.tree_ctrl = DataTreeCtrl(parent=self) |
---|
| 319 | self.tree_ctrl.Bind(CT.EVT_TREE_ITEM_CHECKING, self.on_check_item) |
---|
| 320 | tree_ctrl_theory_label = wx.StaticText(self, -1, "Theory") |
---|
| 321 | tree_ctrl_theory_label.SetForegroundColour('blue') |
---|
| 322 | self.tree_ctrl_theory = DataTreeCtrl(parent=self) |
---|
| 323 | self.tree_ctrl_theory.Bind(CT.EVT_TREE_ITEM_CHECKING, self.on_check_item) |
---|
| 324 | self.sizer1.Add(tree_ctrl_label, 0, wx.LEFT, 10) |
---|
| 325 | self.sizer1.Add(self.tree_ctrl, 1, wx.EXPAND|wx.ALL, 10) |
---|
| 326 | self.sizer1.Add(tree_ctrl_theory_label, 0, wx.LEFT, 10) |
---|
| 327 | self.sizer1.Add(self.tree_ctrl_theory, 1, wx.EXPAND|wx.ALL, 10) |
---|
| 328 | |
---|
[3feed3e] | 329 | def onContextMenu(self, event): |
---|
[3c44c66] | 330 | """ |
---|
[3feed3e] | 331 | Retrieve the state selected state |
---|
[3c44c66] | 332 | """ |
---|
[3feed3e] | 333 | # Skipping the save state functionality for release 0.9.0 |
---|
| 334 | #return |
---|
| 335 | pos = event.GetPosition() |
---|
| 336 | pos = self.ScreenToClient(pos) |
---|
| 337 | self.PopupMenu(self.popUpMenu, pos) |
---|
| 338 | |
---|
[ee2b492] | 339 | |
---|
[3feed3e] | 340 | def on_check_item(self, event): |
---|
[3c44c66] | 341 | """ |
---|
| 342 | """ |
---|
[3feed3e] | 343 | item = event.GetItem() |
---|
[ee2b492] | 344 | item.Check(not item.IsChecked()) |
---|
| 345 | self.enable_button(item) |
---|
| 346 | event.Skip() |
---|
| 347 | |
---|
| 348 | def enable_button(self, item): |
---|
| 349 | """ |
---|
| 350 | """ |
---|
| 351 | _, data_class, _= self.tree_ctrl.GetItemPyData(item) |
---|
| 352 | if item.IsChecked(): |
---|
| 353 | self.all_data1d &= (data_class != "Data2D") |
---|
| 354 | if self.all_data1d: |
---|
| 355 | self.bt_freeze.Enable() |
---|
| 356 | else: |
---|
| 357 | self.bt_freeze.Disable() |
---|
| 358 | else: |
---|
| 359 | self.all_data1d |= True |
---|
| 360 | self.all_data1d &= (data_class != "Data2D") |
---|
| 361 | if self.all_data1d: |
---|
| 362 | self.bt_freeze.Enable() |
---|
| 363 | else: |
---|
| 364 | self.bt_freeze.Disable() |
---|
| 365 | |
---|
[3feed3e] | 366 | def load_data_list(self, list): |
---|
[3c44c66] | 367 | """ |
---|
[c70eb7c] | 368 | add need data with its theory under the tree |
---|
[3c44c66] | 369 | """ |
---|
[3feed3e] | 370 | if not list: |
---|
| 371 | return |
---|
[3c44c66] | 372 | |
---|
[c70eb7c] | 373 | for state_id, dstate in list.iteritems(): |
---|
[3feed3e] | 374 | data = dstate.get_data() |
---|
[71bd773] | 375 | theory_list = dstate.get_theory() |
---|
| 376 | if data is not None: |
---|
[3feed3e] | 377 | data_name = data.name |
---|
[c70eb7c] | 378 | data_class = data.__class__.__name__ |
---|
| 379 | path = dstate.get_path() |
---|
| 380 | process_list = data.process |
---|
| 381 | data_id = data.id |
---|
[3feed3e] | 382 | |
---|
[71bd773] | 383 | if state_id not in self.list_cb_data: |
---|
| 384 | #new state |
---|
| 385 | data_c = self.tree_ctrl.InsertItem(self.tree_ctrl.root,0, |
---|
| 386 | data_name, ct_type=1, |
---|
| 387 | data=(data_id, data_class, state_id)) |
---|
| 388 | data_c.Check(True) |
---|
| 389 | self.enable_button(data_c) |
---|
| 390 | d_i_c = self.tree_ctrl.AppendItem(data_c, 'Info') |
---|
| 391 | i_c_c = self.tree_ctrl.AppendItem(d_i_c, |
---|
| 392 | 'Type: %s' % data_class) |
---|
| 393 | p_c_c = self.tree_ctrl.AppendItem(d_i_c, |
---|
| 394 | 'Path: %s' % str(path)) |
---|
| 395 | d_p_c = self.tree_ctrl.AppendItem(d_i_c, 'Process') |
---|
| 396 | |
---|
| 397 | for process in process_list: |
---|
| 398 | i_t_c = self.tree_ctrl.AppendItem(d_p_c, |
---|
| 399 | process.__str__()) |
---|
| 400 | theory_child = self.tree_ctrl.AppendItem(data_c, "THEORIES") |
---|
| 401 | |
---|
| 402 | self.list_cb_data[state_id] = [data_c, |
---|
| 403 | d_i_c, |
---|
| 404 | i_c_c, |
---|
| 405 | p_c_c, |
---|
| 406 | d_p_c, |
---|
| 407 | theory_child] |
---|
| 408 | else: |
---|
| 409 | data_ctrl_list = self.list_cb_data[state_id] |
---|
| 410 | #This state is already display replace it contains |
---|
| 411 | data_c, d_i_c, i_c_c, p_c_c, d_p_c, t_c = data_ctrl_list |
---|
| 412 | self.tree_ctrl.SetItemText(data_c, data_name) |
---|
| 413 | temp = (data_id, data_class, state_id) |
---|
| 414 | self.tree_ctrl.SetItemPyData(data_c, temp) |
---|
| 415 | self.tree_ctrl.SetItemText(i_c_c, 'Type: %s' % data_class) |
---|
| 416 | self.tree_ctrl.SetItemText(p_c_c, 'Path: %s' % str(path)) |
---|
| 417 | self.tree_ctrl.DeleteChildren(d_p_c) |
---|
| 418 | for process in process_list: |
---|
| 419 | i_t_c = self.tree_ctrl.AppendItem(d_p_c, |
---|
| 420 | process.__str__()) |
---|
[c70eb7c] | 421 | self.append_theory(state_id, theory_list) |
---|
[91bdf87] | 422 | |
---|
[c70eb7c] | 423 | |
---|
[91bdf87] | 424 | def old_append_theory(self, state_id, theory_list): |
---|
[c70eb7c] | 425 | """ |
---|
| 426 | append theory object under data from a state of id = state_id |
---|
| 427 | replace that theory if already displayed |
---|
| 428 | """ |
---|
| 429 | if not theory_list: |
---|
| 430 | return |
---|
| 431 | if state_id not in self.list_cb_data.keys(): |
---|
[71bd773] | 432 | root = self.theory_root |
---|
| 433 | else: |
---|
| 434 | item = self.list_cb_data[state_id] |
---|
| 435 | data_c, _, _, _, _, _ = item |
---|
| 436 | root = data_c |
---|
| 437 | if root is not None: |
---|
| 438 | self.append_theory_helper(root=root, |
---|
| 439 | state_id=state_id, |
---|
| 440 | theory_list=theory_list) |
---|
[91bdf87] | 441 | def append_theory(self, state_id, theory_list): |
---|
[bffa3d0] | 442 | """ |
---|
| 443 | append theory object under data from a state of id = state_id |
---|
| 444 | replace that theory if already displayed |
---|
| 445 | """ |
---|
| 446 | if not theory_list: |
---|
| 447 | return |
---|
| 448 | if state_id not in self.list_cb_data.keys(): |
---|
| 449 | root = self.tree_ctrl_theory.root |
---|
[91bdf87] | 450 | tree = self.tree_ctrl_theory |
---|
[bffa3d0] | 451 | else: |
---|
| 452 | item = self.list_cb_data[state_id] |
---|
| 453 | data_c, _, _, _, _, _ = item |
---|
| 454 | root = data_c |
---|
[91bdf87] | 455 | tree = self.tree_ctrl |
---|
[bffa3d0] | 456 | if root is not None: |
---|
[91bdf87] | 457 | self.append_theory_helper(tree=tree, root=root, |
---|
[bffa3d0] | 458 | state_id=state_id, |
---|
| 459 | theory_list=theory_list) |
---|
| 460 | |
---|
[71bd773] | 461 | |
---|
[91bdf87] | 462 | def append_theory_helper(self, tree, root, state_id, theory_list): |
---|
[71bd773] | 463 | """ |
---|
| 464 | """ |
---|
| 465 | if state_id in self.list_cb_theory.keys(): |
---|
[c70eb7c] | 466 | #update current list of theory for this data |
---|
[71bd773] | 467 | theory_list_ctrl = self.list_cb_theory[state_id] |
---|
[c70eb7c] | 468 | |
---|
| 469 | for theory_id, item in theory_list.iteritems(): |
---|
[e88ebfd] | 470 | theory_data, theory_state = item |
---|
[c70eb7c] | 471 | if theory_data is None: |
---|
| 472 | name = "Unknown" |
---|
| 473 | theory_class = "Unknown" |
---|
| 474 | theory_id = "Unknown" |
---|
| 475 | temp = (None, None, None) |
---|
| 476 | else: |
---|
| 477 | name = theory_data.name |
---|
| 478 | theory_class = theory_data.__class__.__name__ |
---|
| 479 | theory_id = theory_data.id |
---|
[ee2b492] | 480 | #if theory_state is not None: |
---|
| 481 | # name = theory_state.model.name |
---|
[c70eb7c] | 482 | temp = (theory_id, theory_class, state_id) |
---|
| 483 | if theory_id not in theory_list_ctrl: |
---|
| 484 | #add new theory |
---|
[91bdf87] | 485 | t_child = tree.AppendItem(root, |
---|
[c70eb7c] | 486 | name, ct_type=1, data=temp) |
---|
[91bdf87] | 487 | t_i_c = tree.AppendItem(t_child, 'Info') |
---|
| 488 | i_c_c = tree.AppendItem(t_i_c, |
---|
[c70eb7c] | 489 | 'Type: %s' % theory_class) |
---|
[91bdf87] | 490 | t_p_c = tree.AppendItem(t_i_c, 'Process') |
---|
[c70eb7c] | 491 | |
---|
| 492 | for process in theory_data.process: |
---|
[91bdf87] | 493 | i_t_c = tree.AppendItem(t_p_c, |
---|
[c70eb7c] | 494 | process.__str__()) |
---|
| 495 | theory_list_ctrl[theory_id] = [t_child, |
---|
| 496 | i_c_c, |
---|
| 497 | t_p_c] |
---|
| 498 | else: |
---|
| 499 | #replace theory |
---|
| 500 | t_child, i_c_c, t_p_c = theory_list_ctrl[theory_id] |
---|
[91bdf87] | 501 | tree.SetItemText(t_child, name) |
---|
| 502 | tree.SetItemPyData(t_child, temp) |
---|
| 503 | tree.SetItemText(i_c_c, 'Type: %s' % theory_class) |
---|
| 504 | tree.DeleteChildren(t_p_c) |
---|
[c70eb7c] | 505 | for process in theory_data.process: |
---|
[91bdf87] | 506 | i_t_c = tree.AppendItem(t_p_c, |
---|
[c70eb7c] | 507 | process.__str__()) |
---|
| 508 | |
---|
| 509 | else: |
---|
| 510 | #data didn't have a theory associated it before |
---|
| 511 | theory_list_ctrl = {} |
---|
| 512 | for theory_id, item in theory_list.iteritems(): |
---|
[e88ebfd] | 513 | theory_data, theory_state = item |
---|
[c70eb7c] | 514 | if theory_data is not None: |
---|
[e88ebfd] | 515 | name = theory_data.name |
---|
[c70eb7c] | 516 | theory_class = theory_data.__class__.__name__ |
---|
[e88ebfd] | 517 | theory_id = theory_data.id |
---|
[ee2b492] | 518 | #if theory_state is not None: |
---|
| 519 | # name = theory_state.model.name |
---|
[e88ebfd] | 520 | temp = (theory_id, theory_class, state_id) |
---|
[91bdf87] | 521 | t_child = tree.AppendItem(root, |
---|
[e88ebfd] | 522 | name, ct_type=1, |
---|
[c70eb7c] | 523 | data=(theory_data.id, theory_class, state_id)) |
---|
[91bdf87] | 524 | t_i_c = tree.AppendItem(t_child, 'Info') |
---|
| 525 | i_c_c = tree.AppendItem(t_i_c, |
---|
[c70eb7c] | 526 | 'Type: %s' % theory_class) |
---|
[91bdf87] | 527 | t_p_c = tree.AppendItem(t_i_c, 'Process') |
---|
[c70eb7c] | 528 | |
---|
| 529 | for process in theory_data.process: |
---|
[91bdf87] | 530 | i_t_c = tree.AppendItem(t_p_c, |
---|
[c70eb7c] | 531 | process.__str__()) |
---|
| 532 | |
---|
| 533 | theory_list_ctrl[theory_id] = [t_child, i_c_c, t_p_c] |
---|
[71bd773] | 534 | #self.list_cb_theory[data_id] = theory_list_ctrl |
---|
| 535 | self.list_cb_theory[state_id] = theory_list_ctrl |
---|
[91bdf87] | 536 | |
---|
[c70eb7c] | 537 | |
---|
[ee2b492] | 538 | |
---|
[3feed3e] | 539 | def set_data_helper(self): |
---|
[3c44c66] | 540 | """ |
---|
| 541 | """ |
---|
[3feed3e] | 542 | data_to_plot = [] |
---|
[e88ebfd] | 543 | state_to_plot = [] |
---|
| 544 | theory_to_plot = [] |
---|
[c70eb7c] | 545 | for value in self.list_cb_data.values(): |
---|
| 546 | item, _, _, _, _, _ = value |
---|
[3feed3e] | 547 | if item.IsChecked(): |
---|
[3658717e] | 548 | data_id, _, state_id = self.tree_ctrl.GetItemPyData(item) |
---|
| 549 | data_to_plot.append(data_id) |
---|
| 550 | if state_id not in state_to_plot: |
---|
| 551 | state_to_plot.append(state_id) |
---|
| 552 | |
---|
[c70eb7c] | 553 | for theory_dict in self.list_cb_theory.values(): |
---|
| 554 | for key, value in theory_dict.iteritems(): |
---|
| 555 | item, _, _ = value |
---|
| 556 | if item.IsChecked(): |
---|
[e88ebfd] | 557 | theory_id, _, state_id = self.tree_ctrl.GetItemPyData(item) |
---|
[c70eb7c] | 558 | theory_to_plot.append(theory_id) |
---|
[e88ebfd] | 559 | if state_id not in state_to_plot: |
---|
| 560 | state_to_plot.append(state_id) |
---|
| 561 | return data_to_plot, theory_to_plot, state_to_plot |
---|
[3feed3e] | 562 | |
---|
[c70eb7c] | 563 | def remove_by_id(self, id): |
---|
| 564 | """ |
---|
| 565 | """ |
---|
| 566 | for item in self.list_cb_data.values(): |
---|
| 567 | data_c, _, _, _, _, theory_child = item |
---|
| 568 | data_id, _, state_id = self.tree_ctrl.GetItemPyData(data_c) |
---|
| 569 | if id == data_id: |
---|
| 570 | self.tree_ctrl.Delete(data_c) |
---|
| 571 | del self.list_cb_data[state_id] |
---|
| 572 | del self.list_cb_theory[data_id] |
---|
[ae83ad3] | 573 | |
---|
[3feed3e] | 574 | def on_remove(self, event): |
---|
[18ec684] | 575 | """ |
---|
[3658717e] | 576 | Get a list of item checked and remove them from the treectrl |
---|
| 577 | Ask the parent to remove reference to this item |
---|
[18ec684] | 578 | """ |
---|
[665c083] | 579 | data_to_remove, theory_to_remove, _ = self.set_data_helper() |
---|
| 580 | data_key = [] |
---|
| 581 | theory_key = [] |
---|
[3658717e] | 582 | #remove data from treectrl |
---|
| 583 | for d_key, item in self.list_cb_data.iteritems(): |
---|
[665c083] | 584 | data_c, d_i_c, i_c_c, p_c_c, d_p_c, t_c = item |
---|
| 585 | if data_c.IsChecked(): |
---|
| 586 | self.tree_ctrl.Delete(data_c) |
---|
[3658717e] | 587 | data_key.append(d_key) |
---|
| 588 | if d_key in self.list_cb_theory.keys(): |
---|
| 589 | theory_list_ctrl = self.list_cb_theory[d_key] |
---|
| 590 | theory_to_remove += theory_list_ctrl.keys() |
---|
| 591 | # Remove theory from treectrl |
---|
| 592 | for t_key, theory_dict in self.list_cb_theory.iteritems(): |
---|
| 593 | for key, value in theory_dict.iteritems(): |
---|
[665c083] | 594 | item, _, _ = value |
---|
| 595 | if item.IsChecked(): |
---|
| 596 | self.tree_ctrl.Delete(item) |
---|
| 597 | theory_key.append(key) |
---|
[3658717e] | 598 | #Remove data and related theory references |
---|
[665c083] | 599 | for key in data_key: |
---|
| 600 | del self.list_cb_data[key] |
---|
[3658717e] | 601 | if key in theory_key: |
---|
| 602 | del self.list_cb_theory[key] |
---|
| 603 | #remove theory references independently of data |
---|
[665c083] | 604 | for key in theory_key: |
---|
[3658717e] | 605 | for t_key, theory_dict in self.list_cb_theory.iteritems(): |
---|
[71bd773] | 606 | if key in theory_dict: |
---|
| 607 | del theory_dict[key] |
---|
[3658717e] | 608 | |
---|
[18ec684] | 609 | self.parent.remove_data(data_id=data_to_remove, |
---|
[665c083] | 610 | theory_id=theory_to_remove) |
---|
[3c44c66] | 611 | |
---|
[3feed3e] | 612 | def on_import(self, event=None): |
---|
[3c44c66] | 613 | """ |
---|
[3feed3e] | 614 | Get all select data and set them to the current active perspetive |
---|
[3c44c66] | 615 | """ |
---|
[e88ebfd] | 616 | data_id, theory_id, state_id = self.set_data_helper() |
---|
| 617 | self.parent.set_data(data_id) |
---|
[210e21f] | 618 | self.parent.set_data(data_id=state_id, theory_id=theory_id) |
---|
[e88ebfd] | 619 | |
---|
[213892bc] | 620 | def on_append_plot(self, event=None): |
---|
| 621 | """ |
---|
| 622 | append plot to plot panel on focus |
---|
| 623 | """ |
---|
[e88ebfd] | 624 | data_id, theory_id, state_id = self.set_data_helper() |
---|
| 625 | self.parent.plot_data(data_id=data_id, |
---|
| 626 | state_id=state_id, |
---|
| 627 | theory_id=theory_id, |
---|
| 628 | append=True) |
---|
[213892bc] | 629 | |
---|
[3feed3e] | 630 | def on_plot(self, event=None): |
---|
[3c44c66] | 631 | """ |
---|
[3feed3e] | 632 | Send a list of data names to plot |
---|
[3c44c66] | 633 | """ |
---|
[e88ebfd] | 634 | data_id, theory_id, state_id = self.set_data_helper() |
---|
| 635 | self.parent.plot_data(data_id=data_id, |
---|
| 636 | state_id=state_id, |
---|
| 637 | theory_id=theory_id, |
---|
| 638 | append=False) |
---|
[3feed3e] | 639 | |
---|
[c70eb7c] | 640 | def on_freeze(self, event): |
---|
| 641 | """ |
---|
| 642 | """ |
---|
[e88ebfd] | 643 | _, theory_id, state_id = self.set_data_helper() |
---|
[ee2b492] | 644 | self.parent.freeze(data_id=state_id, theory_id=theory_id) |
---|
[c70eb7c] | 645 | |
---|
[3feed3e] | 646 | def set_active_perspective(self, name): |
---|
[3c44c66] | 647 | """ |
---|
[3feed3e] | 648 | set the active perspective |
---|
[3c44c66] | 649 | """ |
---|
[3feed3e] | 650 | self.tctrl_perspective.SetLabel(str(name)) |
---|
[c5e84fb] | 651 | |
---|
[3feed3e] | 652 | def set_panel_on_focus(self, name): |
---|
[3c44c66] | 653 | """ |
---|
[3feed3e] | 654 | set the plot panel on focus |
---|
[3c44c66] | 655 | """ |
---|
[3feed3e] | 656 | self.tctrl_plotpanel.SetLabel(str(name)) |
---|
[e88ebfd] | 657 | |
---|
[c70eb7c] | 658 | |
---|
[3feed3e] | 659 | |
---|
[3c44c66] | 660 | |
---|
| 661 | class DataFrame(wx.Frame): |
---|
[3feed3e] | 662 | ## Internal name for the AUI manager |
---|
| 663 | window_name = "Data Panel" |
---|
| 664 | ## Title to appear on top of the window |
---|
| 665 | window_caption = "Data Panel" |
---|
| 666 | ## Flag to tell the GUI manager that this panel is not |
---|
| 667 | # tied to any perspective |
---|
| 668 | ALWAYS_ON = True |
---|
| 669 | |
---|
[cc061c3] | 670 | def __init__(self, parent=None, owner=None, manager=None,size=(400, 800), |
---|
[3feed3e] | 671 | list_of_perspective=[],list=[], *args, **kwds): |
---|
[cc061c3] | 672 | kwds['size'] = size |
---|
[3c44c66] | 673 | kwds['id'] = -1 |
---|
[3feed3e] | 674 | kwds['title']= "Loaded Data" |
---|
[3c44c66] | 675 | wx.Frame.__init__(self, parent=parent, *args, **kwds) |
---|
| 676 | self.parent = parent |
---|
| 677 | self.owner = owner |
---|
| 678 | self.manager = manager |
---|
[32c0841] | 679 | self.panel = DataPanel(parent=self, |
---|
[cc061c3] | 680 | #size=size, |
---|
[32c0841] | 681 | list_of_perspective=list_of_perspective) |
---|
[3feed3e] | 682 | |
---|
| 683 | def load_data_list(self, list=[]): |
---|
[3c44c66] | 684 | """ |
---|
| 685 | Fill the list inside its panel |
---|
| 686 | """ |
---|
[3feed3e] | 687 | self.panel.load_data_list(list=list) |
---|
[3c44c66] | 688 | |
---|
[3feed3e] | 689 | def layout_perspective(self, list_of_perspective=[]): |
---|
[3c44c66] | 690 | """ |
---|
| 691 | """ |
---|
| 692 | self.panel.layout_perspective(list_of_perspective=list_of_perspective) |
---|
[c70eb7c] | 693 | |
---|
| 694 | |
---|
[32c0841] | 695 | |
---|
[3feed3e] | 696 | |
---|
| 697 | from dataFitting import Data1D |
---|
| 698 | from dataFitting import Data2D, Theory1D |
---|
| 699 | from data_state import DataState |
---|
| 700 | import sys |
---|
| 701 | class State(): |
---|
| 702 | def __init__(self): |
---|
| 703 | self.msg = "" |
---|
| 704 | def __str__(self): |
---|
| 705 | self.msg = "model mane : model1\n" |
---|
| 706 | self.msg += "params : \n" |
---|
| 707 | self.msg += "name value\n" |
---|
| 708 | return msg |
---|
[71bd773] | 709 | def set_data_state(data=None, path=None, theory=None, state=None): |
---|
[3feed3e] | 710 | dstate = DataState(data=data) |
---|
| 711 | dstate.set_path(path=path) |
---|
[c70eb7c] | 712 | dstate.set_theory(theory, state) |
---|
| 713 | |
---|
[3feed3e] | 714 | return dstate |
---|
| 715 | """' |
---|
| 716 | data_list = [1:('Data1', 'Data1D', '07/01/2010', "theory1d", "state1"), |
---|
| 717 | ('Data2', 'Data2D', '07/03/2011', "theory2d", "state1"), |
---|
| 718 | ('Data3', 'Theory1D', '06/01/2010', "theory1d", "state1"), |
---|
| 719 | ('Data4', 'Theory2D', '07/01/2010', "theory2d", "state1"), |
---|
| 720 | ('Data5', 'Theory2D', '07/02/2010', "theory2d", "state1")] |
---|
| 721 | """ |
---|
[3c44c66] | 722 | if __name__ == "__main__": |
---|
[3feed3e] | 723 | |
---|
[3c44c66] | 724 | app = wx.App() |
---|
[3feed3e] | 725 | try: |
---|
| 726 | list_of_perspective = [('perspective2', False), ('perspective1', True)] |
---|
| 727 | data_list = {} |
---|
[c70eb7c] | 728 | # state 1 |
---|
[ee2b492] | 729 | data = Data2D() |
---|
| 730 | data.name = "data2" |
---|
[584c4c4] | 731 | data.id = 1 |
---|
[c70eb7c] | 732 | data.append_empty_process() |
---|
| 733 | process = data.process[len(data.process)-1] |
---|
| 734 | process.data = "07/01/2010" |
---|
[ee2b492] | 735 | theory = Data2D() |
---|
[584c4c4] | 736 | theory.id = 34 |
---|
[c70eb7c] | 737 | theory.name = "theory1" |
---|
[3feed3e] | 738 | path = "path1" |
---|
| 739 | state = State() |
---|
| 740 | data_list['1']=set_data_state(data, path,theory, state) |
---|
[c70eb7c] | 741 | #state 2 |
---|
[ee2b492] | 742 | data = Data2D() |
---|
[3feed3e] | 743 | data.name = "data2" |
---|
[584c4c4] | 744 | data.id = 76 |
---|
[ee2b492] | 745 | theory = Data2D() |
---|
[584c4c4] | 746 | theory.id = 78 |
---|
[3feed3e] | 747 | theory.name = "CoreShell 07/24/25" |
---|
| 748 | path = "path2" |
---|
[c70eb7c] | 749 | #state3 |
---|
[3feed3e] | 750 | state = State() |
---|
| 751 | data_list['2']=set_data_state(data, path,theory, state) |
---|
| 752 | data = Data1D() |
---|
[584c4c4] | 753 | data.id = 3 |
---|
[3feed3e] | 754 | data.name = "data2" |
---|
| 755 | theory = Theory1D() |
---|
| 756 | theory.name = "CoreShell" |
---|
[584c4c4] | 757 | theory.id = 4 |
---|
[c70eb7c] | 758 | theory.append_empty_process() |
---|
| 759 | process = theory.process[len(theory.process)-1] |
---|
| 760 | process.description = "this is my description" |
---|
[3feed3e] | 761 | path = "path3" |
---|
[c70eb7c] | 762 | data.append_empty_process() |
---|
| 763 | process = data.process[len(data.process)-1] |
---|
| 764 | process.data = "07/22/2010" |
---|
[3feed3e] | 765 | data_list['4']=set_data_state(data, path,theory, state) |
---|
[c70eb7c] | 766 | #state 4 |
---|
| 767 | temp_data_list = {} |
---|
| 768 | data.name = "data5 erasing data2" |
---|
| 769 | temp_data_list['4'] = set_data_state(data, path,theory, state) |
---|
| 770 | #state 5 |
---|
[3feed3e] | 771 | data = Data2D() |
---|
| 772 | data.name = "data3" |
---|
[584c4c4] | 773 | data.id = 5 |
---|
[c70eb7c] | 774 | data.append_empty_process() |
---|
| 775 | process = data.process[len(data.process)-1] |
---|
| 776 | process.data = "07/01/2010" |
---|
[3feed3e] | 777 | theory = Theory1D() |
---|
[c70eb7c] | 778 | theory.name = "Cylinder" |
---|
[3feed3e] | 779 | path = "path2" |
---|
| 780 | state = State() |
---|
| 781 | dstate= set_data_state(data, path,theory, state) |
---|
| 782 | theory = Theory1D() |
---|
[584c4c4] | 783 | theory.id = 6 |
---|
[c70eb7c] | 784 | theory.name = "CoreShell" |
---|
| 785 | dstate.set_theory(theory) |
---|
| 786 | theory = Theory1D() |
---|
| 787 | theory.id = 6 |
---|
| 788 | theory.name = "CoreShell replacing coreshell in data3" |
---|
[3feed3e] | 789 | dstate.set_theory(theory) |
---|
[c70eb7c] | 790 | data_list['3'] = dstate |
---|
| 791 | #state 6 |
---|
| 792 | data_list['6']=set_data_state(None, path,theory, state) |
---|
[71bd773] | 793 | data_list['6']=set_data_state(theory=theory, state=None) |
---|
| 794 | theory = Theory1D() |
---|
| 795 | theory.id = 7 |
---|
| 796 | data_list['6']=set_data_state(theory=theory, state=None) |
---|
| 797 | data_list['7']=set_data_state(theory=theory, state=None) |
---|
[3feed3e] | 798 | window = DataFrame(list=data_list) |
---|
[c70eb7c] | 799 | window.load_data_list(list=data_list) |
---|
| 800 | #window.layout_perspective(list_of_perspective=list_of_perspective) |
---|
[3feed3e] | 801 | window.Show(True) |
---|
[c70eb7c] | 802 | window.load_data_list(list=temp_data_list) |
---|
[3feed3e] | 803 | except: |
---|
| 804 | #raise |
---|
| 805 | print "error",sys.exc_value |
---|
[c70eb7c] | 806 | |
---|
[3c44c66] | 807 | app.MainLoop() |
---|
| 808 | |
---|
| 809 | |
---|