Changeset 71bd773 in sasview
- Timestamp:
- Mar 23, 2011 12:10:16 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:
- 72323d1
- Parents:
- 05319e2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/data_panel.py
ra3c96f7a r71bd773 288 288 self.tree_ctrl.Bind(CT.EVT_TREE_ITEM_CHECKING, self.on_check_item) 289 289 self.sizer1.Add(self.tree_ctrl,1, wx.EXPAND|wx.ALL, 10) 290 self.theory_root = self.tree_ctrl.InsertItem(self.tree_ctrl.root,0, 291 "THEORIES", ct_type=0) 290 292 291 293 def onContextMenu(self, event): … … 335 337 for state_id, dstate in list.iteritems(): 336 338 data = dstate.get_data() 337 if data is None: 338 data_name = "Unkonwn" 339 data_class = "Unkonwn" 340 path = "Unkonwn" 341 process_list = [] 342 data_id = "Unkonwn" 343 else: 339 theory_list = dstate.get_theory() 340 if data is not None: 344 341 data_name = data.name 345 342 data_class = data.__class__.__name__ … … 347 344 process_list = data.process 348 345 data_id = data.id 349 theory_list = dstate.get_theory()350 if state_id not in self.list_cb_data:351 #new state352 data_c = self.tree_ctrl.InsertItem(self.tree_ctrl.root,0,353 data_name, ct_type=1,354 data=(data_id, data_class, state_id))355 data_c.Check(True)356 self.enable_button(data_c)357 d_i_c = self.tree_ctrl.AppendItem(data_c, 'Info')358 i_c_c = self.tree_ctrl.AppendItem(d_i_c,359 'Type: %s' % data_class)360 p_c_c = self.tree_ctrl.AppendItem(d_i_c,361 'Path: %s' % str(path))362 d_p_c = self.tree_ctrl.AppendItem(d_i_c, 'Process')363 346 364 for process in process_list: 365 i_t_c = self.tree_ctrl.AppendItem(d_p_c, 366 process.__str__()) 367 theory_child = self.tree_ctrl.AppendItem(data_c, "THEORIES") 368 369 self.list_cb_data[state_id] = [data_c, 370 d_i_c, 371 i_c_c, 372 p_c_c, 373 d_p_c, 374 theory_child] 375 else: 376 data_ctrl_list = self.list_cb_data[state_id] 377 #This state is already display replace it contains 378 data_c, d_i_c, i_c_c, p_c_c, d_p_c, t_c = data_ctrl_list 379 self.tree_ctrl.SetItemText(data_c, data_name) 380 temp = (data_id, data_class, state_id) 381 self.tree_ctrl.SetItemPyData(data_c, temp) 382 self.tree_ctrl.SetItemText(i_c_c, 'Type: %s' % data_class) 383 self.tree_ctrl.SetItemText(p_c_c, 'Path: %s' % str(path)) 384 self.tree_ctrl.DeleteChildren(d_p_c) 385 for process in process_list: 386 i_t_c = self.tree_ctrl.AppendItem(d_p_c, 387 process.__str__()) 347 if state_id not in self.list_cb_data: 348 #new state 349 data_c = self.tree_ctrl.InsertItem(self.tree_ctrl.root,0, 350 data_name, ct_type=1, 351 data=(data_id, data_class, state_id)) 352 data_c.Check(True) 353 self.enable_button(data_c) 354 d_i_c = self.tree_ctrl.AppendItem(data_c, 'Info') 355 i_c_c = self.tree_ctrl.AppendItem(d_i_c, 356 'Type: %s' % data_class) 357 p_c_c = self.tree_ctrl.AppendItem(d_i_c, 358 'Path: %s' % str(path)) 359 d_p_c = self.tree_ctrl.AppendItem(d_i_c, 'Process') 360 361 for process in process_list: 362 i_t_c = self.tree_ctrl.AppendItem(d_p_c, 363 process.__str__()) 364 theory_child = self.tree_ctrl.AppendItem(data_c, "THEORIES") 365 366 self.list_cb_data[state_id] = [data_c, 367 d_i_c, 368 i_c_c, 369 p_c_c, 370 d_p_c, 371 theory_child] 372 else: 373 data_ctrl_list = self.list_cb_data[state_id] 374 #This state is already display replace it contains 375 data_c, d_i_c, i_c_c, p_c_c, d_p_c, t_c = data_ctrl_list 376 self.tree_ctrl.SetItemText(data_c, data_name) 377 temp = (data_id, data_class, state_id) 378 self.tree_ctrl.SetItemPyData(data_c, temp) 379 self.tree_ctrl.SetItemText(i_c_c, 'Type: %s' % data_class) 380 self.tree_ctrl.SetItemText(p_c_c, 'Path: %s' % str(path)) 381 self.tree_ctrl.DeleteChildren(d_p_c) 382 for process in process_list: 383 i_t_c = self.tree_ctrl.AppendItem(d_p_c, 384 process.__str__()) 388 385 self.append_theory(state_id, theory_list) 389 386 … … 397 394 return 398 395 if state_id not in self.list_cb_data.keys(): 399 msg = "Invalid state ID : %s requested for theory" % str(state_id) 400 raise ValueError, msg 401 402 item = self.list_cb_data[state_id] 403 data_c, _, _, _, _, theory_child = item 404 data_id, _, _ = self.tree_ctrl.GetItemPyData(data_c) 405 406 if data_id in self.list_cb_theory.keys(): 396 root = self.theory_root 397 else: 398 item = self.list_cb_data[state_id] 399 data_c, _, _, _, _, _ = item 400 root = data_c 401 if root is not None: 402 self.append_theory_helper(root=root, 403 state_id=state_id, 404 theory_list=theory_list) 405 406 def append_theory_helper(self, root, state_id, theory_list): 407 """ 408 """ 409 if state_id in self.list_cb_theory.keys(): 407 410 #update current list of theory for this data 408 theory_list_ctrl = self.list_cb_theory[ data_id]411 theory_list_ctrl = self.list_cb_theory[state_id] 409 412 410 413 for theory_id, item in theory_list.iteritems(): … … 424 427 if theory_id not in theory_list_ctrl: 425 428 #add new theory 426 t_child = self.tree_ctrl.AppendItem( theory_child,429 t_child = self.tree_ctrl.AppendItem(root, 427 430 name, ct_type=1, data=temp) 428 431 t_i_c = self.tree_ctrl.AppendItem(t_child, 'Info') … … 460 463 # name = theory_state.model.name 461 464 temp = (theory_id, theory_class, state_id) 462 t_child = self.tree_ctrl.AppendItem( theory_child,465 t_child = self.tree_ctrl.AppendItem(root, 463 466 name, ct_type=1, 464 467 data=(theory_data.id, theory_class, state_id)) … … 473 476 474 477 theory_list_ctrl[theory_id] = [t_child, i_c_c, t_p_c] 475 self.list_cb_theory[data_id] = theory_list_ctrl 478 #self.list_cb_theory[data_id] = theory_list_ctrl 479 self.list_cb_theory[state_id] = theory_list_ctrl 476 480 477 481 … … 543 547 for key in theory_key: 544 548 for t_key, theory_dict in self.list_cb_theory.iteritems(): 545 del theory_dict[key] 549 if key in theory_dict: 550 del theory_dict[key] 546 551 547 552 self.parent.remove_data(data_id=data_to_remove, … … 645 650 self.msg += "name value\n" 646 651 return msg 647 def set_data_state(data , path, theory, state):652 def set_data_state(data=None, path=None, theory=None, state=None): 648 653 dstate = DataState(data=data) 649 654 dstate.set_path(path=path) … … 729 734 #state 6 730 735 data_list['6']=set_data_state(None, path,theory, state) 731 736 data_list['6']=set_data_state(theory=theory, state=None) 737 theory = Theory1D() 738 theory.id = 7 739 data_list['6']=set_data_state(theory=theory, state=None) 740 data_list['7']=set_data_state(theory=theory, state=None) 732 741 window = DataFrame(list=data_list) 733 742 window.load_data_list(list=data_list)
Note: See TracChangeset
for help on using the changeset viewer.