Changeset 584c4c4 in sasview
- Timestamp:
- Jan 31, 2011 8:55:49 AM (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:
- d5751ac
- Parents:
- c5e84fb
- Location:
- guiframe
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/data_manager.py
rc5e84fb r584c4c4 38 38 receive a list of 39 39 """ 40 self._selected_data = []40 self._selected_data = {} 41 41 for data in data_list: 42 42 if data.id in self.stored_data: … … 45 45 logging.info(msg) 46 46 data_state = DataState(data) 47 self._selected_data.append(data_state) 48 self.stored_data[id] = data_state 49 47 self._selected_data[data.id] = data_state 48 self.stored_data[data.id] = data_state 49 print "datalist", self._selected_data 50 50 51 def set_auto_plot(self, flag=False): 51 52 """ … … 71 72 get a list of data given a list of id 72 73 """ 73 self._selected_data = []74 self._selected_data = {} 74 75 for id in id_list: 75 76 if id in self.stored_data: 76 self._selected_data .append(self.stored_data[id])77 self._selected_data[id] = self.stored_data[id] 77 78 return self._selected_data 78 79 … … 83 84 for id in id_list: 84 85 if id in self.stored_data: 85 data = self.stored_data[id]86 if data in self._selected_data:87 self._selected_data.remove(data)88 86 del self.stored_data[id] 87 if id in self._selected_data: 88 del self._selected_data[id] 89 89 90 90 def get_by_name(self, name_list=None): … … 92 92 return a list of data given a list of data names 93 93 """ 94 self._selected_data = []94 self._selected_data = {} 95 95 for selected_name in name_list: 96 for data in self.stored_data.values():97 if data .name == selected_name:98 self._selected_data .append(data)96 for id, data_state in self.stored_data.iteritems(): 97 if data_state.data.name == selected_name: 98 self._selected_data[id] = data_state 99 99 return self._selected_data 100 100 … … 104 104 """ 105 105 for selected_name in name_list: 106 for data in self.stored_data.values(): 107 if data.name == selected_name: 108 if data in self._selected_data: 109 self._selected_data.remove(data) 110 if data.id in self.stored_data: 111 del self.stored_data[data.id] 106 for id, data_state in self.stored_data.iteritems(): 107 if data_state.data.name == selected_name: 108 del self._selected_data[id] 109 del self.stored_data[data.id] 112 110 113 111 def get_selected_data(self): … … 121 119 return list of all available data 122 120 """ 123 return self.stored_data .values()121 return self.stored_data 124 122 125 123 -
guiframe/data_panel.py
rc5e84fb r584c4c4 296 296 297 297 """ 298 print "list", list 298 299 if not list: 299 300 return … … 306 307 else: 307 308 data_name = data.name 308 309 309 data_class = data.__class__.__name__ 310 310 path = dstate.get_path() … … 322 322 if theory is not None: 323 323 av_theory_child =self.tree_ctrl.AppendItem(theory_child, 324 theory.name,ct_type=1 )324 theory.name,ct_type=1, data=theory.id) 325 325 self.list_cb_theory.append(av_theory_child) 326 326 av_theory_child_info =self.tree_ctrl.AppendItem(av_theory_child, … … 333 333 if data_child is None: 334 334 data_child =self.tree_ctrl.InsertItem(self.tree_ctrl.root,0, 335 data_name,ct_type=1 )335 data_name,ct_type=1, data=data.id) 336 336 cb_data = self.tree_ctrl.GetFirstChild(self.tree_ctrl.root) 337 337 item, id = cb_data … … 364 364 """ 365 365 data_to_plot = [] 366 #num = self.tree_ctrl.GetCount()367 #print num, self.tree_ctrl368 366 for item in self.list_cb_data: 369 print "set_data_helper",self.tree_ctrl.GetItemText(item), item.IsChecked()370 367 if item.IsChecked(): 371 data_to_plot.append(self.tree_ctrl.GetItemText(item)) 372 373 theory_to_plot =[] 368 data_to_plot.append(self.tree_ctrl.GetItemPyData(item)) 369 theory_to_plot = [] 374 370 for item in self.list_cb_theory: 375 371 if item.IsChecked(): 376 theory_to_plot.append(self.tree_ctrl.GetItemText(item)) 377 372 theory_to_plot.append(self.tree_ctrl.GetItemPyData(item)) 378 373 return data_to_plot, theory_to_plot 379 374 … … 419 414 """ 420 415 data_to_plot, theory_to_plot = self.set_data_helper() 421 #print "data_to_plot",data_to_plot 422 current_perspective = self.get_active_perspective() 423 424 if self.manager is not None: 425 self.parent.post_data_helper(data_name=data_to_plot, 426 perspective=current_perspective, plot=plot) 416 417 if self.parent is not None: 418 self.parent.get_data_from_panel(data_id=data_to_plot, plot=plot) 427 419 428 420 … … 494 486 data = Data1D() 495 487 data.name = "data1" 488 data.id = 1 496 489 #data.append_process() 497 490 #process = data.process[len(data.process)-1] 498 491 #process.data = "07/01/2010" 499 492 theory = Theory1D() 493 theory.id = 34 500 494 theory.pseudo_name = "theory1" 501 495 path = "path1" … … 505 499 data = Data1D() 506 500 data.name = "data2" 501 data.id = 76 507 502 theory = Theory1D() 503 theory.id = 78 508 504 theory.name = "CoreShell 07/24/25" 509 505 theory.pseudo_name = "CoreShell" … … 512 508 data_list['2']=set_data_state(data, path,theory, state) 513 509 data = Data1D() 510 data.id = 3 514 511 data.name = "data2" 515 512 theory = Theory1D() 516 513 theory.name = "CoreShell" 517 514 theory.pseudo_name = "CoreShell" 515 theory.id = 4 518 516 #theory.append_process() 519 517 #process = theory.process[len(theory.process)-1] … … 527 525 data = Data2D() 528 526 data.name = "data3" 527 data.id = 5 529 528 #data.append_process() 530 529 #process = data.process[len(data.process)-1] … … 536 535 dstate= set_data_state(data, path,theory, state) 537 536 theory = Theory1D() 537 theory.id = 6 538 538 theory.pseudo_name = "Sphere" 539 539 dstate.set_theory(theory) -
guiframe/data_state.py
r3feed3e r584c4c4 20 20 """ 21 21 self.parent = parent 22 self. _data = data23 self. _name = ""24 self. _path = None25 self. _theory_list = []26 self. _state_list = []27 self. _message = ""22 self.data = data 23 self.name = "" 24 self.path = None 25 self.theory_list = [] 26 self.state_list = [] 27 self.message = "" 28 28 29 29 def set_name(self, name): 30 self. _name = name30 self.name = name 31 31 def get_name(self): 32 return self. _name32 return self.name 33 33 def set_data(self, data): 34 self. _data = data34 self.data = data 35 35 36 36 def get_data(self): 37 return self. _data37 return self.data 38 38 39 39 def set_path(self, path): … … 41 41 Set the path of the loaded data 42 42 """ 43 self. _path = path43 self.path = path 44 44 45 45 def get_path(self): … … 47 47 return the path of the loaded data 48 48 """ 49 return self. _path49 return self.path 50 50 51 51 def set_theory(self, theory): 52 52 """ 53 53 """ 54 self. _theory_list.append(theory)54 self.theory_list.append(theory) 55 55 56 56 def get_theory(self): 57 return self. _theory_list57 return self.theory_list 58 58 59 59 def set_state(self, state): 60 60 """ 61 61 """ 62 #self. _theory_list.append(state)62 #self.theory_list.append(state) 63 63 return 64 64 65 65 def get_state(self): 66 return self. _state_list66 return self.state_list 67 67 68 68 def get_message(self): … … 70 70 return message 71 71 """ 72 return self. _message72 return self.message 73 73 74 74 -
guiframe/gui_manager.py
rc5e84fb r584c4c4 1041 1041 self.set_data(data_list) 1042 1042 1043 def set_data_from_panel(self, data_id):1043 def get_data_from_panel(self, data_id, plot=False): 1044 1044 """ 1045 1045 receive a list of data key retreive the data from data manager and set 1046 1046 then to the current perspective 1047 1047 """ 1048 data_dict = self._data_manager.get_by_id(data_id) 1049 data_list = [] 1050 for data_state in data_dict.values(): 1051 data_list.append(data_state.data) 1052 if plot: 1053 self.plot_data(data_list) 1054 else: 1055 #sent data to active application 1056 self.set_data(data_list=data_list) 1057 1048 1058 1049 1059 def set_data(self, data_list):
Note: See TracChangeset
for help on using the changeset viewer.