Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/fitting/basepage.py

    r1a8e13f0 rb301db9  
    5353    ON_MAC = True 
    5454 
     55CUSTOM_MODEL = 'Plugin Models' 
     56 
    5557class BasicPage(ScrolledPanel, PanelBase): 
    5658    """ 
    57     This class provide general structure of fitpanel page 
     59    This class provide general structure of the fitpanel page 
    5860    """ 
    5961    # Internal name for the AUI manager 
     
    118120        self.dxw = None 
    119121        # pinhole smear 
    120         self.dx_min = None 
    121         self.dx_max = None 
     122        self.dx_percent = None 
    122123        # smear attrbs 
    123124        self.enable_smearer = None 
     
    677678    def _copy_info(self, flag): 
    678679        """ 
    679         Send event dpemding on flag 
    680  
    681         : Param flag: flag that distinguish event 
     680        Send event depending on flag 
     681 
     682        : Param flag: flag that distinguishes the event 
    682683        """ 
    683684        # messages depending on the flag 
     
    847848        self.state.pinhole_smearer = \ 
    848849                                copy.deepcopy(self.pinhole_smearer.GetValue()) 
    849         self.state.dx_max = copy.deepcopy(self.dx_max) 
    850         self.state.dx_min = copy.deepcopy(self.dx_min) 
     850        self.state.dx_percent = copy.deepcopy(self.dx_percent) 
    851851        self.state.dxl = copy.deepcopy(self.dxl) 
    852852        self.state.dxw = copy.deepcopy(self.dxw) 
     
    11191119        :precondition: the page is already drawn or created 
    11201120 
    1121         :postcondition: the state of the underlying data change as well as the 
     1121        :postcondition: the state of the underlying data changes as well as the 
    11221122            state of the graphic interface 
    11231123        """ 
     
    11671167        self._show_combox(None) 
    11681168        from models import PLUGIN_NAME_BASE 
    1169         if self.categorybox.GetValue() == 'Customized Models' \ 
     1169        if self.categorybox.GetValue() == CUSTOM_MODEL \ 
    11701170                and PLUGIN_NAME_BASE not in state.formfactorcombobox: 
    11711171            state.formfactorcombobox = \ 
     
    12451245        # we have two more options for smearing 
    12461246        if self.pinhole_smearer.GetValue(): 
    1247             self.dx_min = state.dx_min 
    1248             self.dx_max = state.dx_max 
    1249             if self.dx_min is not None: 
    1250                 self.smear_pinhole_min.SetValue(str(self.dx_min)) 
    1251             if self.dx_max is not None: 
    1252                 self.smear_pinhole_max.SetValue(str(self.dx_max)) 
     1247            self.dx_percent = state.dx_percent 
     1248            if self.dx_percent is not None: 
     1249                if state.dx_old: 
     1250                    self.dx_percent = 100 * (self.dx_percent / self.data.x[0]) 
     1251                self.smear_pinhole_percent.SetValue("%.2f" % self.dx_percent) 
    12531252            self.onPinholeSmear(event=None) 
    12541253        elif self.slit_smearer.GetValue(): 
     
    13351334    def _selectDlg(self): 
    13361335        """ 
    1337         open a dialog file to selected the customized dispersity 
     1336        open a dialog file to select the customized polydispersity function 
    13381337        """ 
    13391338        if self.parent is not None: 
     
    14501449                self.state_change = True 
    14511450                self._draw_model() 
     1451                # Time delay has been introduced to prevent _handle error 
     1452                # on Windows 
     1453                # This part of code is executed when model is selected and 
     1454                # it's parameters are changed (with respect to previously 
     1455                # selected model). There are two Iq evaluations occuring one 
     1456                # after another and therefore there may be compilation error 
     1457                # if model is calculated for the first time. 
     1458                # This seems to be Windows only issue - haven't tested on Linux 
     1459                # though.The proper solution (other than time delay) requires 
     1460                # more fundemental code refatoring 
     1461                # Wojtek P. Nov 7, 2016 
     1462                if not ON_MAC: 
     1463                    time.sleep(0.1) 
    14521464                self.Refresh() 
    14531465 
     
    17471759    def _set_multfactor_combobox(self, multiplicity=10): 
    17481760        """ 
    1749         Set comboBox for muitfactor of CoreMultiShellModel 
     1761        Set comboBox for multitfactor of CoreMultiShellModel 
    17501762        :param multiplicit: no. of multi-functionality 
    17511763        """ 
     
    17851797        Fill panel's combo box according to the type of model selected 
    17861798        """ 
    1787         custom_model = 'Customized Models' 
     1799 
    17881800        mod_cat = self.categorybox.GetStringSelection() 
    17891801        self.structurebox.SetSelection(0) 
     
    17941806        m_list = [] 
    17951807        try: 
    1796             if mod_cat == custom_model: 
     1808            if mod_cat == CUSTOM_MODEL: 
    17971809                for model in self.model_list_box[mod_cat]: 
    17981810                    m_list.append(self.model_dict[model.name]) 
     
    25972609            Layout is called after fitting. 
    25982610        """ 
     2611        self._sleep4sec() 
    25992612        self.Layout() 
    26002613        return 
     2614 
     2615    def _sleep4sec(self): 
     2616        """ 
     2617            sleep for 1 sec only applied on Mac 
     2618            Note: This 1sec helps for Mac not to crash on self. 
     2619            Layout after self._draw_model 
     2620        """ 
     2621        if ON_MAC: 
     2622            time.sleep(1) 
    26012623 
    26022624    def _find_polyfunc_selection(self, disp_func=None): 
     
    34303452        fills out the category list box 
    34313453        """ 
    3432         uncat_str = 'Customized Models' 
     3454        uncat_str = 'Plugin Models' 
    34333455        self._read_category_info() 
    34343456 
     
    34593481        self.model_box.Clear() 
    34603482 
    3461         if category == 'Customized Models': 
     3483        if category == 'Plugin Models': 
    34623484            for model in self.model_list_box[category]: 
    34633485                str_m = str(model).split(".")[0] 
Note: See TracChangeset for help on using the changeset viewer.