Changeset 6df015de in sasview for src/sas/sasgui/perspectives/fitting/fitpage.py
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.