Changeset 6df015de in sasview for src/sas/sasgui
- Timestamp:
- Oct 7, 2016 9:47:12 AM (8 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, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 7988501
- Parents:
- 1b82623
- Location:
- src/sas/sasgui/perspectives/fitting
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/basepage.py
r4c3be25 r6df015de 143 143 self.theory_qmin_x = None 144 144 self.theory_qmax_x = None 145 self.cb1 = None 145 146 self.btEditMask = None 146 147 self.btFit = None … … 474 475 self.sizer2 = wx.BoxSizer(wx.VERTICAL) 475 476 self.sizer3 = wx.BoxSizer(wx.VERTICAL) 477 self.sizerTrafo = wx.BoxSizer(wx.VERTICAL) 476 478 self.sizer4 = wx.BoxSizer(wx.VERTICAL) 477 479 self.sizer5 = wx.BoxSizer(wx.VERTICAL) … … 482 484 self.sizer2.SetMinSize((PANEL_WIDTH, -1)) 483 485 self.sizer3.SetMinSize((PANEL_WIDTH, -1)) 486 self.sizerTrafo.SetMinSize((PANEL_WIDTH, -1)) 484 487 self.sizer4.SetMinSize((PANEL_WIDTH, -1)) 485 488 self.sizer5.SetMinSize((PANEL_WIDTH, -1)) … … 490 493 self.vbox.Add(self.sizer2) 491 494 self.vbox.Add(self.sizer3) 495 self.vbox.Add(self.sizerTrafo) 492 496 self.vbox.Add(self.sizer4) 493 497 self.vbox.Add(self.sizer5) … … 1196 1200 # set data, etc. from the state 1197 1201 # reset page between theory and fitting from bookmarking 1202 #if state.data == None: 1203 # data = None 1204 #else: 1198 1205 data = state.data 1199 1206 … … 1221 1228 self.disp_cb_dict = state.disp_cb_dict 1222 1229 self.disp_list = state.disp_list 1230 1231 ## set the state of the radio box 1232 #self.shape_rbutton.SetValue(state.shape_rbutton) 1233 #self.shape_indep_rbutton.SetValue(state.shape_indep_rbutton) 1234 #self.struct_rbutton.SetValue(state.struct_rbutton) 1235 #self.plugin_rbutton.SetValue(state.plugin_rbutton) 1223 1236 1224 1237 ## fill model combobox … … 1276 1289 else: 1277 1290 self.model_view.SetLabel("1D Mode") 1291 1292 ## set the select all check box to the a given state 1293 self.cb1.SetValue(state.cb1) 1278 1294 1279 1295 ## reset state of checkbox,textcrtl and regular parameters value … … 1406 1422 logging.error(traceback.format_exc()) 1407 1423 1424 # Make sure the check box updated when all checked 1425 if self.cb1.GetValue(): 1426 self.select_all_param(None) 1427 1408 1428 def _selectDlg(self): 1409 1429 """ … … 1503 1523 else: 1504 1524 self.fitrange = False 1525 1526 if not self.data.is_data: 1527 is_modified = True 1505 1528 1506 1529 ## if any value is modify draw model with new value … … 1519 1542 self._draw_model() 1520 1543 self.Refresh() 1521 1522 logging.info("is_modified flag set to %g",is_modified)1523 1544 return is_modified 1524 1545 … … 2540 2561 item[2].Enable() 2541 2562 2542 # Make sure the check box updated 2543 self.get_all_checked_params() 2563 # Make sure the check box updated when all checked 2564 if self.cb1.GetValue(): 2565 #self.select_all_param(None) 2566 self.get_all_checked_params() 2544 2567 2545 2568 # update params … … 3696 3719 call back for model selection if implemented 3697 3720 """ 3721 def select_all_param(self, event): 3722 """ 3723 set to true or false all checkBox if implemented 3724 """ 3698 3725 def get_weight_flag(self): 3699 3726 """ -
src/sas/sasgui/perspectives/fitting/fitpage.py
r4c3be25 r6df015de 55 55 self.weightbt_string = None 56 56 self.m_name = None 57 # transform implementation 58 self._fill_Trafo_sizer() 59 # self.Trafobt_string() 57 60 # get smear info from data 58 61 self._get_smear_info() … … 92 95 self.parent.on_set_focus(event) 93 96 self.on_tap_focus() 97 98 def onTrafo(self, event): 99 """ 100 On Weighting radio button event, sets the weightbt_string 101 """ 102 self.Trafobt_string = event.GetEventObject().GetLabelText() 103 self._set_Trafo() 104 105 def _fill_Trafo_sizer(self): 106 107 title = "Transform" 108 box_description_trafo = wx.StaticBox(self, wx.ID_ANY, str(title)) 109 box_description_trafo.SetForegroundColour(wx.BLUE) 110 #boxsizer_trafo = wx.StaticBoxSizer(box_description_trafo, wx.VERTICAL) 111 boxsizer_trafo = wx.StaticBoxSizer(box_description_trafo, wx.HORIZONTAL) 112 #sizer_trafo = wx.StaticBoxSizer(box_description_trafo, wx.HORIZONTAL) 113 #weighting_set_box = wx.StaticBox(self, wx.ID_ANY, 114 # 'Select the type of SESANS analysis') 115 116 #sizer_weighting = wx.BoxSizer(wx.HORIZONTAL) 117 # weighting_box.SetMinSize((_DATA_BOX_WIDTH, 60)) 118 119 #For every radio button (each statement x3): 120 self.no_transform = wx.RadioButton(self, wx.ID_ANY, 121 'None', style=wx.RB_GROUP) 122 self.Bind(wx.EVT_RADIOBUTTON, self.onTrafo, 123 id=self.no_transform.GetId()) 124 self.hankel = wx.RadioButton(self, wx.ID_ANY, 125 'Hankel') 126 self.Bind(wx.EVT_RADIOBUTTON, self.onTrafo, 127 id=self.hankel.GetId()) 128 self.cosine = wx.RadioButton(self, wx.ID_ANY, 129 'Cosine') 130 self.Bind(wx.EVT_RADIOBUTTON, self.onTrafo, 131 id=self.cosine.GetId()) 132 133 #Not sure about this (only once though) 134 self.no_transform.SetValue(True) 135 136 #For every radio button (each statement x3): 137 boxsizer_trafo.Add(self.no_transform, 0, wx.LEFT, 10) 138 boxsizer_trafo.Add((14, 10)) 139 boxsizer_trafo.Add(self.hankel) 140 boxsizer_trafo.Add((14, 10)) 141 boxsizer_trafo.Add(self.cosine) 142 boxsizer_trafo.Add((14, 10)) 143 #Default for weighting is False, but these need to be on by default! 144 self.no_transform.Enable(True) 145 146 #Not sure about this (only once though) 147 #weighting_box.Add(sizer_trafo) 148 149 self.sizerTrafo.Clear(True) 150 self.sizerTrafo.Add(boxsizer_trafo, 0, wx.EXPAND | wx.ALL, 10) 151 #self.sizerTrafo.Add(sizer_trafo, 0, wx.EXPAND | wx.ALL, 10) 152 self.sizerTrafo.Layout() 94 153 95 154 def _fill_data_sizer(self): … … 624 683 ## fill a sizer with the combobox to select dispersion type 625 684 model_disp = wx.StaticText(self, wx.ID_ANY, 'Function') 626 CHECK_STATE = False685 CHECK_STATE = self.cb1.GetValue() 627 686 628 687 ix = 0 … … 969 1028 self.state.model = self.model.clone() 970 1029 ## save state into 1030 self.state.cb1 = self.cb1.GetValue() 971 1031 self._copy_parameters_state(self.parameters, self.state.parameters) 972 1032 self._copy_parameters_state(self.orientation_params_disp, … … 979 1039 StatusEvent(status=" Selected Distribution: Gaussian")) 980 1040 #Fill the list of fittable parameters 1041 #self.select_all_param(event=None) 981 1042 self.get_all_checked_params() 982 1043 self.Layout() … … 2693 2754 self._manager.set_param2fit(self.uid, param2fit) 2694 2755 2756 def select_all_param(self, event): 2757 """ 2758 set to true or false all checkBox given the main checkbox value cb1 2759 """ 2760 self.param_toFit = [] 2761 if self.parameters != []: 2762 if self.cb1.GetValue(): 2763 for item in self.parameters: 2764 if item[0].IsShown(): 2765 ## for data2D select all to fit 2766 if self.data.__class__.__name__ == "Data2D" or \ 2767 self.enable2D: 2768 item[0].SetValue(True) 2769 self.param_toFit.append(item) 2770 else: 2771 ## for 1D all parameters except orientation 2772 if not item in self.orientation_params: 2773 item[0].SetValue(True) 2774 self.param_toFit.append(item) 2775 else: 2776 item[0].SetValue(False) 2777 #if len(self.fittable_param)>0: 2778 for item in self.fittable_param: 2779 if item[0].IsShown(): 2780 if self.data.__class__.__name__ == "Data2D" or \ 2781 self.enable2D: 2782 item[0].SetValue(True) 2783 self.param_toFit.append(item) 2784 try: 2785 if len(self.values[item[1]]) > 0: 2786 item[0].SetValue(False) 2787 except: 2788 pass 2789 2790 else: 2791 ## for 1D all parameters except orientation 2792 if not item in self.orientation_params_disp: 2793 item[0].SetValue(True) 2794 self.param_toFit.append(item) 2795 try: 2796 if len(self.values[item[1]]) > 0: 2797 item[0].SetValue(False) 2798 except: 2799 pass 2800 else: 2801 item[0].SetValue(False) 2802 2803 else: 2804 for item in self.parameters: 2805 item[0].SetValue(False) 2806 for item in self.fittable_param: 2807 item[0].SetValue(False) 2808 self.param_toFit = [] 2809 2810 self.save_current_state_fit() 2811 2812 if event != None: 2813 #self._undo.Enable(True) 2814 ## post state to fit panel 2815 event = PageInfoEvent(page=self) 2816 wx.PostEvent(self.parent, event) 2817 param2fit = [] 2818 for item in self.param_toFit: 2819 if item[0] and item[0].IsShown(): 2820 param2fit.append(item[1]) 2821 self.parent._manager.set_param2fit(self.uid, param2fit) 2822 2695 2823 def select_param(self, event): 2696 2824 """ … … 2739 2867 if len(self.fittable_param) > 0: 2740 2868 len_orient_para *= 2 2869 #Set the value of checkbox that selected every checkbox or not 2870 if len(self.parameters) + len(self.fittable_param) - len_orient_para \ 2871 == len(self.param_toFit): 2872 self.cb1.SetValue(True) 2873 else: 2874 self.cb1.SetValue(False) 2741 2875 2742 2876 self.save_current_state_fit() … … 2840 2974 iy = 0 2841 2975 ix = 0 2842 sizer.Add(wx.StaticText(self, wx.ID_ANY, 'Parameter'), 2843 (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0) 2976 select_text = "Select All" 2977 self.cb1 = wx.CheckBox(self, wx.ID_ANY, str(select_text), (10, 10)) 2978 wx.EVT_CHECKBOX(self, self.cb1.GetId(), self.select_all_param) 2979 self.cb1.SetToolTipString("To check/uncheck all the boxes below.") 2980 self.cb1.SetValue(True) 2981 2982 sizer.Add(self.cb1, (iy, ix), (1, 1), \ 2983 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 5) 2844 2984 ix += 1 2845 2985 self.text2_2 = wx.StaticText(self, wx.ID_ANY, 'Value') … … 2868 3008 self.text2_4.Hide() 2869 3009 2870 CHECK_STATE = False3010 CHECK_STATE = self.cb1.GetValue() 2871 3011 for item in keys: 2872 3012
Note: See TracChangeset
for help on using the changeset viewer.