Changeset ac2b835 in sasview
- Timestamp:
- Apr 30, 2012 9:35:06 AM (13 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:
- ef26c83
- Parents:
- 308fa87
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fittingview/src/sans/perspectives/fitting/fitpage.py
r308fa87 rac2b835 2040 2040 self._on_fit_complete() 2041 2041 if out == None or not numpy.isfinite(chisqr): 2042 raise ValueError, "Fit error occured..."2042 raise ValueError, "Fit error occured..." 2043 2043 2044 2044 is_modified = False … … 2600 2600 def get_all_checked_params(self): 2601 2601 """ 2602 Found all parameters current check and add them to list of parameters to2603 fit2602 Found all parameters current check and add them to list of parameters 2603 to fit 2604 2604 """ 2605 2605 self.param_toFit = [] … … 2612 2612 self.save_current_state_fit() 2613 2613 2614 2615 2614 event = PageInfoEvent(page=self) 2616 2615 wx.PostEvent(self.parent, event) … … 2626 2625 """ 2627 2626 self.param_toFit = [] 2628 if self.parameters != []:2627 if self.parameters != []: 2629 2628 if self.cb1.GetValue(): 2630 2629 for item in self.parameters: 2631 2630 ## for data2D select all to fit 2632 if self.data.__class__.__name__ == 2631 if self.data.__class__.__name__ == "Data2D" or \ 2633 2632 self.enable2D: 2634 2633 item[0].SetValue(True) … … 2682 2681 self.parent._manager.set_param2fit(self.uid, param2fit) 2683 2682 2684 def select_param(self, event):2685 """ 2683 def select_param(self, event): 2684 """ 2686 2685 Select TextCtrl checked for fitting purpose and stores them 2687 2686 in self.param_toFit=[] list … … 2729 2728 len_orient_para *= 2 2730 2729 #Set the value of checkbox that selected every checkbox or not 2731 if len(self.parameters) + len(self.fittable_param) - len_orient_para ==\2732 2730 if len(self.parameters) + len(self.fittable_param) - len_orient_para \ 2731 == len(self.param_toFit): 2733 2732 self.cb1.SetValue(True) 2734 2733 else: … … 2768 2767 return 2769 2768 ## the panel is drawn using the current value of the fit engine 2770 if self.engine_type ==None and self._manager != None:2771 self.engine_type = self._manager._return_engine_type()2772 2773 box_description = wx.StaticBox(self, -1,str("Model Parameters"))2769 if self.engine_type == None and self._manager != None: 2770 self.engine_type = self._manager._return_engine_type() 2771 2772 box_description = wx.StaticBox(self, -1, str("Model Parameters")) 2774 2773 boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL) 2775 sizer = wx.GridBagSizer(5, 5)2774 sizer = wx.GridBagSizer(5, 5) 2776 2775 ## save the current model 2777 2776 self.model = model … … 2779 2778 keys = self.model.getParamList() 2780 2779 #list of dispersion paramaters 2781 self.disp_list =self.model.getDispParamList()2782 2783 def custom_compare(a, b):2780 self.disp_list = self.model.getDispParamList() 2781 2782 def custom_compare(a, b): 2784 2783 """ 2785 2784 Custom compare to order, first by alphabets then second by number. 2786 """ 2785 """ 2787 2786 # number at the last digit 2788 a_last = a[len(a) -1]2789 b_last = b[len(b) -1]2787 a_last = a[len(a) - 1] 2788 b_last = b[len(b) - 1] 2790 2789 # default 2791 2790 num_a = None … … 2798 2797 len_b2 = len(b2) 2799 2798 # check if it contains a int number(<10) 2800 try: 2799 try: 2801 2800 num_a = int(a_last) 2802 except: pass 2801 except: 2802 pass 2803 2803 try: 2804 2804 num_b = int(b_last) 2805 except: pass 2806 # Put 'scale' near the top; happens 2805 except: 2806 pass 2807 # Put 'scale' near the top; happens 2807 2808 # when numbered param name exists 2808 2809 if a == 'scale': 2809 2810 return -1 2810 # both have a number 2811 # both have a number 2811 2812 if num_a != None and num_b != None: 2812 if num_a > num_b: return -1 2813 if num_a > num_b: 2814 return -1 2813 2815 # same number 2814 elif num_a == num_b: 2816 elif num_a == num_b: 2815 2817 # different last names 2816 if a2[len_a2-1] != b2[len_b2-1] and num_a != 0: 2817 return -cmp(a2[len_a2-1], b2[len_b2-1]) 2818 else: 2819 return cmp(a, b) 2820 else: return 1 2818 if a2[len_a2 - 1] != b2[len_b2 - 1] and num_a != 0: 2819 return -cmp(a2[len_a2 - 1], b2[len_b2 - 1]) 2820 else: 2821 return cmp(a, b) 2822 else: 2823 return 1 2821 2824 # one of them has a number 2822 elif num_a != None: return 1 2823 elif num_b != None: return -1 2825 elif num_a != None: 2826 return 1 2827 elif num_b != None: 2828 return -1 2824 2829 # no numbers 2825 else: return cmp(a.lower(), b.lower())2826 2827 2830 else: 2831 return cmp(a.lower(), b.lower()) 2832 2828 2833 keys.sort(custom_compare) 2829 2834 … … 2831 2836 ix = 0 2832 2837 select_text = "Select All" 2833 self.cb1 = wx.CheckBox(self, -1, str(select_text), (10, 10))2838 self.cb1 = wx.CheckBox(self, -1, str(select_text), (10, 10)) 2834 2839 wx.EVT_CHECKBOX(self, self.cb1.GetId(), self.select_all_param) 2835 2840 self.cb1.SetToolTipString("To check/uncheck all the boxes below.") 2836 2841 self.cb1.SetValue(True) 2837 2842 2838 sizer.Add(self.cb1, (iy, ix),(1,1),\2839 wx.LEFT |wx.EXPAND|wx.ADJUST_MINSIZE, 5)2840 ix += 12843 sizer.Add(self.cb1, (iy, ix), (1, 1),\ 2844 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 5) 2845 ix += 1 2841 2846 self.text2_2 = wx.StaticText(self, -1, 'Value') 2842 sizer.Add(self.text2_2, (iy, ix),(1,1),\2843 wx.EXPAND |wx.ADJUST_MINSIZE, 0)2844 ix += 22847 sizer.Add(self.text2_2, (iy, ix), (1, 1), \ 2848 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 2849 ix += 2 2845 2850 self.text2_3 = wx.StaticText(self, -1, 'Error') 2846 sizer.Add(self.text2_3, (iy, ix),(1,1),\2847 wx.EXPAND |wx.ADJUST_MINSIZE, 0)2851 sizer.Add(self.text2_3, (iy, ix), (1, 1), \ 2852 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 2848 2853 if not self.is_mac: 2849 2854 self.text2_3.Hide() 2850 ix += 12855 ix += 1 2851 2856 self.text2_min = wx.StaticText(self, -1, 'Min') 2852 sizer.Add(self.text2_min, (iy, ix),(1,1),\2853 wx.EXPAND |wx.ADJUST_MINSIZE, 0)2857 sizer.Add(self.text2_min, (iy, ix), (1, 1), \ 2858 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 2854 2859 #self.text2_min.Hide() 2855 ix += 12860 ix += 1 2856 2861 self.text2_max = wx.StaticText(self, -1, 'Max') 2857 sizer.Add(self.text2_max, (iy, ix),(1,1),\2858 wx.EXPAND |wx.ADJUST_MINSIZE, 0)2862 sizer.Add(self.text2_max, (iy, ix), (1, 1), \ 2863 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 2859 2864 #self.text2_max.Hide() 2860 2865 ix += 1 2861 2866 self.text2_4 = wx.StaticText(self, -1, '[Units]') 2862 sizer.Add(self.text2_4, (iy, ix),(1,1),\2863 wx.EXPAND |wx.ADJUST_MINSIZE, 0)2867 sizer.Add(self.text2_4, (iy, ix), (1, 1), \ 2868 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 2864 2869 self.text2_4.Hide() 2865 2870 … … 2870 2875 2871 2876 ##prepare a spot to store errors 2872 if not self.model.details.has_key(item):2873 self.model.details [item] = ["",None,None]2877 if not item in self.model.details: 2878 self.model.details[item] = ["", None, None] 2874 2879 2875 2880 iy += 1 … … 2879 2884 self.temp_multi_functional)\ 2880 2885 and (item in self.model.non_fittable): 2881 non_fittable_name = wx.StaticText(self, -1, item 2882 sizer.Add(non_fittable_name, (iy, ix),(1,1),\2883 wx.LEFT |wx.EXPAND|wx.ADJUST_MINSIZE, 21)2886 non_fittable_name = wx.StaticText(self, -1, item) 2887 sizer.Add(non_fittable_name, (iy, ix), (1, 1), \ 2888 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 21) 2884 2889 ## add parameter value 2885 2890 ix += 1 2886 value = self.model.getParam(item)2891 value = self.model.getParam(item) 2887 2892 if len(self.model.fun_list) > 0: 2888 num = item.split('_')[1][5:7]2889 fun_box = wx.ComboBox(self, -1, size=(100,-1),2890 style=wx.CB_READONLY, name = '%s'% item)2893 #num = item.split('_')[1][5:7] 2894 fun_box = wx.ComboBox(self, -1, size=(100, -1), 2895 style=wx.CB_READONLY, name='%s' % item) 2891 2896 self._set_fun_box_list(fun_box) 2892 2897 fun_box.SetSelection(0) 2893 #self.fun_box.SetToolTipString("A function 2898 #self.fun_box.SetToolTipString("A function 2894 2899 # describing the interface") 2895 wx.EVT_COMBOBOX(fun_box, -1, self._on_fun_box)2900 wx.EVT_COMBOBOX(fun_box, -1, self._on_fun_box) 2896 2901 else: 2897 fun_box = self.ModelTextCtrl(self, -1, 2898 size=(_BOX_WIDTH, 20),2899 style=wx.TE_PROCESS_ENTER, name ='%s'% item)2902 fun_box = self.ModelTextCtrl(self, -1, 2903 size=(_BOX_WIDTH, 20), 2904 style=wx.TE_PROCESS_ENTER, name='%s' % item) 2900 2905 fun_box.SetToolTipString(\ 2901 2906 "Hit 'Enter' after typing to update the plot.") 2902 2907 fun_box.SetValue(format_number(value, True)) 2903 sizer.Add(fun_box, (iy, ix),(1,1), wx.EXPAND)2904 self.str_parameters.append([None, item, fun_box,2905 None, None, None, 2908 sizer.Add(fun_box, (iy, ix), (1, 1), wx.EXPAND) 2909 self.str_parameters.append([None, item, fun_box, 2910 None, None, None, 2906 2911 None, None]) 2907 2908 2909 2912 else: 2910 2913 ## add parameters name with checkbox for selecting to fit 2911 cb = wx.CheckBox(self, -1, item) 2912 cb.SetValue(CHECK_STATE) 2914 cb = wx.CheckBox(self, -1, item) 2915 cb.SetValue(CHECK_STATE) 2913 2916 cb.SetToolTipString(" Check mark to fit.") 2914 2917 #cb.SetValue(True) 2915 2918 wx.EVT_CHECKBOX(self, cb.GetId(), self.select_param) 2916 2919 2917 sizer.Add( cb,( iy, ix),(1,1),2918 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 5)2920 sizer.Add(cb, (iy, ix), (1, 1), 2921 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 5) 2919 2922 2920 2923 ## add parameter value 2921 2924 ix += 1 2922 value = self.model.getParam(item)2923 ctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20),2925 value = self.model.getParam(item) 2926 ctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 2924 2927 style=wx.TE_PROCESS_ENTER) 2925 2928 ctl1.SetToolTipString(\ 2926 2929 "Hit 'Enter' after typing to update the plot.") 2927 2930 ctl1.SetValue(format_number(value, True)) 2928 sizer.Add(ctl1, (iy, ix),(1,1), wx.EXPAND)2931 sizer.Add(ctl1, (iy, ix), (1, 1), wx.EXPAND) 2929 2932 ## text to show error sign 2930 2933 ix += 1 2931 text2 =wx.StaticText(self, -1, '+/-')2932 sizer.Add(text2, (iy, ix),(1,1),\2933 wx.EXPAND|wx.ADJUST_MINSIZE, 0)2934 text2 = wx.StaticText(self, -1, '+/-') 2935 sizer.Add(text2, (iy, ix), (1, 1), \ 2936 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 2934 2937 if not self.is_mac: 2935 text2.Hide() 2938 text2.Hide() 2936 2939 ix += 1 2937 ctl2 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/1.2,20), style=0) 2938 sizer.Add(ctl2, (iy,ix),(1,1), 2939 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 2940 ctl2 = wx.TextCtrl(self, -1, 2941 size=(_BOX_WIDTH / 1.2, 20), style=0) 2942 sizer.Add(ctl2, (iy, ix), (1, 1), 2943 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 2940 2944 if not self.is_mac: 2941 2945 ctl2.Hide() 2942 2946 2943 2947 ix += 1 2944 ctl3 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/1.9,20), 2945 style=wx.TE_PROCESS_ENTER, 2946 text_enter_callback = self._onparamRangeEnter) 2948 ctl3 = self.ModelTextCtrl(self, -1, 2949 size=(_BOX_WIDTH / 1.9, 20), 2950 style=wx.TE_PROCESS_ENTER, 2951 text_enter_callback=self._onparamRangeEnter) 2947 2952 2948 sizer.Add(ctl3, (iy, ix),(1,1),2949 wx.EXPAND |wx.ADJUST_MINSIZE, 0)2953 sizer.Add(ctl3, (iy, ix), (1, 1), 2954 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 2950 2955 2951 2956 ix += 1 2952 ctl4 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/1.9,20), 2953 style=wx.TE_PROCESS_ENTER, 2954 text_enter_callback = self._onparamRangeEnter) 2955 sizer.Add(ctl4, (iy,ix),(1,1), 2956 wx.EXPAND|wx.FIXED_MINSIZE, 0) 2957 ctl4 = self.ModelTextCtrl(self, -1, 2958 size=(_BOX_WIDTH / 1.9, 20), 2959 style=wx.TE_PROCESS_ENTER, 2960 text_enter_callback=self._onparamRangeEnter) 2961 sizer.Add(ctl4, (iy, ix), (1, 1), 2962 wx.EXPAND | wx.FIXED_MINSIZE, 0) 2957 2963 2958 ix += 12964 ix += 1 2959 2965 # Units 2960 if self.model.details.has_key(item):2961 units = wx.StaticText(self, -1, 2966 if item in self.model.details: 2967 units = wx.StaticText(self, -1, 2962 2968 self.model.details[item][0], style=wx.ALIGN_LEFT) 2963 2969 else: 2964 units = wx.StaticText(self, -1, "", style=wx.ALIGN_LEFT) 2965 sizer.Add(units, (iy,ix),(1,1), 2966 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 2970 units = wx.StaticText(self, -1, "", 2971 style=wx.ALIGN_LEFT) 2972 sizer.Add(units, (iy, ix), (1, 1), 2973 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 2967 2974 2968 ##[cb state, name, value, "+/-", error of fit, min, max , units] 2969 self.parameters.append([cb,item, ctl1, 2970 text2,ctl2, ctl3, ctl4,units]) 2975 self.parameters.append([cb, item, ctl1, 2976 text2, ctl2, ctl3, ctl4, units]) 2971 2977 2972 iy +=12973 sizer.Add((10, 10),(iy,ix),(1,1),2974 wx.LEFT |wx.EXPAND|wx.ADJUST_MINSIZE, 15)2978 iy += 1 2979 sizer.Add((10, 10), (iy, ix), (1, 1), 2980 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 2975 2981 2976 2982 # type can be either Guassian or Array 2977 if len(self.model.dispersion.values()) >0:2978 type = self.model.dispersion.values()[0]["type"]2983 if len(self.model.dispersion.values()) > 0: 2984 type = self.model.dispersion.values()[0]["type"] 2979 2985 else: 2980 2986 type = "Gaussian" … … 2984 2990 #Add tile for orientational angle 2985 2991 for item in keys: 2986 if item in self.model.orientation_params: 2992 if item in self.model.orientation_params: 2987 2993 orient_angle = wx.StaticText(self, -1, '[For 2D only]:') 2988 sizer.Add(orient_angle, (iy, ix),(1,1),2989 wx.LEFT |wx.EXPAND|wx.ADJUST_MINSIZE, 15)2994 sizer.Add(orient_angle, (iy, ix), (1, 1), 2995 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 2990 2996 if not self.data.__class__.__name__ == "Data2D" and \ 2991 2997 not self.enable2D: … … 3000 3006 if not item in self.disp_list: 3001 3007 ##prepare a spot to store min max 3002 if not self.model.details.has_key(item):3003 self.model.details [item] = ["",None,None]3008 if not item in self.model.details: 3009 self.model.details[item] = ["", None, None] 3004 3010 3005 3011 iy += 1 3006 3012 ix = 0 3007 3013 ## add parameters name with checkbox for selecting to fit 3008 cb = wx.CheckBox(self, -1, item 3014 cb = wx.CheckBox(self, -1, item) 3009 3015 cb.SetValue(CHECK_STATE) 3010 3016 cb.SetToolTipString("Check mark to fit") … … 3015 3021 else: 3016 3022 cb.Hide() 3017 sizer.Add( cb,( iy, ix),(1,1),3018 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 5)3023 sizer.Add(cb, (iy, ix), (1, 1), 3024 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 5) 3019 3025 3020 3026 ## add parameter value 3021 3027 ix += 1 3022 value = self.model.getParam(item)3023 ctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20),3028 value = self.model.getParam(item) 3029 ctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 3024 3030 style=wx.TE_PROCESS_ENTER) 3025 3031 ctl1.SetToolTipString(\ … … 3031 3037 else: 3032 3038 ctl1.Hide() 3033 sizer.Add(ctl1, (iy, ix),(1,1), wx.EXPAND)3039 sizer.Add(ctl1, (iy, ix), (1, 1), wx.EXPAND) 3034 3040 ## text to show error sign 3035 3041 ix += 1 3036 text2 =wx.StaticText(self, -1, '+/-')3037 sizer.Add(text2, (iy, ix),(1,1),\3038 wx.EXPAND|wx.ADJUST_MINSIZE, 0)3039 3040 text2.Hide() 3042 text2 = wx.StaticText(self, -1, '+/-') 3043 sizer.Add(text2, (iy, ix), (1, 1), \ 3044 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 3045 3046 text2.Hide() 3041 3047 ix += 1 3042 ctl2 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/1.2,20), style=0) 3043 sizer.Add(ctl2, (iy,ix),(1,1), 3044 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 3048 ctl2 = wx.TextCtrl(self, -1, 3049 size=(_BOX_WIDTH / 1.2, 20), style=0) 3050 sizer.Add(ctl2, (iy, ix), (1, 1), 3051 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 3045 3052 3046 3053 ctl2.Hide() 3047 3054 3055 ix += 1 3056 ctl3 = self.ModelTextCtrl(self, -1, 3057 size=(_BOX_WIDTH / 1.8, 20), 3058 style=wx.TE_PROCESS_ENTER, 3059 text_enter_callback=self._onparamRangeEnter) 3048 3060 3049 ix += 1 3050 ctl3 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/1.8,20), 3051 style=wx.TE_PROCESS_ENTER, 3052 text_enter_callback = self._onparamRangeEnter) 3053 3054 sizer.Add(ctl3, (iy,ix),(1,1), 3055 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 3061 sizer.Add(ctl3, (iy, ix), (1, 1), 3062 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 3056 3063 ctl3.Hide() 3057 3064 3058 3065 ix += 1 3059 ctl4 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/1.8,20), 3060 style=wx.TE_PROCESS_ENTER, 3061 text_enter_callback = self._onparamRangeEnter) 3062 sizer.Add(ctl4, (iy,ix),(1,1), 3063 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 3066 ctl4 = self.ModelTextCtrl(self, -1, 3067 size=(_BOX_WIDTH / 1.8, 20), 3068 style=wx.TE_PROCESS_ENTER, 3069 text_enter_callback=self._onparamRangeEnter) 3070 sizer.Add(ctl4, (iy, ix), (1, 1), 3071 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 3064 3072 3065 3073 ctl4.Hide() 3066 3074 3067 3075 if self.data.__class__.__name__ == "Data2D" or \ 3068 self.enable2D: 3069 if self.is_mac: 3076 self.enable2D: 3077 if self.is_mac: 3070 3078 text2.Show(True) 3071 ctl2.Show(True) 3079 ctl2.Show(True) 3072 3080 ctl3.Show(True) 3073 3081 ctl4.Show(True) 3074 3082 3075 ix += 13083 ix += 1 3076 3084 # Units 3077 if self.model.details.has_key(item):3078 units = wx.StaticText(self, -1, 3079 self.model.details[item][0], 3085 if item in self.model.details: 3086 units = wx.StaticText(self, -1, 3087 self.model.details[item][0], 3080 3088 style=wx.ALIGN_LEFT) 3081 3089 else: 3082 units = wx.StaticText(self, -1, "", style=wx.ALIGN_LEFT) 3090 units = wx.StaticText(self, -1, "", 3091 style=wx.ALIGN_LEFT) 3083 3092 if self.data.__class__.__name__ == "Data2D" or \ 3084 3093 self.enable2D: 3085 3094 units.Show(True) 3086 3087 3095 else: 3088 3096 units.Hide() 3089 3097 3090 sizer.Add(units, (iy, ix),(1,1),3091 wx.EXPAND |wx.ADJUST_MINSIZE, 0)3098 sizer.Add(units, (iy, ix), (1, 1), 3099 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 3092 3100 3093 ##[cb state, name, value, "+/-", error of fit,min,max,units] 3094 self.parameters.append([cb,item, ctl1, 3095 text2,ctl2, ctl3, ctl4,units]) 3096 self.orientation_params.append([cb,item, ctl1, 3097 text2,ctl2, ctl3, ctl4,units]) 3101 self.parameters.append([cb, item, ctl1, 3102 text2, ctl2, ctl3, ctl4, units]) 3103 self.orientation_params.append([cb, item, ctl1, 3104 text2, ctl2, ctl3, ctl4, units]) 3098 3105 3099 iy +=13106 iy += 1 3100 3107 box_description.SetForegroundColour(wx.BLUE) 3101 3108 #Display units text on panel 3102 for item in keys: 3103 if self.model.details.has_key(item):3109 for item in keys: 3110 if item in self.model.details: 3104 3111 self.text2_4.Show() 3105 3112 #Fill the list of fittable parameters … … 3107 3114 self.save_current_state_fit() 3108 3115 boxsizer1.Add(sizer) 3109 self.sizer3.Add(boxsizer1, 0, wx.EXPAND | wx.ALL, 10)3116 self.sizer3.Add(boxsizer1, 0, wx.EXPAND | wx.ALL, 10) 3110 3117 self.sizer3.Layout() 3111 3118 self.Layout() 3112 #self.Refresh()3113 3119 3114 3120 def on_right_down(self, event): … … 3134 3140 infor = 'warning' 3135 3141 # inform msg to wx 3136 wx.PostEvent( self.parent.parent, 3137 StatusEvent(status= msg, info=infor)) 3138 3142 wx.PostEvent(self.parent.parent, 3143 StatusEvent(status=msg, info=infor)) 3139 3144 3140 3145 def _onModel2D(self, event): … … 3154 3159 3155 3160 self.set_model_param_sizer(self.model) 3156 self._set_sizer_dispersion() 3157 self._set_weight(is_2D= 3161 self._set_sizer_dispersion() 3162 self._set_weight(is_2D=self.enable2D) 3158 3163 self._set_smear_buttons() 3159 3164 self.Show(True) … … 3161 3166 self._draw_model() 3162 3167 3163 self.state.enable2D = 3168 self.state.enable2D = copy.deepcopy(self.enable2D) 3164 3169 3165 3170 def _set_smear_buttons(self): 3166 3171 """ 3167 Set semarer radio buttons 3172 Set semarer radio buttons 3168 3173 """ 3169 3174 # more disables for 2D 3170 if self.data.__class__.__name__ == 3175 if self.data.__class__.__name__ == "Data2D" or \ 3171 3176 self.enable2D: 3172 3177 self.slit_smearer.Disable() 3173 self.pinhole_smearer.Enable(True) 3178 self.pinhole_smearer.Enable(True) 3174 3179 self.default_mask = copy.deepcopy(self.data.mask) 3175 3180 else: 3176 self.slit_smearer.Enable(True) 3177 self.pinhole_smearer.Enable(True) 3181 self.slit_smearer.Enable(True) 3182 self.pinhole_smearer.Enable(True) 3178 3183 3179 3184 … … 3181 3186 """ 3182 3187 Text control used to display outputs. 3183 No editing allowed. The background is 3188 No editing allowed. The background is 3184 3189 grayed out. User can't select text. 3185 3190 """ … … 3198 3203 Prevent further handling of the mouse event 3199 3204 by not calling Skip(). 3200 """ 3205 """ 3201 3206 pass 3202
Note: See TracChangeset
for help on using the changeset viewer.