Changeset 61ffd1e in sasview
- Timestamp:
- Apr 27, 2011 11:51:30 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:
- 56d5562
- Parents:
- d264f0da
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/data_panel.py
rf72b143 r61ffd1e 106 106 self.list_cb_data = {} 107 107 self.list_cb_theory = {} 108 self.tree_ctrl = None 109 self.tree_ctrl_theory = None 108 110 109 111 self.owner = None … … 161 163 self.sizer5.AddMany([(select_txt,0, wx.ALL,5), 162 164 (self.selection_cbox,0, wx.ALL,5)]) 165 self.enable_selection() 166 163 167 def layout_perspective(self, list_of_perspective=[]): 164 168 """ … … 420 424 add need data with its theory under the tree 421 425 """ 422 if not list: 423 self.enable_remove() 424 self.enable_import() 425 self.enable_plot() 426 self.enable_freeze() 427 return 428 # uncheck previous items 429 #self._uncheck_all() 430 431 for state_id, dstate in list.iteritems(): 432 data = dstate.get_data() 433 theory_list = dstate.get_theory() 434 if data is not None: 435 data_name = data.name 436 data_class = data.__class__.__name__ 437 path = dstate.get_path() 438 process_list = data.process 439 data_id = data.id 440 441 if state_id not in self.list_cb_data: 442 #new state 443 data_c = self.tree_ctrl.InsertItem(self.tree_ctrl.root,0, 444 data_name, ct_type=1, 445 data=(data_id, data_class, state_id)) 446 data_c.Check(True) 447 self.enable_button(data_c) 448 d_i_c = self.tree_ctrl.AppendItem(data_c, 'Info') 449 i_c_c = self.tree_ctrl.AppendItem(d_i_c, 450 'Type: %s' % data_class) 451 p_c_c = self.tree_ctrl.AppendItem(d_i_c, 452 'Path: %s' % str(path)) 453 d_p_c = self.tree_ctrl.AppendItem(d_i_c, 'Process') 426 if list: 427 for state_id, dstate in list.iteritems(): 428 data = dstate.get_data() 429 theory_list = dstate.get_theory() 430 if data is not None: 431 data_name = data.name 432 data_class = data.__class__.__name__ 433 path = dstate.get_path() 434 process_list = data.process 435 data_id = data.id 454 436 455 for process in process_list: 456 i_t_c = self.tree_ctrl.AppendItem(d_p_c, 457 process.__str__()) 458 theory_child = self.tree_ctrl.AppendItem(data_c, "THEORIES") 459 460 self.list_cb_data[state_id] = [data_c, 461 d_i_c, 462 i_c_c, 463 p_c_c, 464 d_p_c, 465 theory_child] 466 else: 467 data_ctrl_list = self.list_cb_data[state_id] 468 #This state is already display replace it contains 469 data_c, d_i_c, i_c_c, p_c_c, d_p_c, t_c = data_ctrl_list 470 self.tree_ctrl.SetItemText(data_c, data_name) 471 temp = (data_id, data_class, state_id) 472 self.tree_ctrl.SetItemPyData(data_c, temp) 473 self.tree_ctrl.SetItemText(i_c_c, 'Type: %s' % data_class) 474 self.tree_ctrl.SetItemText(p_c_c, 'Path: %s' % str(path)) 475 self.tree_ctrl.DeleteChildren(d_p_c) 476 for process in process_list: 477 i_t_c = self.tree_ctrl.AppendItem(d_p_c, 478 process.__str__()) 479 self.append_theory(state_id, theory_list) 437 if state_id not in self.list_cb_data: 438 #new state 439 data_c = self.tree_ctrl.InsertItem(self.tree_ctrl.root,0, 440 data_name, ct_type=1, 441 data=(data_id, data_class, state_id)) 442 data_c.Check(True) 443 self.enable_button(data_c) 444 d_i_c = self.tree_ctrl.AppendItem(data_c, 'Info') 445 i_c_c = self.tree_ctrl.AppendItem(d_i_c, 446 'Type: %s' % data_class) 447 p_c_c = self.tree_ctrl.AppendItem(d_i_c, 448 'Path: %s' % str(path)) 449 d_p_c = self.tree_ctrl.AppendItem(d_i_c, 'Process') 450 451 for process in process_list: 452 i_t_c = self.tree_ctrl.AppendItem(d_p_c, 453 process.__str__()) 454 theory_child = self.tree_ctrl.AppendItem(data_c, "THEORIES") 455 456 self.list_cb_data[state_id] = [data_c, 457 d_i_c, 458 i_c_c, 459 p_c_c, 460 d_p_c, 461 theory_child] 462 else: 463 data_ctrl_list = self.list_cb_data[state_id] 464 #This state is already display replace it contains 465 data_c, d_i_c, i_c_c, p_c_c, d_p_c, t_c = data_ctrl_list 466 self.tree_ctrl.SetItemText(data_c, data_name) 467 temp = (data_id, data_class, state_id) 468 self.tree_ctrl.SetItemPyData(data_c, temp) 469 self.tree_ctrl.SetItemText(i_c_c, 'Type: %s' % data_class) 470 self.tree_ctrl.SetItemText(p_c_c, 'Path: %s' % str(path)) 471 self.tree_ctrl.DeleteChildren(d_p_c) 472 for process in process_list: 473 i_t_c = self.tree_ctrl.AppendItem(d_p_c, 474 process.__str__()) 475 self.append_theory(state_id, theory_list) 480 476 self.enable_remove() 481 477 self.enable_import() 482 478 self.enable_plot() 483 479 self.enable_freeze() 480 self.enable_selection() 484 481 485 482 def _uncheck_all(self): … … 883 880 enable or disable send button 884 881 """ 885 if self.tctrl_perspective.GetLabelText() == "No Active Application": 882 n_t = 0 883 if self.tree_ctrl != None: 884 n_t = self.tree_ctrl.GetCount() 885 if n_t <=0 or self.tctrl_perspective.GetLabelText() == "No Active Application": 886 886 self.bt_import.Disable() 887 887 else: … … 912 912 enable or disable the freeze button 913 913 """ 914 n_t_t = self.tree_ctrl_theory.GetCount() 914 n_t_t = 0 915 n_l = 0 916 if self.tree_ctrl_theory != None: 917 n_t_t = self.tree_ctrl_theory.GetCount() 915 918 n_l = len(self.list_cb_theory) 916 919 if (n_t_t <= 0) and (n_l <= 0): … … 919 922 self.bt_freeze.Enable() 920 923 921 924 def enable_selection(self): 925 """ 926 enable or disable combobo box selection 927 """ 928 n_t = 0 929 n_t_t = 0 930 if self.tree_ctrl != None: 931 n_t = self.tree_ctrl.GetCount() 932 if self.tree_ctrl_theory != None: 933 n_t_t = self.tree_ctrl_theory.GetCount() 934 if n_t + n_t_t > 0 and self.selection_cbox != None: 935 self.selection_cbox.Enable() 936 else: 937 self.selection_cbox.Disable() 938 939 922 940 923 941 class DataFrame(wx.Frame):
Note: See TracChangeset
for help on using the changeset viewer.