Changeset c70eb7c in sasview
- Timestamp:
- Mar 9, 2011 7:02:50 PM (14 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 8b6f489
- Parents:
- 99abf5d
- Location:
- guiframe
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/data_manager.py
r5c4b674 rc70eb7c 17 17 import logging 18 18 import os 19 import wx 20 import copy 21 19 22 from sans.guiframe.data_state import DataState 20 23 from sans.guiframe.utils import parse_name … … 23 26 from sans.guiframe.dataFitting import Data2D 24 27 25 import wx26 28 27 29 class DataManager(object): … … 42 44 self.data_name_dict = {} 43 45 46 def __str__(self): 47 _str = "" 48 _str += "No of states is %s \n" % str(len(self.stored_data)) 49 n_count = 0 50 for value in self.stored_data.values(): 51 n_count += 1 52 _str += "State No %s \n" % str(n_count) 53 _str += str(value) + "\n" 54 return _str 55 44 56 def create_gui_data(self, data, path=None): 45 57 """ … … 121 133 else: 122 134 data_state = DataState(data) 135 data_state.id = wx.NewId() 123 136 self.stored_data[data.id] = data_state 124 137 self._selected_data[data.id] = data_state 125 126 def set_auto_plot(self, flag=False):127 """128 When flag is true the data is plotted automatically129 """ 130 self._auto_set_data = flag131 132 def set_auto_set_data(self, flag=False):133 """134 When flag is true the data is send to the current perspective135 automatically136 """137 self._auto_set_data = flag138 138 139 140 def update_data(self, prev_data, new_data): 141 """ 142 """ 143 if prev_data.id not in self.stored_data.keys(): 144 return {} 145 data_state = self.stored_data[prev_data.id] 146 self.stored_data[new_data.id] = data_state.clone() 147 self.stored_data[new_data.id].data = new_data 148 if prev_data.id in self.stored_data.keys(): 149 del self.stored_data[prev_data.id] 150 return prev_data.id, {new_data.id: self.stored_data[new_data.id]} 151 139 152 def get_message(self): 140 153 """ … … 153 166 return self._selected_data 154 167 155 def append_theory(self, data_id, theory): 168 def append_theory(self, data_id, theory, state=None): 169 """ 170 """ 171 data_state = self.stored_data[data_id] 172 data_state.set_theory(theory_data=theory, 173 theory_state=state) 174 return {data_id: self.stored_data[data_id]} 175 176 def freeze_theory(self, data_id, theory_id): 177 """ 178 """ 179 new_data_state = [] 180 for d_id in data_id: 181 if d_id in self.stored_data: 182 data_state = self.stored_data[d_id] 183 theory_list = data_state.get_theory() 184 for t_id in theory_id: 185 if t_id in theory_list.keys(): 186 theory = theory_list[t_id] 187 new_theory = copy.deepcopy(theory) 188 new_theory.id = wx.NewId() 189 data_state.append_theory(new_theory) 190 theory_list.append(new_theory) 191 new_data_state.append(data_state) 192 msg = "Theory with ID %s " % str(theory_id) 193 msg += "couldn't not be frozen" 194 raise ValueError, msg 195 return new_data_state 196 197 198 def delete_data(self, data_id, theory_id=None, delete_all=False): 199 """ 200 """ 201 if data_id in self.stored_data.keys(): 202 data_state = self.stored_data[data_id] 203 if data_state.data.name in self.data_name_dict: 204 del self.data_name_dict[data_state.data.name] 205 del self.stored_data[data_id] 206 if data_id in self._selected_data.keys(): 207 data_state = self._selected_data[data_id] 208 if data_state.data.name in self.data_name_dict: 209 del self.data_name_dict[data_state.data.name] 210 del self._selected_data[data_id] 211 212 self.delete_theory(self, data_id, theory_id) 213 if delete_all: 214 self._selected_data = {} 215 self.stored_data = {} 216 self.data_name_dict = {} 217 218 def delete_theory(self, data_id, theory_id): 156 219 """ 157 220 """ 158 221 if data_id in self.stored_data: 159 222 data_state = self.stored_data[data_id] 160 data_state.set_theory(theory) 161 162 def delete_data(self, data_id, theory_id, delete_all): 163 """ 164 """ 165 if data_id in self.stored_data: 166 del self.stored_data[data_id] 223 theory_list = data_state.get_theory() 224 if theory_id in theory_list.key(): 225 del theory_list[theory_id] 167 226 if data_id in self._selected_data: 168 del self._selected_data 227 data_state = self._selected_data[data_id] 228 theory_list = data_state.get_theory() 229 if theory_id in theory_list.key(): 230 del theory_list[theory_id] 169 231 170 232 def delete_by_id(self, id_list=None): -
guiframe/data_panel.py
rcc061c3 rc70eb7c 59 59 self.list_of_perspective = list_of_perspective 60 60 self.list_rb_perspectives= [] 61 self.list_cb_data =[] 62 self.list_cb_theory =[] 61 self.list_cb_data = {} 62 self.list_cb_theory = {} 63 63 64 self.owner = None 64 65 self.do_layout() … … 181 182 option = self.selection_cbox.GetString(pos) 182 183 for item in self.list_cb_data: 183 data_id, data_class = self.tree_ctrl.GetItemPyData(item) 184 data_ctrl, _, _ = item 185 data_id, data_class = self.tree_ctrl.GetItemPyData(dta_ctrl) 184 186 if option == 'Select all Data': 185 187 self.tree_ctrl.CheckItem(item, True) … … 190 192 self.tree_ctrl.CheckItem(item, True) 191 193 elif option == 'Unselect all Data 1D': 192 if data_class in ['Data1D', 'Theory1D']:194 if data_class == 'Data1D': 193 195 self.tree_ctrl.CheckItem(item, False) 194 196 elif option == 'Select all Data 1D': 195 if data_class == ['Data1D', 'Theory1D']:197 if data_class == 'Data1D': 196 198 self.tree_ctrl.CheckItem(item, True) 197 199 elif option == 'Select all Data 2D': … … 223 225 self.bt_plot.SetToolTipString("To trigger plotting") 224 226 wx.EVT_BUTTON(self, self.bt_plot.GetId(), self.on_plot) 227 228 self.bt_freeze = wx.Button(self, wx.NewId(), "Freeze") 229 self.bt_freeze.SetToolTipString("To trigger freeze") 230 wx.EVT_BUTTON(self, self.bt_freeze.GetId(), self.on_freeze) 225 231 226 232 self.bt_remove = wx.Button(self, wx.NewId(), "Remove Data") … … 253 259 ix = 0 254 260 iy += 1 261 self.sizer3.Add(self.bt_freeze,( iy, ix),(1,1), 262 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 263 ix = 0 264 iy += 1 255 265 self.sizer3.Add(self.bt_remove,( iy, ix),(1,1), 256 266 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) … … 317 327 item = event.GetItem() 318 328 name = self.tree_ctrl.GetItemText(item) 319 329 320 330 def load_data_list(self, list): 321 331 """ 322 332 add need data with its theory under the tree 323 333 """ 324 334 if not list: 325 335 return 326 336 327 for dstate in list.values():337 for state_id, dstate in list.iteritems(): 328 338 data = dstate.get_data() 329 339 if data is None: 330 data_name = str(data) 331 data_class = "unkonwn" 340 data_name = "Unkonwn" 341 data_class = "Unkonwn" 342 path = "Unkonwn" 343 process_list = [] 344 data_id = "Unkonwn" 332 345 else: 333 346 data_name = data.name 334 data_class = data.__class__.__name__ 335 path = dstate.get_path() 347 data_class = data.__class__.__name__ 348 path = dstate.get_path() 349 process_list = data.process 350 data_id = data.id 336 351 theory_list = dstate.get_theory() 337 data_child = None 352 if state_id not in self.list_cb_data: 353 #new state 354 data_c = self.tree_ctrl.InsertItem(self.tree_ctrl.root,0, 355 data_name, ct_type=1, 356 data=(data_id, data_class, state_id)) 357 data_c.Check(True) 358 d_i_c = self.tree_ctrl.AppendItem(data_c, 'Info') 359 i_c_c = self.tree_ctrl.AppendItem(d_i_c, 360 'Type: %s' % data_class) 361 p_c_c = self.tree_ctrl.AppendItem(d_i_c, 362 'Path: %s' % str(path)) 363 d_p_c = self.tree_ctrl.AppendItem(d_i_c, 'Process') 364 365 for process in process_list: 366 i_t_c = self.tree_ctrl.AppendItem(d_p_c, 367 process.__str__()) 368 theory_child = self.tree_ctrl.AppendItem(data_c, "THEORIES") 369 370 self.list_cb_data[state_id] = [data_c, 371 d_i_c, 372 i_c_c, 373 p_c_c, 374 d_p_c, 375 theory_child] 376 else: 377 data_ctrl_list = self.list_cb_data[state_id] 378 #This state is already display replace it contains 379 data_c, d_i_c, i_c_c, p_c_c, d_p_c, t_c = data_ctrl_list 380 self.tree_ctrl.SetItemText(data_c, data_name) 381 temp = (data_id, data_class, state_id) 382 self.tree_ctrl.SetItemPyData(data_c, temp) 383 self.tree_ctrl.SetItemText(i_c_c, 'Type: %s' % data_class) 384 self.tree_ctrl.SetItemText(p_c_c, 'Path: %s' % str(path)) 385 self.tree_ctrl.DeleteChildren(d_p_c) 386 for process in process_list: 387 i_t_c = self.tree_ctrl.AppendItem(d_p_c, 388 process.__str__()) 389 self.append_theory(state_id, theory_list) 390 391 392 def append_theory(self, state_id, theory_list): 393 """ 394 append theory object under data from a state of id = state_id 395 replace that theory if already displayed 396 """ 397 if not theory_list: 398 return 399 if state_id not in self.list_cb_data.keys(): 400 msg = "Invalid state ID : %s requested for theory" % str(state_id) 401 raise ValueError, msg 338 402 339 if theory_list: 340 for theory_id,theory in theory_list.iteritems(): 341 for item in self.list_cb_data: 342 data_id, data_class = self.tree_ctrl.GetItemPyData(item) 343 if data_id == data.id: 344 data_child = item 345 for process in data.process: 346 theory_child = self.tree_ctrl.FindItem(data_child, 347 "CREATED DATA"), 348 if theory is not None: 349 av_theory_child =self.tree_ctrl.AppendItem(theory_child, 350 theory.name,ct_type=1, 351 data=(theory_id, theory)) 352 self.list_cb_theory.append(av_theory_child) 353 av_theory_child_info =self.tree_ctrl.AppendItem(av_theory_child, 354 'info') 355 for process in theory.process: 356 info_time_child = self.tree_ctrl.AppendItem(av_theory_child_info, 357 process.__str__()) 358 359 break 360 if data_child is None: 361 data_child = self.tree_ctrl.InsertItem(self.tree_ctrl.root,0, 362 data_name, ct_type=1, 363 data=(data.id, data_class)) 364 cb_data = self.tree_ctrl.GetFirstChild(self.tree_ctrl.root) 365 item, id = cb_data 366 item.Check(True) 367 self.list_cb_data.append(item) 368 data_info_child =self.tree_ctrl.AppendItem(data_child, 'info')#, 369 #wnd=data_info_txt) 370 info_class_child =self.tree_ctrl.AppendItem(data_info_child, 371 'Type: %s'%data_class) 372 path_class_child =self.tree_ctrl.AppendItem(data_info_child, 373 'Path: %s'%str(path)) 374 for process in data.process: 375 info_time_child =self.tree_ctrl.AppendItem(data_info_child,process.__str__()) 376 theory_child =self.tree_ctrl.AppendItem(data_child, "Available Theories") 377 378 if theory_list: 379 theory = theory_list[len(theory_list)-1] 380 if theory is not None: 381 av_theory_child =self.tree_ctrl.AppendItem(theory_child, 382 theory.name,ct_type=1) 383 self.list_cb_theory.append(av_theory_child) 384 av_theory_child_info =self.tree_ctrl.AppendItem(av_theory_child, 385 'info') 386 for process in theory.process: 387 info_time_child =self.tree_ctrl.AppendItem(av_theory_child_info, 388 process.__str__()) 389 403 item = self.list_cb_data[state_id] 404 data_c, _, _, _, _, theory_child = item 405 data_id, _, _ = self.tree_ctrl.GetItemPyData(data_c) 406 407 if data_id in self.list_cb_theory.keys(): 408 #update current list of theory for this data 409 theory_list_ctrl = self.list_cb_theory[data_id] 410 411 for theory_id, item in theory_list.iteritems(): 412 theory_data, _ = item 413 if theory_data is None: 414 name = "Unknown" 415 theory_class = "Unknown" 416 theory_id = "Unknown" 417 temp = (None, None, None) 418 else: 419 name = theory_data.name 420 theory_class = theory_data.__class__.__name__ 421 theory_id = theory_data.id 422 temp = (theory_id, theory_class, state_id) 423 if theory_id not in theory_list_ctrl: 424 #add new theory 425 t_child = self.tree_ctrl.AppendItem(theory_child, 426 name, ct_type=1, data=temp) 427 t_i_c = self.tree_ctrl.AppendItem(t_child, 'Info') 428 i_c_c = self.tree_ctrl.AppendItem(t_i_c, 429 'Type: %s' % theory_class) 430 t_p_c = self.tree_ctrl.AppendItem(t_i_c, 'Process') 431 432 for process in theory_data.process: 433 i_t_c = self.tree_ctrl.AppendItem(t_p_c, 434 process.__str__()) 435 theory_list_ctrl[theory_id] = [t_child, 436 i_c_c, 437 t_p_c] 438 else: 439 #replace theory 440 t_child, i_c_c, t_p_c = theory_list_ctrl[theory_id] 441 self.tree_ctrl.SetItemText(t_child, name) 442 self.tree_ctrl.SetItemPyData(t_child, temp) 443 self.tree_ctrl.SetItemText(i_c_c, 'Type: %s' % theory_class) 444 self.tree_ctrl.DeleteChildren(t_p_c) 445 for process in theory_data.process: 446 i_t_c = self.tree_ctrl.AppendItem(t_p_c, 447 process.__str__()) 448 449 else: 450 #data didn't have a theory associated it before 451 theory_list_ctrl = {} 452 for theory_id, item in theory_list.iteritems(): 453 theory_data, _ = item 454 if theory_data is not None: 455 theory_class = theory_data.__class__.__name__ 456 457 t_child = self.tree_ctrl.AppendItem(theory_child, 458 theory_data.name, ct_type=1, 459 data=(theory_data.id, theory_class, state_id)) 460 t_i_c = self.tree_ctrl.AppendItem(t_child, 'Info') 461 i_c_c = self.tree_ctrl.AppendItem(t_i_c, 462 'Type: %s' % theory_class) 463 t_p_c = self.tree_ctrl.AppendItem(t_i_c, 'Process') 464 465 for process in theory_data.process: 466 i_t_c = self.tree_ctrl.AppendItem(t_p_c, 467 process.__str__()) 468 469 theory_list_ctrl[theory_id] = [t_child, i_c_c, t_p_c] 470 self.list_cb_theory[data_id] = theory_list_ctrl 471 472 390 473 def set_data_helper(self): 391 474 """ 392 475 """ 393 476 data_to_plot = [] 394 for item in self.list_cb_data: 477 for value in self.list_cb_data.values(): 478 item, _, _, _, _, _ = value 395 479 if item.IsChecked(): 396 data_id, data_class= self.tree_ctrl.GetItemPyData(item)480 data_id, _, _ = self.tree_ctrl.GetItemPyData(item) 397 481 data_to_plot.append(data_id) 398 482 theory_to_plot = [] 399 for item in self.list_cb_theory: 400 if item.IsChecked(): 401 data_id, data_class = self.tree_ctrl.GetItemPyData(item) 402 theory_to_plot.append(data_id) 483 for theory_dict in self.list_cb_theory.values(): 484 for key, value in theory_dict.iteritems(): 485 item, _, _ = value 486 if item.IsChecked(): 487 theory_id, _, _ = self.tree_ctrl.GetItemPyData(item) 488 theory_to_plot.append(theory_id) 403 489 return data_to_plot, theory_to_plot 404 490 491 def remove_by_id(self, id): 492 """ 493 """ 494 for item in self.list_cb_data.values(): 495 data_c, _, _, _, _, theory_child = item 496 data_id, _, state_id = self.tree_ctrl.GetItemPyData(data_c) 497 if id == data_id: 498 self.tree_ctrl.Delete(data_c) 499 del self.list_cb_data[state_id] 500 del self.list_cb_theory[data_id] 501 print "went here" 502 405 503 def on_remove(self, event): 406 504 """ … … 441 539 self.post_helper(plot=True) 442 540 541 def on_freeze(self, event): 542 """ 543 """ 544 data_to_plot, theory_to_plot = self.set_data_helper() 545 self.parent.freeze(data_id=data_to_plot, theory_id=theory_to_plot) 546 443 547 def set_active_perspective(self, name): 444 548 """ … … 457 561 """ 458 562 data_to_plot, theory_to_plot = self.set_data_helper() 459 460 563 if self.parent is not None: 461 564 self.parent.get_data_from_panel(data_id=data_to_plot, plot=plot, 462 565 append=append) 566 567 463 568 464 569 … … 495 600 """ 496 601 self.panel.layout_perspective(list_of_perspective=list_of_perspective) 602 603 497 604 498 605 … … 512 619 dstate = DataState(data=data) 513 620 dstate.set_path(path=path) 514 dstate.set_theory(theory )515 dstate.set_state(state)621 dstate.set_theory(theory, state) 622 516 623 return dstate 517 624 """' … … 528 635 list_of_perspective = [('perspective2', False), ('perspective1', True)] 529 636 data_list = {} 637 # state 1 530 638 data = Data1D() 531 639 data.name = "data1" 532 640 data.id = 1 533 #data.append_process()534 #process = data.process[len(data.process)-1]535 #process.data = "07/01/2010"641 data.append_empty_process() 642 process = data.process[len(data.process)-1] 643 process.data = "07/01/2010" 536 644 theory = Theory1D() 537 645 theory.id = 34 538 theory. pseudo_name = "theory1"646 theory.name = "theory1" 539 647 path = "path1" 540 648 state = State() 541 649 data_list['1']=set_data_state(data, path,theory, state) 542 650 #state 2 543 651 data = Data1D() 544 652 data.name = "data2" … … 547 655 theory.id = 78 548 656 theory.name = "CoreShell 07/24/25" 549 theory.pseudo_name = "CoreShell"550 657 path = "path2" 658 #state3 551 659 state = State() 552 660 data_list['2']=set_data_state(data, path,theory, state) … … 556 664 theory = Theory1D() 557 665 theory.name = "CoreShell" 558 theory.pseudo_name = "CoreShell"559 666 theory.id = 4 560 #theory.append_process()561 #process = theory.process[len(theory.process)-1]562 #process.description = "this is my description"667 theory.append_empty_process() 668 process = theory.process[len(theory.process)-1] 669 process.description = "this is my description" 563 670 path = "path3" 564 #data.append_process()565 #process = data.process[len(data.process)-1]566 #process.data = "07/22/2010"671 data.append_empty_process() 672 process = data.process[len(data.process)-1] 673 process.data = "07/22/2010" 567 674 data_list['4']=set_data_state(data, path,theory, state) 568 675 #state 4 676 temp_data_list = {} 677 data.name = "data5 erasing data2" 678 temp_data_list['4'] = set_data_state(data, path,theory, state) 679 #state 5 569 680 data = Data2D() 570 681 data.name = "data3" 571 682 data.id = 5 572 #data.append_process()573 #process = data.process[len(data.process)-1]574 #process.data = "07/01/2010"683 data.append_empty_process() 684 process = data.process[len(data.process)-1] 685 process.data = "07/01/2010" 575 686 theory = Theory1D() 576 theory. pseudo_name = "Cylinder"687 theory.name = "Cylinder" 577 688 path = "path2" 578 689 state = State() … … 580 691 theory = Theory1D() 581 692 theory.id = 6 582 theory. pseudo_name = "Sphere"693 theory.name = "CoreShell" 583 694 dstate.set_theory(theory) 584 data_list['3']=dstate 695 theory = Theory1D() 696 theory.id = 6 697 theory.name = "CoreShell replacing coreshell in data3" 698 dstate.set_theory(theory) 699 data_list['3'] = dstate 700 #state 6 701 data_list['6']=set_data_state(None, path,theory, state) 585 702 586 703 window = DataFrame(list=data_list) 587 #window.load_data_list(list=data_list)588 window.layout_perspective(list_of_perspective=list_of_perspective)704 window.load_data_list(list=data_list) 705 #window.layout_perspective(list_of_perspective=list_of_perspective) 589 706 window.Show(True) 707 window.load_data_list(list=temp_data_list) 590 708 except: 591 709 #raise 592 710 print "error",sys.exc_value 711 593 712 app.MainLoop() 594 713 -
guiframe/data_state.py
r5c4b674 rc70eb7c 10 10 """ 11 11 """ 12 import copy 13 12 14 13 15 class DataState(object): … … 24 26 self.path = None 25 27 self.theory_list = {} 26 self.state_list = []27 28 self.message = "" 29 self.id = None 30 31 def __str__(self): 32 _str = "" 33 _str += "State with ID : %s \n" % str(self.id) 34 if self.data is not None: 35 _str += "Data name : %s \n" % str(self.data.name) 36 _str += "Data ID : %s \n" % str(self.data.id) 37 else: 38 _str += "Data: %s \n" % str(self.data) 39 40 if self.theory_list: 41 _str += "Theories available: \n" 42 for id, item in self.theory_list.iteritems(): 43 theory_data, theory_state = item 44 _str += "Theory name : %s \n" % str(theory_data.name) 45 _str += "Theory ID : %s \n" % str(id) 46 else: 47 for key , value in self.theory_list.iteritems(): 48 theory_data, theory_state = value 49 _str += "Theory with ID : %s \n" % str(key) 50 _str += str(theory_data) 51 _str += str(theory_state) 52 return _str 53 54 def clone(self): 55 obj = DataState(copy.deepcopy(self.data)) 56 obj.parent = self.parent 57 obj.name = self.name 58 obj.path = self.path 59 obj.message = self.message 60 obj.id = self.id 61 for id, item in self.theory_list.iteritems(): 62 theory_data, theory_state = item 63 state = None 64 if theory_state is not None: 65 state = theory_state.clone() 66 obj.theory_list[id] = [copy.deepcopy(theory_data), 67 state] 68 return obj 28 69 29 70 def set_name(self, name): 30 71 self.name = name 72 31 73 def get_name(self): 32 74 return self.name 75 33 76 def set_data(self, data): 34 77 self.data = data … … 49 92 return self.path 50 93 51 def set_theory(self, theory ):94 def set_theory(self, theory_data, theory_state=None): 52 95 """ 53 96 """ 54 self.theory_list[theory .id] = theory97 self.theory_list[theory_data.id] = [theory_data, theory_state] 55 98 56 99 def get_theory(self): 57 100 return self.theory_list 58 59 def set_state(self, state):60 """61 """62 #self.theory_list.append(state)63 return64 65 def get_state(self):66 return self.state_list67 101 68 102 def get_message(self): -
guiframe/gui_manager.py
r9c169f4 rc70eb7c 431 431 Hide()) 432 432 433 def append_theory(self, data_id, theory, state=None): 434 """ 435 """ 436 data_state = self._data_manager.append_theory(data_id=data_id, 437 theory=theory, 438 state=state) 439 self._data_panel.load_data_list(data_state) 440 441 def update_data(self, prev_data, new_data): 442 """ 443 """ 444 prev_id, data_state = self._data_manager.update_data(prev_data=prev_data, 445 new_data=new_data) 446 self._data_panel.remove_by_id(prev_id) 447 self._data_panel.load_data_list(data_state) 448 449 450 def freeze(self, data_id, theory_id): 451 """ 452 """ 453 data_state_list = self._data_manager.freeze_theory(data_id=data_id, 454 theory_id=theory_id) 455 456 self._data_panel.load_data_list(list=data_state_list) 457 for data_state in data_state_list: 458 theory_list = data_state.get_theory() 459 for new_plot in theory_list: 460 wx.PostEvent(self, NewplotEvent(plot=new_plot, 461 title=new_plot.title)) 462 463 def delete_data(self, data): 464 """ 465 """ 466 self._current_perspective.delete_data(data) 467 468 433 469 def get_context_menu(self, plotpanel=None): 434 470 """ … … 1207 1243 self.__gui_style = self.__gui_style & (~GUIFRAME.MANAGER_ON) 1208 1244 self._data_panel_menu.SetText('Data Explorer ON') 1209 1245 1246 def add_data_helper(self, data_list): 1247 """ 1248 """ 1249 self._data_manager.add_data(data_list) 1250 1210 1251 def add_data(self, data_list): 1211 1252 """ … … 1215 1256 #send a list of available data to plotting plugin 1216 1257 avalaible_data = [] 1258 theory_list = [] 1217 1259 if self._data_manager is not None: 1218 1260 self._data_manager.add_data(data_list) 1219 1261 avalaible_data = self._data_manager.get_all_data() 1220 1221 # set data in the data panel1222 if self._data_panel is not None:1223 data_state = self._data_manager.get_selected_data()1224 self._data_panel.load_data_list(data_state)1225 1262 style = self.__gui_style & GUIFRAME.MANAGER_ON 1226 1263 if style == GUIFRAME.MANAGER_ON: … … 1232 1269 #automatically send that to the current perspective 1233 1270 self.set_data(data_list) 1234 1271 1272 # set data in the data panel 1273 if self._data_panel is not None: 1274 data_state = self._data_manager.get_selected_data() 1275 self._data_panel.load_data_list(data_state) 1276 1235 1277 def get_data_from_panel(self, data_id, plot=False,append=False): 1236 1278 """ … … 1290 1332 title=str(new_plot.title))) 1291 1333 1292 def add_theory(self, data_id, theory): 1293 """ 1294 """ 1295 self._data_manager.append_theory(data_id, theory) 1296 style = self.__gui_style & GUIFRAME.MANAGER_ON 1297 if style == GUIFRAME.MANAGER_ON: 1298 if self._data_panel is not None: 1299 data_state = self._data_manager.get_by_id([data_id]) 1300 self._data_panel.load_data_list(data_state) 1334 1301 1335 1302 1336 def remove_data(self, data_id, theory_id=None, delete_all=True): -
guiframe/local_perspectives/plotting/plotting.py
r5c4b674 rc70eb7c 76 76 pass 77 77 78 #def _on_plot_event(self, event): 79 # return profile(self.tested_on_plot_event, event) 80 78 81 79 def _on_plot_event(self, event): 82 80 """ … … 165 163 166 164 return 167 168 def profile(fn, *args, **kw):169 import cProfile, pstats, os170 global call_result171 def call():172 global call_result173 call_result = fn(*args, **kw)174 cProfile.runctx('call()', dict(call=call), {}, 'profile.txt')175 stats = pstats.Stats('profile.txt')176 stats.sort_stats('time')177 #stats.sort_stats('calls')178 stats.print_stats()179 #os.unlink('profile.out')180 return call_result181 182 165 -
guiframe/panel_base.py
r03314e7 rc70eb7c 46 46 self._reset_flag = False 47 47 self._has_changed = False 48 self.group_id = None 48 49 49 50 self.Bind(wx.EVT_LEFT_DOWN, self.on_set_focus)
Note: See TracChangeset
for help on using the changeset viewer.