Ignore:
File:
1 edited

Legend:

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

    rc8e1996 r55db501  
    1919 
    2020from sas.sasgui.guiframe.panel_base import PanelBase 
    21 from sas.sasgui.guiframe.utils import format_number, check_float, IdList, \ 
    22     check_int 
     21from sas.sasgui.guiframe.utils import format_number, check_float, IdList, check_int 
    2322from sas.sasgui.guiframe.events import PanelOnFocusEvent 
    2423from sas.sasgui.guiframe.events import StatusEvent 
     
    4342_QMAX_DEFAULT = 0.5 
    4443_NPTS_DEFAULT = 50 
    45 # Control panel width 
     44#Control panel width 
    4645if sys.platform.count("win32") > 0: 
    4746    PANEL_WIDTH = 450 
     
    5857    This class provide general structure of  fitpanel page 
    5958    """ 
    60     # Internal name for the AUI manager 
     59    ## Internal name for the AUI manager 
    6160    window_name = "Fit Page" 
    62     # Title to appear on top of the window 
     61    ## Title to appear on top of the window 
    6362    window_caption = "Fit Page " 
    6463 
     
    7675        PanelBase.__init__(self, parent) 
    7776        self.SetupScrolling() 
    78         # Set window's font size 
     77        #Set window's font size 
    7978        self.SetWindowVariant(variant=FONT_VARIANT) 
    8079        self.SetBackgroundColour(color) 
    8180 
    8281        self._ids = iter(self._id_pool) 
    83         # parent of the page 
     82        ## parent of the page 
    8483        self.parent = parent 
    85         # manager is the fitting plugin 
    86         # owner of the page (fitting plugin) 
     84        ## manager is the fitting plugin 
     85        ## owner of the page (fitting plugin) 
    8786        self.event_owner = None 
    88         # current model 
     87        ## current model 
    8988        self.model = None 
    9089        self.m_name = None 
    9190        self.index_model = None 
    9291        self.panel = None 
    93         # data 
     92        ## data 
    9493        self.data = None 
    95         # list of available data 
     94        #list of available data 
    9695        self.data_list = [] 
    9796        self.mask = None 
    9897        self.uid = wx.NewId() 
    9998        self.graph_id = None 
    100         # Q range for data set 
     99        #Q range for data set 
    101100        self.qmin_data_set = numpy.inf 
    102101        self.qmax_data_set = None 
    103102        self.npts_data_set = 0 
    104         # Q range 
     103        ## Q range 
    105104        self.qmin = None 
    106105        self.qmax = None 
     
    108107        self.qmin_x = _QMIN_DEFAULT 
    109108        self.npts_x = _NPTS_DEFAULT 
    110         # total number of point: float 
     109        ## total number of point: float 
    111110        self.npts = None 
    112111        self.num_points = None 
    113         # smear default 
     112        ## smear default 
    114113        self.current_smearer = None 
    115         # 2D smear accuracy default 
     114        ## 2D smear accuracy default 
    116115        self.smear2d_accuracy = 'Low' 
    117         # slit smear: 
     116        ## slit smear: 
    118117        self.dxl = None 
    119118        self.dxw = None 
    120         # pinhole smear 
     119        ## pinhole smear 
    121120        self.dx_min = None 
    122121        self.dx_max = None 
    123         # smear attrbs 
     122        ##semar attrbs 
    124123        self.enable_smearer = None 
    125124        self.disable_smearer = None 
    126125        self.pinhole_smearer = None 
    127126        self.slit_smearer = None 
    128         # weight attrbs 
     127        ##weigth attrbs 
    129128        self.dI_noweight = None 
    130129        self.dI_didata = None 
    131130        self.dI_sqrdata = None 
    132131        self.dI_idata = None 
    133         # other attrbs 
     132        ##other attrbs 
    134133        self.dq_l = None 
    135134        self.dq_r = None 
     
    143142        self.theory_qmin_x = None 
    144143        self.theory_qmax_x = None 
     144        self.cb1 = None 
    145145        self.btEditMask = None 
    146146        self.btFit = None 
     
    150150        self.disp_cb_dict = {} 
    151151 
    152         # self.state = PageState(parent=parent) 
    153         # dictionary containing list of models 
     152        #self.state = PageState(parent=parent) 
     153        ## dictionary containing list of models 
    154154        self.model_list_box = {} 
    155155 
    156         # Data member to store the dispersion object created 
     156        ## Data member to store the dispersion object created 
    157157        self._disp_obj_dict = {} 
    158         # selected parameters to apply dispersion 
     158        ## selected parameters to apply dispersion 
    159159        self.disp_cb_dict = {} 
    160         # smearer object 
     160        ## smearer object 
    161161        self.enable2D = False 
    162162        self._has_magnetic = False 
     
    166166        self.structurebox = None 
    167167        self.categorybox = None 
    168         # list of model parameters. each item must have same length 
    169         # each item related to a given parameters 
    170         # [cb state, name, value, "+/-", error of fit, min, max , units] 
     168        ##list of model parameters. each item must have same length 
     169        ## each item related to a given parameters 
     170        ##[cb state, name, value, "+/-", error of fit, min, max , units] 
    171171        self.parameters = [] 
    172172        # non-fittable parameter whose value is astring 
    173173        self.str_parameters = [] 
    174         # list of parameters to fit , must be like self.parameters 
     174        ## list of parameters to fit , must be like self.parameters 
    175175        self.param_toFit = [] 
    176         # list of looking like parameters but with non fittable parameters info 
     176        ## list of looking like parameters but with non fittable parameters info 
    177177        self.fixed_param = [] 
    178         # list of looking like parameters but with  fittable parameters info 
     178        ## list of looking like parameters but with  fittable parameters info 
    179179        self.fittable_param = [] 
    180         # list of dispersion parameters 
     180        ##list of dispersion parameters 
    181181        self.disp_list = [] 
    182182        self.disp_name = "" 
    183183 
    184         # list of orientation parameters 
     184        ## list of orientation parameters 
    185185        self.orientation_params = [] 
    186186        self.orientation_params_disp = [] 
     
    189189#       and this - commenting out on 4/8/2014 by PDB.  Remove once clear 
    190190#       it is pointless. 
    191 #        if self.model is not None: 
     191#        if self.model != None: 
    192192#            self.disp_list = self.model.getDispParamList() 
    193193        self.temp_multi_functional = False 
    194         # enable model 2D draw 
     194        ##enable model 2D draw 
    195195        self.enable2D = False 
    196         # check that the fit range is correct to plot the model again 
     196        ## check that the fit range is correct to plot the model again 
    197197        self.fitrange = True 
    198         # Create memento to save the current state 
     198        ## Create memento to save the current state 
    199199        self.state = PageState(parent=self.parent, 
    200200                               model=self.model, data=self.data) 
    201         # flag to determine if state has change 
     201        ## flag to determine if state has change 
    202202        self.state_change = False 
    203         # save customized array 
     203        ## save customized array 
    204204        self.values = {}   # type: Dict[str, List[float, ...]] 
    205205        self.weights = {}   # type: Dict[str, List[float, ...]] 
    206         # retrieve saved state 
     206        ## retrieve saved state 
    207207        self.number_saved_state = 0 
    208         # dictionary of saved state 
     208        ## dictionary of saved state 
    209209        self.saved_states = {} 
    210         # Create context menu for page 
     210        ## Create context menu for page 
    211211        self.popUpMenu = wx.Menu() 
    212212 
     
    221221        self.popUpMenu.AppendSeparator() 
    222222 
    223         # Default locations 
     223        ## Default locations 
    224224        self._default_save_location = os.getcwd() 
    225         # save initial state on context menu 
    226         # self.onSave(event=None) 
     225        ## save initial state on context menu 
     226        #self.onSave(event=None) 
    227227        self.Bind(wx.EVT_CONTEXT_MENU, self.onContextMenu) 
    228228 
     
    230230        self.Bind(wx.EVT_LEFT_DOWN, self.on_left_down) 
    231231 
    232         # create the basic structure of the panel with empty sizer 
     232        ## create the basic structure of the panel with empty sizer 
    233233        self.define_page_structure() 
    234         # drawing Initial dispersion parameters sizer 
     234        ## drawing Initial dispersion parameters sizer 
    235235        self.set_dispers_sizer() 
    236236 
    237         # layout 
     237        ## layout 
    238238        self.set_layout() 
    239239 
     
    261261                    self._create_default_1d_data() 
    262262 
    263             if self.model is not None: 
     263            if self.model != None: 
    264264                if not self.data.is_data: 
    265                     self._manager.page_finder[self.uid].set_fit_data( 
    266                         data=[self.data]) 
     265                    self._manager.page_finder[self.uid].set_fit_data(data=\ 
     266                                                                [self.data]) 
    267267            self.on_smear_helper(update=True) 
    268268            self.state.enable_smearer = self.enable_smearer.GetValue() 
     
    281281                           num=self.npts_x, endpoint=True) 
    282282        self.data = Data1D(x=x) 
    283         self.data.xaxis('\\rm{Q}', "A^{-1}") 
    284         self.data.yaxis('\\rm{Intensity}', "cm^{-1}") 
     283        #self.data.xaxis('\\rm{Q}', "A^{-1}") 
     284        self.data.xaxis('\\rm{X}', "") 
     285        #self.data.yaxis('\\rm{Intensity}', "cm^{-1}") 
     286        self.data.yaxis('\\rm{Y}', "") 
    285287        self.data.is_data = False 
    286288        self.data.id = str(self.uid) + " data" 
     
    307309                           num=self.npts_x, endpoint=True, base=10.0) 
    308310        self.data = Data1D(x=x) 
    309         self.data.xaxis('\\rm{Q}', "A^{-1}") 
    310         self.data.yaxis('\\rm{Intensity}', "cm^{-1}") 
     311        #self.data.xaxis('\\rm{Q}', "A^{-1}") 
     312        #self.data.yaxis('\\rm{Intensity}', "cm^{-1}") 
     313        self.data.xaxis('\\rm{X}', "") 
     314        self.data.yaxis('\\rm{Y}', "") 
    311315        self.data.is_data = False 
    312316        self.data.id = str(self.uid) + " data" 
     
    326330        self.data.id = str(self.uid) + " data" 
    327331        self.data.group_id = str(self.uid) + " Model2D" 
    328         # Default values 
     332        ## Default values 
    329333        self.data.detector.append(Detector()) 
    330334        index = len(self.data.detector) - 1 
     
    343347        x = numpy.linspace(start=xmin, stop=xmax, num=qstep, endpoint=True) 
    344348        y = numpy.linspace(start=ymin, stop=ymax, num=qstep, endpoint=True) 
    345         # use data info instead 
     349        ## use data info instead 
    346350        new_x = numpy.tile(x, (len(y), 1)) 
    347351        new_y = numpy.tile(y, (len(x), 1)) 
     
    384388        Update menu1 on cliking the page tap 
    385389        """ 
    386         if self._manager.menu1 is not None: 
    387             chain_menu = self._manager.menu1.FindItemById( 
     390        if self._manager.menu1 != None: 
     391            chain_menu = self._manager.menu1.FindItemById(\ 
    388392                                                   self._manager.id_reset_flag) 
    389393            chain_menu.Enable(self.batch_on) 
    390394            sim_menu = self._manager.menu1.FindItemById(self._manager.id_simfit) 
    391395            flag = self.data.is_data\ 
    392                             and (self.model is not None) 
     396                            and (self.model != None) 
    393397            sim_menu.Enable(not self.batch_on and flag) 
    394398            batch_menu = \ 
     
    531535        fill sizer containing dispersity info 
    532536        """ 
    533         # print "==== entering set_dispers_sizer ===" 
     537        #print "==== entering set_dispers_sizer ===" 
    534538        self.sizer4.Clear(True) 
    535539        name = "Polydispersity and Orientational Distribution" 
     
    537541        box_description.SetForegroundColour(wx.BLUE) 
    538542        boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL) 
    539         # ---------------------------------------------------- 
     543        #---------------------------------------------------- 
    540544        self.disable_disp = wx.RadioButton(self, wx.ID_ANY, 'Off', (10, 10), 
    541545                                           style=wx.RB_GROUP) 
     
    557561        self.Bind(wx.EVT_RADIOBUTTON, self._set_dipers_Param, 
    558562                  id=self.enable_disp.GetId()) 
    559         # MAC needs SetValue 
     563        #MAC needs SetValue 
    560564        self.disable_disp.SetValue(True) 
    561565        sizer_dispersion = wx.BoxSizer(wx.HORIZONTAL) 
     
    569573        sizer_dispersion.Add(self.disp_help_bt) 
    570574 
    571         # fill a sizer for dispersion 
     575        ## fill a sizer for dispersion 
    572576        boxsizer1.Add(sizer_dispersion, 0, 
    573577                      wx.TOP|wx.BOTTOM|wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 
     
    576580 
    577581        boxsizer1.Add(self.sizer4_4) 
    578         # ----------------------------------------------------- 
     582        #----------------------------------------------------- 
    579583        self.sizer4.Add(boxsizer1, 0, wx.EXPAND | wx.ALL, 10) 
    580584        self.sizer4_4.Layout() 
     
    583587 
    584588        self.Refresh() 
    585         # saving the state of enable dispersity button 
     589        ## saving the state of enable dispersity button 
    586590        self.state.enable_disp = self.enable_disp.GetValue() 
    587591        self.state.disable_disp = self.disable_disp.GetValue() 
     
    593597        """ 
    594598        menu = event.GetEventObject() 
    595         # post help message for the selected model 
     599        ## post help message for the selected model 
    596600        msg = menu.GetHelpString(event.GetId()) 
    597601        msg += " reloaded" 
     
    600604        name = menu.GetLabel(event.GetId()) 
    601605        self._on_select_model_helper() 
    602         if self.model is not None: 
     606        if self.model != None: 
    603607            self.m_name = self.model.name 
    604608        if name in self.saved_states.keys(): 
    605609            previous_state = self.saved_states[name] 
    606             # reset state of checkbox,textcrtl  and  regular parameters value 
     610            ## reset state of checkbox,textcrtl  and  regular parameters value 
    607611 
    608612            self.reset_page(previous_state) 
     
    627631        # Ask the user the location of the file to write to. 
    628632        path = None 
    629         if self.parent is not None: 
     633        if self.parent != None: 
    630634            self._default_save_location = \ 
    631635                        self._manager.parent._default_save_location 
     
    637641            self._default_save_location = os.path.dirname(path) 
    638642            self._manager.parent._default_save_location = \ 
    639                 self._default_save_location 
     643                                self._default_save_location 
    640644        else: 
    641645            return None 
     
    644648        # Make sure the ext included in the file name 
    645649        fName = os.path.splitext(path)[0] + extens 
    646         # the manager write the state into file 
     650        #the manager write the state into file 
    647651        self._manager.save_fit_state(filepath=fName, fitstate=new_state) 
    648652        return new_state 
     
    652656        Copy Parameter values to the clipboad 
    653657        """ 
    654         if event is not None: 
     658        if event != None: 
    655659            event.Skip() 
    656660        # It seems MAC needs wxCallAfter 
     
    668672        Paste Parameter values to the panel if possible 
    669673        """ 
    670         # if event is not None: 
     674        #if event != None: 
    671675        #    event.Skip() 
    672676        # It seems MAC needs wxCallAfter for the setvalues 
     
    674678        wx.CallAfter(self.get_paste) 
    675679        # messages depending on the flag 
    676         # self._copy_info(True) 
     680        #self._copy_info(True) 
    677681 
    678682    def _copy_info(self, flag): 
     
    683687        """ 
    684688        # messages depending on the flag 
    685         if flag is None: 
     689        if flag == None: 
    686690            msg = " Parameter values are copied to the clipboard..." 
    687691            infor = 'warning' 
     
    711715        save history of the data and model 
    712716        """ 
    713         if self.model is None: 
     717        if self.model == None: 
    714718            msg = "Can not bookmark; Please select Data and Model first..." 
    715719            wx.MessageBox(msg, 'Info') 
     
    717721        self.save_current_state() 
    718722        new_state = self.state.clone() 
    719         # Add model state on context menu 
     723        ##Add model state on context menu 
    720724        self.number_saved_state += 1 
    721725        current_time, current_date = self._get_time_stamp() 
    722         # name= self.model.name+"[%g]"%self.number_saved_state 
     726        #name= self.model.name+"[%g]"%self.number_saved_state 
    723727        name = "Fitting: %g]" % self.number_saved_state 
    724728        name += self.model.__class__.__name__ 
     
    726730        self.saved_states[name] = new_state 
    727731 
    728         # Add item in the context menu 
     732        ## Add item in the context menu 
    729733        msg = "Model saved at %s on %s" % (current_time, current_date) 
    730         # post help message for the selected model 
     734        ## post help message for the selected model 
    731735        msg += " Saved! right click on this page to retrieve this model" 
    732736        wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 
     
    762766        """ 
    763767        try: 
    764             if path is None: 
     768            if path == None: 
    765769                status = " Selected Distribution was not loaded: %s" % path 
    766770                wx.PostEvent(self._manager.parent, 
     
    797801        Store current state 
    798802        """ 
    799         # save model option 
    800         if self.model is not None: 
     803        ## save model option 
     804        if self.model != None: 
    801805            self.disp_list = self.model.getDispParamList() 
    802806            self.state.disp_list = copy.deepcopy(self.disp_list) 
    803807            self.state.model = self.model.clone() 
    804808 
    805             # model combobox: complex code because of mac's silent error 
    806             if self.structurebox is not None: 
     809            #model combobox: complex code because of mac's silent error 
     810            if self.structurebox != None: 
    807811                if self.structurebox.IsShown(): 
    808812                    self.state.structurecombobox = 'None' 
    809813                    s_select = self.structurebox.GetSelection() 
    810814                    if s_select > 0: 
    811                         self.state.structurecombobox = \ 
    812                             self.structurebox.GetString(s_select) 
    813             if self.formfactorbox is not None: 
     815                        self.state.structurecombobox = self.structurebox.\ 
     816                        GetString(s_select) 
     817            if self.formfactorbox != None: 
    814818                f_select = self.formfactorbox.GetSelection() 
    815819                if f_select > 0: 
    816                     self.state.formfactorcombobox = \ 
    817                         self.formfactorbox.GetString(f_select) 
    818         if self.categorybox is not None: 
     820                    self.state.formfactorcombobox = self.formfactorbox.\ 
     821                    GetString(f_select) 
     822        if self.categorybox != None: 
    819823            cb_select = self.categorybox.GetSelection() 
    820824            if cb_select > 0: 
    821                 self.state.categorycombobox = \ 
    822                     self.categorybox.GetString(cb_select) 
     825                self.state.categorycombobox = self.categorybox.\ 
     826                GetString(cb_select) 
    823827 
    824828        self.state.enable2D = copy.deepcopy(self.enable2D) 
    825829        self.state.values = copy.deepcopy(self.values) 
    826830        self.state.weights = copy.deepcopy(self.weights) 
    827         # save data 
     831        ## save data 
    828832        self.state.data = copy.deepcopy(self.data) 
    829833        self.state.qmax_x = self.qmax_x 
     
    860864            self.state.values = copy.deepcopy(self.values) 
    861865            self.state.weights = copy.deepcopy(self.weights) 
    862         # save plotting range 
     866        ## save plotting range 
    863867        self._save_plotting_range() 
    864868 
     
    870874        self.state.str_parameters = [] 
    871875 
    872         # save checkbutton state and txtcrtl values 
     876        ## save checkbutton state and txtcrtl values 
    873877        self._copy_parameters_state(self.str_parameters, 
    874878                                    self.state.str_parameters) 
     
    882886                                    self.state.fittable_param) 
    883887        self._copy_parameters_state(self.fixed_param, self.state.fixed_param) 
    884         # save chisqr 
     888        #save chisqr 
    885889        self.state.tcChi = self.tcChi.GetValue() 
    886890 
     
    889893        Store current state for fit_page 
    890894        """ 
    891         # save model option 
    892         if self.model is not None: 
     895        ## save model option 
     896        if self.model != None: 
    893897            self.disp_list = self.model.getDispParamList() 
    894898            self.state.disp_list = copy.deepcopy(self.disp_list) 
     
    898902        self.state.values = copy.deepcopy(self.values) 
    899903        self.state.weights = copy.deepcopy(self.weights) 
    900         # save data 
     904        ## save data 
    901905        self.state.data = copy.deepcopy(self.data) 
    902906 
     
    919923        self.state.dI_sqrdata = copy.deepcopy(self.dI_sqrdata.GetValue()) 
    920924        self.state.dI_idata = copy.deepcopy(self.dI_idata.GetValue()) 
    921         if hasattr(self, "disp_box") and self.disp_box is not None: 
     925        if hasattr(self, "disp_box") and self.disp_box != None: 
    922926            self.state.disp_box = self.disp_box.GetCurrentSelection() 
    923927 
    924928            if len(self.disp_cb_dict) > 0: 
    925929                for k, v in self.disp_cb_dict.iteritems(): 
    926                     if v is None: 
     930                    if v == None: 
    927931                        self.state.disp_cb_dict[k] = v 
    928932                    else: 
     
    938942            self.state.weights = copy.deepcopy(self.weights) 
    939943 
    940         # save plotting range 
     944        ## save plotting range 
    941945        self._save_plotting_range() 
    942946 
    943         # save checkbutton state and txtcrtl values 
     947        ## save checkbutton state and txtcrtl values 
    944948        self._copy_parameters_state(self.orientation_params, 
    945949                                    self.state.orientation_params) 
     
    960964            msg = "Please load Data and select Model to start..." 
    961965            wx.MessageBox(msg, 'Info') 
    962             return True 
     966            return  True 
    963967 
    964968    def set_model_state(self, state): 
     
    969973        self.disp_list = state.disp_list 
    970974 
    971         # fill model combobox 
     975        ## fill model combobox 
    972976        self._show_combox_helper() 
    973         # select the current model 
     977        #select the current model 
    974978        try: 
    975979            # to support older version 
     
    10101014        self.structurebox.SetSelection(structfactor_pos) 
    10111015 
    1012         if state.multi_factor is not None: 
     1016        if state.multi_factor != None: 
    10131017            self.multifactorbox.SetSelection(state.multi_factor) 
    10141018 
    1015         # reset state of checkbox,textcrtl  and  regular parameters value 
     1019        ## reset state of checkbox,textcrtl  and  regular parameters value 
    10161020        self._reset_parameters_state(self.orientation_params_disp, 
    10171021                                     state.orientation_params_disp) 
     
    10211025                                     state.str_parameters) 
    10221026        self._reset_parameters_state(self.parameters, state.parameters) 
    1023         # display dispersion info layer 
     1027        ## display dispersion info layer 
    10241028        self.enable_disp.SetValue(state.enable_disp) 
    10251029        self.disable_disp.SetValue(state.disable_disp) 
    10261030 
    1027         if hasattr(self, "disp_box") and self.disp_box is not None: 
     1031        if hasattr(self, "disp_box") and self.disp_box != None: 
    10281032            self.disp_box.SetSelection(state.disp_box) 
    10291033            n = self.disp_box.GetCurrentSelection() 
     
    10371041 
    10381042                    if hasattr(self.disp_cb_dict[item], "SetValue"): 
    1039                         self.disp_cb_dict[item].SetValue( 
     1043                        self.disp_cb_dict[item].SetValue(\ 
    10401044                                                    state.disp_cb_dict[item]) 
    10411045                        # Create the dispersion objects 
    10421046                        disp_model = POLYDISPERSITY_MODELS['array']() 
    10431047                        if hasattr(state, "values") and \ 
    1044                                  self.disp_cb_dict[item].GetValue() is True: 
     1048                                 self.disp_cb_dict[item].GetValue() == True: 
    10451049                            if len(state.values) > 0: 
    10461050                                self.values = state.values 
     
    10531057                        self._disp_obj_dict[item] = disp_model 
    10541058                        # Set the new model as the dispersion object 
    1055                         # for the selected parameter 
     1059                        #for the selected parameter 
    10561060                        self.model.set_dispersion(item, disp_model) 
    10571061 
     
    10631067                for item in keys: 
    10641068                    if item in self.disp_list and \ 
    1065                             item not in self.model.details: 
     1069                        not item in self.model.details: 
    10661070                        self.model.details[item] = ["", None, None] 
    10671071                self.disp_cb_dict = copy.deepcopy(state.disp_cb_dict) 
    10681072                self.state.disp_cb_dict = copy.deepcopy(state.disp_cb_dict) 
    1069         # smearing info  restore 
     1073        ## smearing info  restore 
    10701074        if hasattr(self, "enable_smearer"): 
    1071             # set smearing value whether or not the data 
    1072             # contain the smearing info 
     1075            ## set smearing value whether or not the data 
     1076            #contain the smearing info 
    10731077            self.enable_smearer.SetValue(state.enable_smearer) 
    10741078            self.disable_smearer.SetValue(state.disable_smearer) 
     
    10821086        self.dI_idata.SetValue(state.dI_idata) 
    10831087 
    1084         # we have two more options for smearing 
     1088        ## we have two more options for smearing 
    10851089        if self.pinhole_smearer.GetValue(): 
    10861090            self.onPinholeSmear(event=None) 
     
    10881092            self.onSlitSmear(event=None) 
    10891093 
    1090         # reset state of checkbox,textcrtl  and dispersity parameters value 
     1094        ## reset state of checkbox,textcrtl  and dispersity parameters value 
    10911095        self._reset_parameters_state(self.fittable_param, state.fittable_param) 
    10921096        self._reset_parameters_state(self.fixed_param, state.fixed_param) 
    10931097 
    1094         # draw the model with previous parameters value 
     1098        ## draw the model with previous parameters value 
    10951099        self._onparamEnter_helper() 
    10961100        self.select_param(event=None) 
    1097         # Save state_fit 
     1101        #Save state_fit 
    10981102        self.save_current_state_fit() 
    10991103        self._lay_out() 
     
    11091113                if state.formfactorcombobox in list_item: 
    11101114                    return self.categorybox.Items.index(key) 
    1111         return 0 
    11121115 
    11131116    def reset_page_helper(self, state): 
     
    11201123            state of the graphic interface 
    11211124        """ 
    1122         if state is None: 
     1125        if state == None: 
    11231126            return 
    11241127        # set data, etc. from the state 
    11251128        # reset page between theory and fitting from bookmarking 
     1129        #if state.data == None: 
     1130        #    data = None 
     1131        #else: 
    11261132        data = state.data 
    11271133 
    1128         if data is None: 
     1134        if data == None: 
    11291135            data_min = state.qmin 
    11301136            data_max = state.qmax 
     
    11501156        self.disp_list = state.disp_list 
    11511157 
    1152         # fill model combobox 
     1158        ## set the state of the radio box 
     1159        #self.shape_rbutton.SetValue(state.shape_rbutton) 
     1160        #self.shape_indep_rbutton.SetValue(state.shape_indep_rbutton) 
     1161        #self.struct_rbutton.SetValue(state.struct_rbutton) 
     1162        #self.plugin_rbutton.SetValue(state.plugin_rbutton) 
     1163 
     1164        ## fill model combobox 
    11531165        self._show_combox_helper() 
    1154         # select the current model 
     1166        #select the current model 
    11551167        try: 
    11561168            # to support older version 
    11571169            category_pos = int(state.categorycombobox) 
    11581170        except: 
    1159             state.formfactorcombobox = state.formfactorcombobox.lower() 
    1160             state.formfactorcombobox = \ 
    1161                 state.formfactorcombobox.replace('model', '') 
    1162             state.formfactorcombobox = unicode(state.formfactorcombobox) 
     1171            state.formfactorcombobox = unicode(state.formfactorcombobox.lower()) 
    11631172            state.categorycombobox = unicode(state.categorycombobox) 
     1173            category_pos = 0 
    11641174            if state.categorycombobox in self.categorybox.Items: 
    11651175                category_pos = self.categorybox.Items.index( 
     
    11841194        self.formfactorbox.Select(formfactor_pos) 
    11851195 
    1186         structfactor_pos = 0 
    11871196        try: 
    11881197            # to support older version 
     
    11901199        except: 
    11911200            if state.structurecombobox is not None: 
     1201                structfactor_pos = 0 
    11921202                state.structurecombobox = unicode(state.structurecombobox) 
    11931203                for ind_struct in range(self.structurebox.GetCount()): 
    11941204                    if self.structurebox.GetString(ind_struct) == \ 
    1195                                                     (state.structurecombobox): 
     1205                                                        (state.structurecombobox): 
    11961206                        structfactor_pos = int(ind_struct) 
    11971207                        break 
     
    11991209        self.structurebox.SetSelection(structfactor_pos) 
    12001210 
    1201         if state.multi_factor is not None: 
     1211        if state.multi_factor != None: 
    12021212            self.multifactorbox.SetSelection(state.multi_factor) 
    12031213 
    1204         # draw the panel according to the new model parameter 
     1214        #draw the panel according to the new model parameter 
    12051215        self._on_select_model(event=None) 
    12061216 
    12071217        # take care of 2D button 
    1208         if data is None and self.model_view.IsEnabled(): 
     1218        if data == None and self.model_view.IsEnabled(): 
    12091219            if self.enable2D: 
    12101220                self.model_view.SetLabel("2D Mode") 
     
    12121222                self.model_view.SetLabel("1D Mode") 
    12131223 
    1214         # reset state of checkbox,textcrtl  and  regular parameters value 
     1224        ## set the select all check box to the a given state 
     1225        self.cb1.SetValue(state.cb1) 
     1226 
     1227        ## reset state of checkbox,textcrtl  and  regular parameters value 
    12151228        self._reset_parameters_state(self.orientation_params_disp, 
    12161229                                     state.orientation_params_disp) 
     
    12201233                                     state.str_parameters) 
    12211234        self._reset_parameters_state(self.parameters, state.parameters) 
    1222         # display dispersion info layer 
     1235        ## display dispersion info layer 
    12231236        self.enable_disp.SetValue(state.enable_disp) 
    12241237        self.disable_disp.SetValue(state.disable_disp) 
     
    12281241            self._set_dipers_Param(event=None) 
    12291242            self._reset_page_disp_helper(state) 
    1230         # plotting range restore 
     1243        ##plotting range restore 
    12311244        self._reset_plotting_range(state) 
    1232         # smearing info  restore 
     1245        ## smearing info  restore 
    12331246        if hasattr(self, "enable_smearer"): 
    1234             # set smearing value whether or not the data 
    1235             # contain the smearing info 
     1247            ## set smearing value whether or not the data 
     1248            #contain the smearing info 
    12361249            self.enable_smearer.SetValue(state.enable_smearer) 
    12371250            self.disable_smearer.SetValue(state.disable_smearer) 
     
    12511264            self.dI_idata.SetValue(False) 
    12521265 
    1253         # we have two more options for smearing 
     1266        ## we have two more options for smearing 
    12541267        if self.pinhole_smearer.GetValue(): 
    12551268            self.dx_min = state.dx_min 
    12561269            self.dx_max = state.dx_max 
    1257             if self.dx_min is not None: 
     1270            if self.dx_min != None: 
    12581271                self.smear_pinhole_min.SetValue(str(self.dx_min)) 
    1259             if self.dx_max is not None: 
     1272            if self.dx_max != None: 
    12601273                self.smear_pinhole_max.SetValue(str(self.dx_max)) 
    12611274            self.onPinholeSmear(event=None) 
     
    12631276            self.dxl = state.dxl 
    12641277            self.dxw = state.dxw 
    1265             if self.dxl is not None: 
     1278            if self.dxl != None: 
    12661279                self.smear_slit_height.SetValue(str(self.dxl)) 
    1267             if self.dxw is not None: 
     1280            if self.dxw != None: 
    12681281                self.smear_slit_width.SetValue(str(self.dxw)) 
    12691282            else: 
     
    12711284            self.onSlitSmear(event=None) 
    12721285 
    1273         # reset state of checkbox,textcrtl  and dispersity parameters value 
     1286        ## reset state of checkbox,textcrtl  and dispersity parameters value 
    12741287        self._reset_parameters_state(self.fittable_param, state.fittable_param) 
    12751288        self._reset_parameters_state(self.fixed_param, state.fixed_param) 
    12761289 
    1277         # draw the model with previous parameters value 
     1290        ## draw the model with previous parameters value 
    12781291        self._onparamEnter_helper() 
    1279         # reset the value of chisqr when not consistent with the value computed 
     1292        #reset the value of chisqr when not consistent with the value computed 
    12801293        self.tcChi.SetValue(str(self.state.tcChi)) 
    1281         # reset context menu items 
     1294        ## reset context menu items 
    12821295        self._reset_context_menu() 
    12831296 
    1284         # set the value of the current state to the state given as parameter 
     1297        ## set the value of the current state to the state given as parameter 
    12851298        self.state = state.clone() 
    12861299        self.state.m_name = self.m_name 
     
    12931306        for item in keys: 
    12941307            if item in self.disp_list and \ 
    1295                             item not in self.model.details: 
     1308                not item in self.model.details: 
    12961309                self.model.details[item] = ["", None, None] 
    1297         # for k,v in self.state.disp_cb_dict.iteritems(): 
     1310        #for k,v in self.state.disp_cb_dict.iteritems(): 
    12981311        self.disp_cb_dict = copy.deepcopy(state.disp_cb_dict) 
    12991312        self.state.disp_cb_dict = copy.deepcopy(state.disp_cb_dict) 
     
    13021315 
    13031316        for key, disp_type in state._disp_obj_dict.iteritems(): 
    1304             # disp_model = disp 
     1317            #disp_model = disp 
    13051318            disp_model = POLYDISPERSITY_MODELS[disp_type]() 
    13061319            self._disp_obj_dict[key] = disp_model 
     
    13111324                self.model.set_dispersion(param_name, disp_model) 
    13121325                self.model._persistency_dict[key] = \ 
    1313                     [state.values, state.weights] 
     1326                                 [state.values, state.weights] 
    13141327            except Exception: 
    13151328                logging.error(traceback.format_exc()) 
    13161329            selection = self._find_polyfunc_selection(disp_model) 
    13171330            for list in self.fittable_param: 
    1318                 if list[1] == key and list[7] is not None: 
     1331                if list[1] == key and list[7] != None: 
    13191332                    list[7].SetSelection(selection) 
    13201333                    # For the array disp_model, set the values and weights 
     
    13411354                            logging.error(traceback.format_exc()) 
    13421355 
     1356        # Make sure the check box updated when all checked 
     1357        if self.cb1.GetValue(): 
     1358            self.select_all_param(None) 
     1359 
    13431360    def _selectDlg(self): 
    13441361        """ 
    13451362        open a dialog file to selected the customized dispersity 
    13461363        """ 
    1347         if self.parent is not None: 
     1364        if self.parent != None: 
    13481365            self._default_save_location = \ 
    13491366                        self._manager.parent.get_save_location() 
     
    13641381        for name, _ in self.state.saved_states.iteritems(): 
    13651382            self.number_saved_state += 1 
    1366             # Add item in the context menu 
     1383            ## Add item in the context menu 
    13671384            wx_id = ids.next() 
    13681385            msg = 'Save model and state %g' % self.number_saved_state 
     
    13811398        save radiobutton containing the type model that can be selected 
    13821399        """ 
    1383         # self.state.shape_rbutton = self.shape_rbutton.GetValue() 
    1384         # self.state.shape_indep_rbutton = self.shape_indep_rbutton.GetValue() 
    1385         # self.state.struct_rbutton = self.struct_rbutton.GetValue() 
    1386         # self.state.plugin_rbutton = self.plugin_rbutton.GetValue() 
     1400        #self.state.shape_rbutton = self.shape_rbutton.GetValue() 
     1401        #self.state.shape_indep_rbutton = self.shape_indep_rbutton.GetValue() 
     1402        #self.state.struct_rbutton = self.struct_rbutton.GetValue() 
     1403        #self.state.plugin_rbutton = self.plugin_rbutton.GetValue() 
    13871404        self.state.structurecombobox = self.structurebox.GetLabel() 
    13881405        self.state.formfactorcombobox = self.formfactorbox.GetLabel() 
    13891406        self.state.categorycombobox = self.categorybox.GetLabel() 
    13901407 
    1391         # post state to fit panel 
     1408        ## post state to fit panel 
    13921409        event = PageInfoEvent(page=self) 
    13931410        wx.PostEvent(self.parent, event) 
     
    14011418        self.state.npts = self.npts_x 
    14021419 
    1403     def _onparamEnter_helper(self, is_modified=False): 
     1420    def _onparamEnter_helper(self,is_modified = False): 
    14041421        """ 
    14051422        check if values entered by the user are changed and valid to replot 
     
    14071424        """ 
    14081425        # Flag to register when a parameter has changed. 
    1409         # is_modified = False 
     1426        #is_modified = False 
    14101427        self.fitrange = True 
    14111428        is_2Ddata = False 
    1412         # self._undo.Enable(True) 
     1429        #self._undo.Enable(True) 
    14131430        # check if 2d data 
    14141431        if self.data.__class__.__name__ == "Data2D": 
    14151432            is_2Ddata = True 
    1416         if self.model is not None: 
    1417             # Either we get a is_modified = True passed in because 
    1418             # _update_paramv_on_fit() has been called already or 
     1433        if self.model != None: 
     1434            #Either we get a is_modified = True passed in because 
     1435            #_update_paramv_on_fit() has been called already or 
    14191436            # we need to check here ourselves. 
    14201437            if not is_modified: 
     
    14431460                self.fitrange = False 
    14441461 
    1445             # if any value is modify draw model with new value 
     1462            if not self.data.is_data: 
     1463                is_modified = True 
     1464 
     1465            ## if any value is modify draw model with new value 
    14461466            if not self.fitrange: 
    1447                 # self.btFit.Disable() 
     1467                #self.btFit.Disable() 
    14481468                if is_2Ddata: 
    14491469                    self.btEditMask.Disable() 
     
    14581478                self._draw_model() 
    14591479                self.Refresh() 
    1460  
    1461         # logging.info("is_modified flag set to %g",is_modified) 
    14621480        return is_modified 
    14631481 
     
    14661484        make sure that update param values just before the fitting 
    14671485        """ 
    1468         # flag for qmin qmax check values 
     1486        #flag for qmin qmax check values 
    14691487        flag = True 
    14701488        self.fitrange = True 
    14711489        is_modified = False 
    14721490 
    1473         # wx.PostEvent(self._manager.parent, StatusEvent(status=" \ 
    1474         # updating ... ",type="update")) 
    1475  
    1476         # So make sure that update param values on_Fit. 
    1477         # self._undo.Enable(True) 
    1478         if self.model is not None: 
     1491        #wx.PostEvent(self._manager.parent, StatusEvent(status=" \ 
     1492        #updating ... ",type="update")) 
     1493 
     1494        ##So make sure that update param values on_Fit. 
     1495        #self._undo.Enable(True) 
     1496        if self.model != None: 
    14791497            if self.Npts_total.GetValue() != self.Npts_fit.GetValue(): 
    14801498                if not self.data.is_data: 
    1481                     self._manager.page_finder[self.uid].set_fit_data( 
    1482                         data=[self.data]) 
    1483             # Check the values 
     1499                    self._manager.page_finder[self.uid].set_fit_data(data=\ 
     1500                                                                [self.data]) 
     1501            ##Check the values 
    14841502            is_modified = (self._check_value_enter(self.fittable_param) 
    1485                            or self._check_value_enter(self.fixed_param) 
    1486                            or self._check_value_enter(self.parameters)) 
     1503                            or self._check_value_enter(self.fixed_param) 
     1504                            or self._check_value_enter(self.parameters)) 
    14871505 
    14881506            # If qmin and qmax have been modified, update qmin and qmax and 
     
    15251543                                              enable_smearer=enable_smearer, 
    15261544                                              draw=False) 
    1527                     if self.data is not None: 
    1528                         index_data = ((self.qmin_x <= self.data.x) & 
     1545                    if self.data != None: 
     1546                        index_data = ((self.qmin_x <= self.data.x) & \ 
    15291547                                      (self.data.x <= self.qmax_x)) 
    1530                         val = str(len(self.data.x[index_data is True])) 
     1548                        val = str(len(self.data.x[index_data == True])) 
    15311549                        self.Npts_fit.SetValue(val) 
    15321550                    else: 
     
    15481566            flag = False 
    15491567 
    1550         # For invalid q range, disable the mask editor and fit button, vs. 
     1568        #For invalid q range, disable the mask editor and fit button, vs. 
    15511569        if not self.fitrange: 
    15521570            if self._is_2D(): 
    15531571                self.btEditMask.Disable() 
    15541572        else: 
    1555             if self._is_2D() and self.data.is_data and not self.batch_on: 
     1573            if self._is_2D() and  self.data.is_data and not self.batch_on: 
    15561574                self.btEditMask.Enable(True) 
    15571575 
     
    15661584            logging.error(traceback.format_exc()) 
    15671585 
    1568         return flag, is_modified 
     1586        return flag,is_modified 
    15691587 
    15701588    def _reset_parameters_state(self, listtorestore, statelist): 
     
    15801598            item_page = listtorestore[j] 
    15811599            item_page_info = statelist[j] 
    1582             # change the state of the check box for simple parameters 
    1583             if item_page[0] is not None: 
     1600            ##change the state of the check box for simple parameters 
     1601            if item_page[0] != None: 
    15841602                item_page[0].SetValue(item_page_info[0]) 
    1585             if item_page[2] is not None: 
     1603            if item_page[2] != None: 
    15861604                item_page[2].SetValue(item_page_info[2]) 
    15871605                if item_page[2].__class__.__name__ == "ComboBox": 
     
    15891607                        fun_val = self.model.fun_list[item_page_info[2]] 
    15901608                        self.model.setParam(item_page_info[1], fun_val) 
    1591             if item_page[3] is not None: 
    1592                 # show or hide text +/- 
     1609            if item_page[3] != None: 
     1610                ## show or hide text +/- 
    15931611                if item_page_info[2]: 
    15941612                    item_page[3].Show(True) 
    15951613                else: 
    15961614                    item_page[3].Hide() 
    1597             if item_page[4] is not None: 
    1598                 # show of hide the text crtl for fitting error 
     1615            if item_page[4] != None: 
     1616                ## show of hide the text crtl for fitting error 
    15991617                if item_page_info[4][0]: 
    16001618                    item_page[4].Show(True) 
     
    16021620                else: 
    16031621                    item_page[3].Hide() 
    1604             if item_page[5] is not None: 
    1605                 # show of hide the text crtl for fitting error 
     1622            if item_page[5] != None: 
     1623                ## show of hide the text crtl for fitting error 
    16061624                item_page[5].Show(item_page_info[5][0]) 
    16071625                item_page[5].SetValue(item_page_info[5][1]) 
    16081626 
    1609             if item_page[6] is not None: 
    1610                 # show of hide the text crtl for fitting error 
     1627            if item_page[6] != None: 
     1628                ## show of hide the text crtl for fitting error 
    16111629                item_page[6].Show(item_page_info[6][0]) 
    16121630                item_page[6].SetValue(item_page_info[6][1]) 
     
    16241642            item_page = listtorestore[j] 
    16251643            item_page_info = statelist[j] 
    1626             # change the state of the check box for simple parameters 
    1627  
    1628             if item_page[0] is not None: 
     1644            ##change the state of the check box for simple parameters 
     1645 
     1646            if item_page[0] != None: 
    16291647                item_page[0].SetValue(format_number(item_page_info[0], True)) 
    16301648 
    1631             if item_page[2] is not None: 
     1649            if item_page[2] != None: 
    16321650                param_name = item_page_info[1] 
    16331651                value = item_page_info[2] 
     
    16521670 
    16531671            checkbox_state = None 
    1654             if item[0] is not None: 
     1672            if item[0] != None: 
    16551673                checkbox_state = item[0].GetValue() 
    16561674            parameter_name = item[1] 
    16571675            parameter_value = None 
    1658             if item[2] is not None: 
     1676            if item[2] != None: 
    16591677                parameter_value = item[2].GetValue() 
    16601678            static_text = None 
    1661             if item[3] is not None: 
     1679            if item[3] != None: 
    16621680                static_text = item[3].IsShown() 
    16631681            error_value = None 
    16641682            error_state = None 
    1665             if item[4] is not None: 
     1683            if item[4] != None: 
    16661684                error_value = item[4].GetValue() 
    16671685                error_state = item[4].IsShown() 
     
    16691687            min_value = None 
    16701688            min_state = None 
    1671             if item[5] is not None: 
     1689            if item[5] != None: 
    16721690                min_value = item[5].GetValue() 
    16731691                min_state = item[5].IsShown() 
     
    16751693            max_value = None 
    16761694            max_state = None 
    1677             if item[6] is not None: 
     1695            if item[6] != None: 
    16781696                max_value = item[6].GetValue() 
    16791697                max_state = item[6].IsShown() 
    16801698            unit = None 
    1681             if item[7] is not None: 
     1699            if item[7] != None: 
    16821700                unit = item[7].GetLabel() 
    16831701 
     
    16871705                              [max_state, max_value], unit]) 
    16881706 
     1707 
    16891708    def _draw_model(self, update_chisqr=True, source='model'): 
    16901709        """ 
     
    17051724        :param chisqr: update chisqr value [bool] 
    17061725        """ 
    1707         # if self.check_invalid_panel(): 
     1726        #if self.check_invalid_panel(): 
    17081727        #    return 
    1709         if self.model is not None: 
     1728        if self.model != None: 
    17101729            temp_smear = None 
    17111730            if hasattr(self, "enable_smearer"): 
     
    17191738            is_2d = self._is_2D() 
    17201739            self._manager.draw_model(self.model, 
    1721                                      data=self.data, 
    1722                                      smearer=temp_smear, 
    1723                                      qmin=float(self.qmin_x), 
    1724                                      qmax=float(self.qmax_x), 
    1725                                      page_id=self.uid, 
    1726                                      toggle_mode_on=toggle_mode_on, 
    1727                                      state=self.state, 
    1728                                      enable2D=is_2d, 
    1729                                      update_chisqr=update_chisqr, 
    1730                                      source='model', 
    1731                                      weight=weight) 
     1740                                    data=self.data, 
     1741                                    smearer=temp_smear, 
     1742                                    qmin=float(self.qmin_x), 
     1743                                    qmax=float(self.qmax_x), 
     1744                                    page_id=self.uid, 
     1745                                    toggle_mode_on=toggle_mode_on, 
     1746                                    state=self.state, 
     1747                                    enable2D=is_2d, 
     1748                                    update_chisqr=update_chisqr, 
     1749                                    source='model', 
     1750                                    weight=weight) 
    17321751 
    17331752    def _on_show_sld(self, event=None): 
     
    17391758 
    17401759        from sas.sasgui.plottools import Data1D as pf_data1d 
    1741         # from sas.sasgui.perspectives.theory.profile_dialog import SLDPanel 
     1760        #from sas.sasgui.perspectives.theory.profile_dialog import SLDPanel 
    17421761        from sas.sasgui.guiframe.local_perspectives.plotting.profile_dialog \ 
    1743             import SLDPanel 
     1762        import SLDPanel 
    17441763        sld_data = pf_data1d(x, y) 
    17451764        sld_data.name = 'SLD' 
     
    17941813        self.structurebox.Disable() 
    17951814        self.formfactorbox.Clear() 
    1796         if mod_cat is None: 
     1815        if mod_cat == None: 
    17971816            return 
    17981817        m_list = [] 
     
    18561875        """ 
    18571876        tcrtl = event.GetEventObject() 
    1858         # Clear msg if previously shown. 
     1877        #Clear msg if previously shown. 
    18591878        msg = "" 
    18601879        wx.PostEvent(self.parent, StatusEvent(status=msg)) 
     
    18751894                    tcrtl.SetBackgroundColour("pink") 
    18761895                    msg = "Model Error: wrong value entered: %s" % \ 
    1877                           sys.exc_info()[1] 
     1896                                    sys.exc_info()[1] 
    18781897                    wx.PostEvent(self.parent, StatusEvent(status=msg)) 
    18791898                    return 
     
    18831902                wx.PostEvent(self.parent, StatusEvent(status=msg)) 
    18841903                return 
    1885             # Check if # of points for theory model are valid(>0). 
    1886             if self.npts is not None: 
     1904            #Check if # of points for theory model are valid(>0). 
     1905            if self.npts != None: 
    18871906                if check_float(self.npts): 
    18881907                    temp_npts = float(self.npts.GetValue()) 
     
    19001919        wx.PostEvent(self.parent, event) 
    19011920        self.state_change = False 
    1902         # Draw the model for a different range 
     1921        #Draw the model for a different range 
    19031922        if not self.data.is_data: 
    19041923            self.create_default_data() 
     
    19111930 
    19121931        tcrtl = event.GetEventObject() 
    1913         # Clear msg if previously shown. 
     1932        #Clear msg if previously shown. 
    19141933        msg = "" 
    19151934        wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 
     
    19321951                    tcrtl.SetBackgroundColour("pink") 
    19331952                    msg = "Model Error: wrong value entered: %s" % \ 
    1934                           sys.exc_info()[1] 
     1953                                        sys.exc_info()[1] 
    19351954                    wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 
    19361955                    return 
     
    19401959                wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 
    19411960                return 
    1942             # Check if # of points for theory model are valid(>0). 
     1961            #Check if # of points for theory model are valid(>0). 
    19431962            if self.Npts_total.IsEditable(): 
    19441963                if check_float(self.Npts_total): 
     
    19581977        wx.PostEvent(self.parent, event) 
    19591978        self.state_change = False 
    1960         # Draw the model for a different range 
     1979        #Draw the model for a different range 
    19611980        self.create_default_data() 
    19621981        self._draw_model() 
     
    19661985        call back for model selection 
    19671986        """ 
    1968         # reset dictionary containing reference to dispersion 
     1987        ## reset dictionary containing reference to dispersion 
    19691988        self._disp_obj_dict = {} 
    19701989        self.disp_cb_dict = {} 
    19711990        self.temp_multi_functional = False 
    19721991        f_id = self.formfactorbox.GetCurrentSelection() 
    1973         # For MAC 
     1992        #For MAC 
    19741993        form_factor = None 
    19751994        if f_id >= 0: 
     
    19781997        if form_factor is None or \ 
    19791998            not hasattr(form_factor, 'is_form_factor') or \ 
    1980                 not form_factor.is_form_factor: 
     1999            not form_factor.is_form_factor: 
    19812000            self.structurebox.Hide() 
    19822001            self.text2.Hide() 
     
    19902009            self.text2.Enable() 
    19912010 
    1992         if form_factor is not None: 
     2011        if form_factor != None: 
    19932012            # set multifactor for Mutifunctional models 
    19942013            if form_factor.is_multiplicity_model: 
     
    19982017                self._set_multfactor_combobox(multiplicity) 
    19992018                self._show_multfactor_combobox() 
    2000                 # ToDo: this info should be called directly from the model 
     2019                #ToDo: this info should be called directly from the model 
    20012020                text = form_factor.multiplicity_info[1]  # 'No. of Shells: ' 
    20022021 
     
    20072026 
    20082027                self.multi_factor = self.multifactorbox.GetClientData(m_id) 
    2009                 if self.multi_factor is None: 
     2028                if self.multi_factor == None: 
    20102029                    self.multi_factor = 0 
    20112030                self.multifactorbox.SetSelection(m_id) 
     
    20132032                text = '' 
    20142033                if form_factor.multiplicity_info[0] == \ 
    2015                         len(form_factor.multiplicity_info[2]): 
     2034                                        len(form_factor.multiplicity_info[2]): 
    20162035                    text = form_factor.multiplicity_info[2][self.multi_factor] 
    20172036                self.mutifactor_text1.SetLabel(text) 
     
    20342053        struct_factor = self.structurebox.GetClientData(s_id) 
    20352054 
    2036         if struct_factor is not None: 
    2037             from sasmodels.sasview_model import MultiplicationModel 
     2055        if  struct_factor != None: 
     2056            from sas.sascalc.fit.MultiplicationModel import MultiplicationModel 
    20382057            self.model = MultiplicationModel(form_factor(self.multi_factor), 
    20392058                                             struct_factor()) 
     
    20412060            if len(form_factor.non_fittable) > 0: 
    20422061                self.temp_multi_functional = True 
    2043         elif form_factor is not None: 
     2062        elif form_factor != None: 
    20442063            if self.multi_factor is not None: 
    20452064                self.model = form_factor(self.multi_factor) 
     
    20562075        else: 
    20572076            self._has_magnetic = False 
    2058         # post state to fit panel 
     2077        ## post state to fit panel 
    20592078        self.state.parameters = [] 
    20602079        self.state.model = self.model 
     
    20662085        self.Layout() 
    20672086 
     2087 
    20682088    def _validate_qrange(self, qmin_ctrl, qmax_ctrl): 
    20692089        """ 
     
    20852105            qmax = float(qmax_ctrl.GetValue()) 
    20862106            if qmin < qmax: 
    2087                 # Make sure to set both colours white. 
     2107                #Make sure to set both colours white. 
    20882108                qmin_ctrl.SetBackgroundColour(wx.WHITE) 
    20892109                qmin_ctrl.Refresh() 
     
    21052125        If valid, setvalues Npts_fit otherwise post msg. 
    21062126        """ 
    2107         # default flag 
     2127        #default flag 
    21082128        flag = True 
    21092129        # Theory 
    2110         if self.data is None and self.enable2D: 
     2130        if self.data == None and self.enable2D: 
    21112131            return flag 
    21122132        for data in self.data_list: 
     
    21142134            radius = numpy.sqrt(data.qx_data * data.qx_data + 
    21152135                                data.qy_data * data.qy_data) 
    2116             # get unmasked index 
     2136            #get unmasked index 
    21172137            index_data = (float(self.qmin.GetValue()) <= radius) & \ 
    2118                          (radius <= float(self.qmax.GetValue())) 
     2138                            (radius <= float(self.qmax.GetValue())) 
    21192139            index_data = (index_data) & (data.mask) 
    21202140            index_data = (index_data) & (numpy.isfinite(data.data)) 
     
    21322152                flag = False 
    21332153            else: 
    2134                 self.Npts_fit.SetValue(str(len(index_data[index_data is True]))) 
     2154                self.Npts_fit.SetValue(str(len(index_data[index_data == True]))) 
    21352155                self.fitrange = True 
    21362156 
     
    21422162        If valid, setvalues Npts_fit otherwise post msg. 
    21432163        """ 
    2144         # default flag 
     2164        #default flag 
    21452165        flag = True 
    21462166        # Theory 
    2147         if self.data is None: 
     2167        if self.data == None: 
    21482168            return flag 
    21492169        for data in self.data_list: 
    21502170            # q value from qx and qy 
    21512171            radius = data.x 
    2152             # get unmasked index 
     2172            #get unmasked index 
    21532173            index_data = (float(self.qmin.GetValue()) <= radius) & \ 
    2154                          (radius <= float(self.qmax.GetValue())) 
     2174                            (radius <= float(self.qmax.GetValue())) 
    21552175            index_data = (index_data) & (numpy.isfinite(data.y)) 
    21562176 
     
    21672187                flag = False 
    21682188            else: 
    2169                 self.Npts_fit.SetValue(str(len(index_data[index_data is True]))) 
     2189                self.Npts_fit.SetValue(str(len(index_data[index_data == True]))) 
    21702190                self.fitrange = True 
    21712191 
     
    21872207        is_modified = False 
    21882208        for item in list: 
    2189             # skip angle parameters for 1D 
     2209            #skip angle parameters for 1D 
    21902210            if not self.enable2D and item in self.orientation_params: 
    21912211                continue 
     
    22322252                    max_ctrl.SetBackgroundColour("pink") 
    22332253                    max_ctrl.Refresh() 
    2234                     # msg = "Invalid fit range for %s: min must be smaller 
    2235                     # than max"%name 
    2236                     # wx.PostEvent(self._manager.parent, 
    2237                     # StatusEvent(status=msg)) 
     2254                    #msg = "Invalid fit range for %s: min must be smaller than max"%name 
     2255                    #wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 
    22382256                    continue 
    22392257 
     
    22532271                    # The configuration has changed but it won't change the 
    22542272                    # computed curve so no need to set is_modified to True 
    2255                     # is_modified = True 
     2273                    #is_modified = True 
    22562274                    self.model.details[name][1:3] = low, high 
    22572275 
     
    22712289        Redraw the model with the default dispersity (Gaussian) 
    22722290        """ 
    2273         # On selction if no model exists. 
    2274         if self.model is None: 
     2291        ## On selction if no model exists. 
     2292        if self.model == None: 
    22752293            self.disable_disp.SetValue(True) 
    22762294            msg = "Please select a Model first..." 
     
    22822300        self._reset_dispersity() 
    22832301 
    2284         if self.model is None: 
     2302        if self.model == None: 
    22852303            self.model_disp.Hide() 
    22862304            self.sizer4_4.Clear(True) 
     
    22882306 
    22892307        if self.enable_disp.GetValue(): 
    2290             # layout for model containing no dispersity parameters 
     2308            ## layout for model containing no dispersity parameters 
    22912309 
    22922310            self.disp_list = self.model.getDispParamList() 
     
    22952313                self._layout_sizer_noDipers() 
    22962314            else: 
    2297                 # set gaussian sizer 
     2315                ## set gaussian sizer 
    22982316                self._on_select_Disp(event=None) 
    22992317        else: 
    23002318            self.sizer4_4.Clear(True) 
    23012319 
    2302         # post state to fit panel 
     2320        ## post state to fit panel 
    23032321        self.save_current_state() 
    2304         if event is not None: 
     2322        if event != None: 
    23052323            event = PageInfoEvent(page=self) 
    23062324            wx.PostEvent(self.parent, event) 
    2307         # draw the model with the current dispersity 
    2308  
    2309         # Wojtek P, Oct 8, 2016: Calling draw_model seems to be unessecary. 
    2310         # By comenting it we save an extra Iq calculation 
    2311         # self._draw_model() 
    2312  
    2313         # Need to use FitInside again here to replace the next four lines. 
    2314         # Otherwised polydispersity off does not resize the scrollwindow. 
    2315         # PDB Nov 28, 2015 
     2325        #draw the model with the current dispersity 
     2326 
     2327        #Wojtek P, Oct 8, 2016: Calling draw_model seems to be unessecary. 
     2328        #By comenting it we save an extra Iq calculation 
     2329        #self._draw_model() 
     2330 
     2331        ## Need to use FitInside again here to replace the next four lines. 
     2332        ## Otherwised polydispersity off does not resize the scrollwindow. 
     2333        ## PDB Nov 28, 2015 
    23162334        self.FitInside() 
    23172335#        self.sizer4_4.Layout() 
     
    23572375        self.weights = {} 
    23582376 
    2359         # from sas.models.dispersion_models import GaussianDispersion 
     2377        #from sas.models.dispersion_models import GaussianDispersion 
    23602378        from sasmodels.weights import GaussianDispersion 
    23612379        if len(self.disp_cb_dict) == 0: 
     
    23782396                    logging.error(traceback.format_exc()) 
    23792397 
    2380         # save state into 
     2398        ## save state into 
    23812399        self.save_current_state() 
    23822400        self.Layout() 
     
    23902408        self._set_sizer_dispersion() 
    23912409 
    2392         # Redraw the model 
     2410        ## Redraw the model 
    23932411        self._draw_model() 
    2394         # self._undo.Enable(True) 
     2412        #self._undo.Enable(True) 
    23952413        event = PageInfoEvent(page=self) 
    23962414        wx.PostEvent(self.parent, event) 
     
    24072425        """ 
    24082426        # get ready for new event 
    2409         if event is not None: 
     2427        if event != None: 
    24102428            event.Skip() 
    24112429        # Get event object 
     
    24202438            dispersity = disp_box.GetClientData(selection) 
    24212439 
    2422             # disp_model =  GaussianDispersion() 
     2440            #disp_model =  GaussianDispersion() 
    24232441            disp_model = dispersity() 
    24242442            # Get param names to reset the values of the param 
     
    24332451            else: 
    24342452                self._del_array_values(name1) 
    2435                 # self._reset_array_disp(param_name) 
     2453                #self._reset_array_disp(param_name) 
    24362454                self._disp_obj_dict[name1] = disp_model 
    24372455                self.model.set_dispersion(param_name, disp_model) 
     
    24812499                        item[2].Enable() 
    24822500 
    2483             # Make sure the check box updated 
    2484             self.get_all_checked_params() 
     2501            # Make sure the check box updated when all checked 
     2502            if self.cb1.GetValue(): 
     2503                #self.select_all_param(None) 
     2504                self.get_all_checked_params() 
    24852505 
    24862506            # update params 
     
    25172537        if path is None: 
    25182538            self.disp_cb_dict[name].SetValue(False) 
    2519             # self.noDisper_rbox.SetValue(True) 
     2539            #self.noDisper_rbox.SetValue(True) 
    25202540            return 
    25212541        self._default_save_location = os.path.dirname(path) 
    2522         if self._manager is not None: 
     2542        if self._manager != None: 
    25232543            self._manager.parent._default_save_location = \ 
    25242544                             self._default_save_location 
     
    25372557        wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 
    25382558        self._set_array_disp_model(name=name, disp=disp, 
    2539                                    values=values, weights=weights) 
     2559                                    values=values, weights=weights) 
    25402560        return basename 
    25412561 
     
    25562576        # Store the object to make it persist outside the 
    25572577        # scope of this method 
    2558         # TODO: refactor model to clean this up? 
     2578        #TODO: refactor model to clean this up? 
    25592579        self.state.values = {} 
    25602580        self.state.weights = {} 
     
    25632583 
    25642584        # Set the new model as the dispersion object for the 
    2565         # selected parameter 
    2566         # self.model.set_dispersion(p, disp_model) 
     2585        #selected parameter 
     2586        #self.model.set_dispersion(p, disp_model) 
    25672587        # Store a reference to the weights in the model object 
    2568         # so that 
     2588        #so that 
    25692589        # it's not lost when we use the model within another thread. 
    25702590        self.state.model = self.model.clone() 
    25712591        self.model._persistency_dict[name.split('.')[0]] = \ 
    2572             [values, weights] 
     2592                                        [values, weights] 
    25732593        self.state.model._persistency_dict[name.split('.')[0]] = \ 
    2574             [values, weights] 
     2594                                        [values, weights] 
    25752595 
    25762596    def _del_array_values(self, name=None): 
     
    26102630            Layout after self._draw_model 
    26112631        """ 
    2612         if ON_MAC is True: 
     2632        if ON_MAC == True: 
    26132633            time.sleep(1) 
    26142634 
     
    26322652        """ 
    26332653        flag = True 
    2634         # For 3 different cases: Data2D, Data1D, and theory 
    2635         if self.model is None: 
     2654        ##For 3 different cases: Data2D, Data1D, and theory 
     2655        if self.model == None: 
    26362656            msg = "Please select a model first..." 
    26372657            wx.MessageBox(msg, 'Info') 
     
    26452665            self.qmin_x = data_min 
    26462666            self.qmax_x = math.sqrt(x * x + y * y) 
    2647             # self.data.mask = numpy.ones(len(self.data.data),dtype=bool) 
     2667            #self.data.mask = numpy.ones(len(self.data.data),dtype=bool) 
    26482668            # check smearing 
    26492669            if not self.disable_smearer.GetValue(): 
    2650                 # set smearing value whether or 
     2670                ## set smearing value whether or 
    26512671                # not the data contain the smearing info 
    26522672                if self.pinhole_smearer.GetValue(): 
     
    26552675                    flag = True 
    26562676 
    2657         elif self.data is None: 
     2677        elif self.data == None: 
    26582678            self.qmin_x = _QMIN_DEFAULT 
    26592679            self.qmax_x = _QMAX_DEFAULT 
     
    26662686            # check smearing 
    26672687            if not self.disable_smearer.GetValue(): 
    2668                 # set smearing value whether or 
     2688                ## set smearing value whether or 
    26692689                # not the data contain the smearing info 
    26702690                if self.slit_smearer.GetValue(): 
     
    26772697            flag = False 
    26782698 
    2679         if flag is False: 
     2699        if flag == False: 
    26802700            msg = "Cannot Plot :Must enter a number!!!  " 
    26812701            wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 
     
    26942714        self.state.qmax = self.qmax_x 
    26952715 
    2696         # reset the q range values 
     2716        #reset the q range values 
    26972717        self._reset_plotting_range(self.state) 
    26982718        self._draw_model() 
     
    27352755                logging.error(traceback.format_exc()) 
    27362756        # Make sure the resduals plot goes to the last 
    2737         if res_item is not None: 
     2757        if res_item != None: 
    27382758            graphs.append(res_item[0]) 
    27392759            canvases.append(res_item[1]) 
     
    27542774        the # to the browser. 
    27552775 
    2756         :param event: on Help Button pressed event 
    2757         """ 
    2758  
    2759         if self.model is not None: 
     2776        :param evt: on Help Button pressed event 
     2777        """ 
     2778 
     2779        if self.model != None: 
    27602780            name = self.formfactorbox.GetValue() 
    2761             _TreeLocation = 'user/models/' + name.lower()+'.html' 
     2781            _TreeLocation = 'user/models/'+ name.lower()+'.html' 
    27622782            _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, 
    27632783                                              "", name + " Help") 
     
    27662786            _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, 
    27672787                                              "", "General Model Help") 
     2788 
    27682789 
    27692790    def on_model_help_clicked(self, event): 
     
    27772798        give the message that none is available. 
    27782799 
    2779         :param event: on Description Button pressed event 
    2780         """ 
    2781  
    2782         if self.model is None: 
     2800        :param evt: on Description Button pressed event 
     2801        """ 
     2802 
     2803        if self.model == None: 
    27832804            name = 'index.html' 
    27842805        else: 
     
    27872808        msg = 'Model description:\n' 
    27882809        info = "Info" 
    2789         if self.model is not None: 
    2790             # frame.Destroy() 
     2810        if self.model != None: 
     2811#                frame.Destroy() 
    27912812            if str(self.model.description).rstrip().lstrip() == '': 
    27922813                msg += "Sorry, no information is available for this model." 
     
    28572878            for key in self.model.magnetic_params: 
    28582879                if key.count('M0') > 0: 
    2859                     # reset mag value to zero fo safety 
     2880                    #reset mag value to zero fo safety 
    28602881                    self.model.setParam(key, 0.0) 
    28612882 
    28622883        self.Show(False) 
    28632884        self.set_model_param_sizer(self.model) 
    2864         # self._set_sizer_dispersion() 
     2885        #self._set_sizer_dispersion() 
    28652886        self.state.magnetic_on = self.magnetic_on 
    28662887        self.SetupScrolling() 
     
    28772898        running "file:///...." 
    28782899 
    2879         :param event: Triggers on clicking ? in polydispersity box 
     2900        :param evt: Triggers on clicking ? in polydispersity box 
    28802901        """ 
    28812902 
     
    29152936        content = 'sasview_parameter_values:' 
    29162937        # Do it if params exist 
    2917         if self.parameters: 
     2938        if  self.parameters != []: 
    29182939 
    29192940            # go through the parameters 
     
    29592980 
    29602981        # Do it if params exist 
    2961         if self.parameters: 
     2982        if  self.parameters != []: 
    29622983 
    29632984            for param in self.parameters: 
    2964                 content += param[1]  # parameter name 
     2985                content += param[1] #parameter name 
    29652986                content += tab 
    29662987                content += param[1] + "_err" 
     
    29692990            content += crlf 
    29702991 
    2971             # row of values and errors... 
     2992            #row of values and errors... 
    29722993            for param in self.parameters: 
    2973                 content += param[2].GetValue()  # value 
     2994                content += param[2].GetValue() #value 
    29742995                content += tab 
    2975                 content += param[4].GetValue()  # error 
     2996                content += param[4].GetValue() #error 
    29762997                content += tab 
    29772998 
     
    29793000        else: 
    29803001            return False 
     3002 
    29813003 
    29823004    def get_copy_latex(self): 
     
    30003022 
    30013023        # Do it if params exist 
    3002         if self.parameters: 
     3024        if  self.parameters != []: 
    30033025 
    30043026            content += '{|' 
     
    30093031 
    30103032            for index, param in enumerate(self.parameters): 
    3011                 content += param[1].replace('_', '\_')  # parameter name 
     3033                content += param[1].replace('_', '\_') #parameter name 
    30123034                content += ' & ' 
    30133035                content += param[1].replace('_', '\_') + "\_err" 
     
    30173039            content += crlf 
    30183040 
    3019             # row of values and errors... 
     3041            #row of values and errors... 
    30203042            for index, param in enumerate(self.parameters): 
    3021                 content += param[2].GetValue()  # parameter value 
     3043                content += param[2].GetValue() #parameter value 
    30223044                content += ' & ' 
    3023                 content += param[4].GetValue()  # parameter error 
     3045                content += param[4].GetValue() #parameter error 
    30243046                if index < len(self.parameters) - 1: 
    30253047                    content += ' & ' 
     
    30323054        else: 
    30333055            return False 
     3056 
    30343057 
    30353058    def set_clipboard(self, content=None): 
     
    30783101            # 1D 
    30793102            else: 
    3080                 # for 1D all parameters except orientation 
     3103                ## for 1D all parameters except orientation 
    30813104                if not item[1] in orient_param: 
    30823105                    try: 
     
    31103133            except Exception: 
    31113134                logging.error(traceback.format_exc()) 
    3112             content += name + ',' + str(check) + ',' + value + disfunc + ',' + \ 
    3113                        bound_lo + ',' + bound_hi + ':' 
     3135            content += name + ',' + str(check) + ',' +\ 
     3136                    value + disfunc + ',' + bound_lo + ',' +\ 
     3137                    bound_hi + ':' 
    31143138 
    31153139        return content 
     
    31893213 
    31903214        # Do it if params exist 
    3191         if self.parameters: 
     3215        if  self.parameters != []: 
    31923216            # go through the parameters 
    31933217            self._get_paste_helper(self.parameters, 
     
    32373261                                pd = int(pd) 
    32383262                        except Exception: 
    3239                             # continue 
     3263                            #continue 
    32403264                            if not pd and pd != '': 
    32413265                                continue 
     
    32653289                    else: 
    32663290                        is_true = None 
    3267                     if is_true is not None: 
     3291                    if is_true != None: 
    32683292                        item[0].SetValue(is_true) 
    32693293            # 1D 
    32703294            else: 
    3271                 # for 1D all parameters except orientation 
     3295                ## for 1D all parameters except orientation 
    32723296                if not item[1] in orient_param: 
    32733297                    name = item[1] 
     
    32783302                        pd = value[0] 
    32793303                        if name.count('.') > 0: 
    3280                             # If this is parameter.width, then pd may be a 
    3281                             # floating point value or it may be an array 
    3282                             # distribution. Nothing to do for parameter.npts or 
    3283                             # parameter.nsigmas. 
     3304                            # If this is parameter.width, then pd may be a floating 
     3305                            # point value or it may be an array distribution. 
     3306                            # Nothing to do for parameter.npts or parameter.nsigmas. 
    32843307                            try: 
    32853308                                pd = float(pd) 
     
    32873310                                    pd = int(pd) 
    32883311                            except: 
    3289                                 # continue 
     3312                                #continue 
    32903313                                if not pd and pd != '': 
    32913314                                    continue 
     
    33153338                        else: 
    33163339                            is_true = None 
    3317                         if is_true is not None: 
     3340                        if is_true != None: 
    33183341                            item[0].SetValue(is_true) 
    3319  
    3320         self.select_param(event=None) 
    3321         self.Refresh() 
    33223342 
    33233343    def _paste_poly_help(self, item, value): 
     
    33823402            logging.error(traceback.format_exc()) 
    33833403            print "Error in BasePage._paste_poly_help: %s" % \ 
    3384                   sys.exc_info()[1] 
     3404                                    sys.exc_info()[1] 
    33853405 
    33863406    def _set_disp_cb(self, isarray, item): 
     
    34483468        self.categorybox.Clear() 
    34493469        cat_list = sorted(self.master_category_dict.keys()) 
    3450         if uncat_str not in cat_list: 
     3470        if not uncat_str in cat_list: 
    34513471            cat_list.append(uncat_str) 
    34523472 
     
    34583478            self.categorybox.SetSelection(0) 
    34593479        else: 
    3460             self.categorybox.SetSelection( 
     3480            self.categorybox.SetSelection(\ 
    34613481                self.categorybox.GetSelection()) 
    3462         # self._on_change_cat(None) 
     3482        #self._on_change_cat(None) 
    34633483 
    34643484    def _on_change_cat(self, event): 
     
    34683488        self.model_name = None 
    34693489        category = self.categorybox.GetStringSelection() 
    3470         if category is None: 
     3490        if category == None: 
    34713491            return 
    34723492        self.model_box.Clear() 
     
    34793499        else: 
    34803500            for (model, enabled) in sorted(self.master_category_dict[category], 
    3481                                            key=lambda name: name[0]): 
     3501                                      key=lambda name: name[0]): 
    34823502                if(enabled): 
    34833503                    self.model_box.Append(model) 
     
    34883508        """ 
    34893509        # This should only be called once per fit tab 
    3490         # print "==== Entering _fill_model_sizer" 
    3491         # Add model function Details button in fitpanel. 
    3492         # The following 3 lines are for Mac. Let JHC know before modifying... 
     3510        #print "==== Entering _fill_model_sizer" 
     3511        ##Add model function Details button in fitpanel. 
     3512        ##The following 3 lines are for Mac. Let JHC know before modifying... 
    34933513        title = "Model" 
    34943514        self.formfactorbox = None 
     
    35223542        self._populate_listbox() 
    35233543        wx.EVT_COMBOBOX(self.categorybox, wx.ID_ANY, self._show_combox) 
    3524         # self.shape_rbutton = wx.RadioButton(self, wx.ID_ANY, 'Shapes', 
     3544        #self.shape_rbutton = wx.RadioButton(self, wx.ID_ANY, 'Shapes', 
    35253545        #                                     style=wx.RB_GROUP) 
    3526         # self.shape_indep_rbutton = wx.RadioButton(self, wx.ID_ANY, 
     3546        #self.shape_indep_rbutton = wx.RadioButton(self, wx.ID_ANY, 
    35273547        #                                          "Shape-Independent") 
    3528         # self.struct_rbutton = wx.RadioButton(self, wx.ID_ANY, 
     3548        #self.struct_rbutton = wx.RadioButton(self, wx.ID_ANY, 
    35293549        #                                     "Structure Factor ") 
    3530         # self.plugin_rbutton = wx.RadioButton(self, wx.ID_ANY, 
     3550        #self.plugin_rbutton = wx.RadioButton(self, wx.ID_ANY, 
    35313551        #                                     "Uncategorized") 
    35323552 
    3533         # self.Bind(wx.EVT_RADIOBUTTON, self._show_combox, 
     3553        #self.Bind(wx.EVT_RADIOBUTTON, self._show_combox, 
    35343554        #                   id=self.shape_rbutton.GetId()) 
    3535         # self.Bind(wx.EVT_RADIOBUTTON, self._show_combox, 
     3555        #self.Bind(wx.EVT_RADIOBUTTON, self._show_combox, 
    35363556        #                    id=self.shape_indep_rbutton.GetId()) 
    3537         # self.Bind(wx.EVT_RADIOBUTTON, self._show_combox, 
     3557        #self.Bind(wx.EVT_RADIOBUTTON, self._show_combox, 
    35383558        #                    id=self.struct_rbutton.GetId()) 
    3539         # self.Bind(wx.EVT_RADIOBUTTON, self._show_combox, 
     3559        #self.Bind(wx.EVT_RADIOBUTTON, self._show_combox, 
    35403560        #                    id=self.plugin_rbutton.GetId()) 
    3541         # MAC needs SetValue 
     3561        #MAC needs SetValue 
    35423562 
    35433563        show_cat_button = wx.Button(self, wx.ID_ANY, "Modify") 
    35443564        cat_tip = "Modify model categories \n" 
    35453565        cat_tip += "(also accessible from the menu bar)." 
    3546         show_cat_button.SetToolTip(wx.ToolTip(cat_tip)) 
     3566        show_cat_button.SetToolTip( wx.ToolTip(cat_tip) ) 
    35473567        show_cat_button.Bind(wx.EVT_BUTTON, self._on_modify_cat) 
    35483568        sizer_cat_box.Add(self.categorybox, 1, wx.RIGHT, 3) 
    3549         sizer_cat_box.Add((10, 10)) 
     3569        sizer_cat_box.Add((10,10)) 
    35503570        sizer_cat_box.Add(show_cat_button) 
    3551         # self.shape_rbutton.SetValue(True) 
     3571        #self.shape_rbutton.SetValue(True) 
    35523572 
    35533573        sizer_radiobutton = wx.GridSizer(2, 2, 5, 5) 
    3554         # sizer_radiobutton.Add(self.shape_rbutton) 
    3555         # sizer_radiobutton.Add(self.shape_indep_rbutton) 
    3556         sizer_radiobutton.Add((5, 5)) 
     3574        #sizer_radiobutton.Add(self.shape_rbutton) 
     3575        #sizer_radiobutton.Add(self.shape_indep_rbutton) 
     3576        sizer_radiobutton.Add((5,5)) 
    35573577        sizer_radiobutton.Add(self.model_view, 1, wx.RIGHT, 5) 
    3558         # sizer_radiobutton.Add(self.plugin_rbutton) 
    3559         # sizer_radiobutton.Add(self.struct_rbutton) 
    3560         # sizer_radiobutton.Add((5,5)) 
     3578        #sizer_radiobutton.Add(self.plugin_rbutton) 
     3579        #sizer_radiobutton.Add(self.struct_rbutton) 
     3580#        sizer_radiobutton.Add((5,5)) 
    35613581        sizer_radiobutton.Add(self.model_help, 1, wx.RIGHT | wx.LEFT, 5) 
    3562         # sizer_radiobutton.Add((5,5)) 
     3582#        sizer_radiobutton.Add((5,5)) 
    35633583        sizer_radiobutton.Add(self.model_func, 1, wx.RIGHT, 5) 
    35643584        sizer_cat.Add(sizer_cat_box, 1, wx.LEFT, 2.5) 
     
    35763596        self.formfactorbox = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY) 
    35773597        self.formfactorbox.SetToolTip(wx.ToolTip("Select a Model")) 
    3578         if self.model is not None: 
     3598        if self.model != None: 
    35793599            self.formfactorbox.SetValue(self.model.name) 
    35803600        self.structurebox = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY) 
     
    35853605        wx.EVT_COMBOBOX(self.structurebox, wx.ID_ANY, self._on_select_model) 
    35863606        wx.EVT_COMBOBOX(self.multifactorbox, wx.ID_ANY, self._on_select_model) 
    3587         # check model type to show sizer 
    3588         if self.model is not None: 
     3607        ## check model type to show sizer 
     3608        if self.model != None: 
    35893609            print "_set_model_sizer_selection: disabled." 
    3590             # self._set_model_sizer_selection(self.model) 
     3610            #self._set_model_sizer_selection(self.model) 
    35913611 
    35923612        sizer_selection.Add(self.text1) 
     
    36613681        call back for model selection if implemented 
    36623682        """ 
     3683    def select_all_param(self, event): 
     3684        """ 
     3685        set to true or false all checkBox if implemented 
     3686        """ 
    36633687    def get_weight_flag(self): 
    36643688        """ 
     
    36823706        toggle view of model from 1D to 2D  or 2D from 1D if implemented 
    36833707        """ 
    3684  
    36853708 
    36863709class ModelTextCtrl(wx.TextCtrl): 
     
    36963719 
    36973720    """ 
    3698     # Set to True when the mouse is clicked while whole string is selected 
     3721    ## Set to True when the mouse is clicked while whole string is selected 
    36993722    full_selection = False 
    3700     # Call back for EVT_SET_FOCUS events 
     3723    ## Call back for EVT_SET_FOCUS events 
    37013724    _on_set_focus_callback = None 
    37023725 
     
    37203743            if set_focus_callback is None else set_focus_callback 
    37213744        self.Bind(wx.EVT_SET_FOCUS, self._on_set_focus) 
    3722         self.Bind(wx.EVT_KILL_FOCUS, self._silent_kill_focus 
    3723         if kill_focus_callback is None else kill_focus_callback) 
    3724         self.Bind(wx.EVT_TEXT_ENTER, parent._onparamEnter 
    3725         if text_enter_callback is None else text_enter_callback) 
     3745        self.Bind(wx.EVT_KILL_FOCUS, self._silent_kill_focus \ 
     3746            if kill_focus_callback is None else kill_focus_callback) 
     3747        self.Bind(wx.EVT_TEXT_ENTER, parent._onparamEnter \ 
     3748            if text_enter_callback is None else text_enter_callback) 
    37263749        if not ON_MAC: 
    3727             self.Bind(wx.EVT_LEFT_UP, self._highlight_text 
    3728             if mouse_up_callback is None else mouse_up_callback) 
     3750            self.Bind(wx.EVT_LEFT_UP, self._highlight_text \ 
     3751                if mouse_up_callback is None else mouse_up_callback) 
    37293752 
    37303753    def _on_set_focus(self, event): 
     
    37663789 
    37673790        event.Skip() 
    3768         # pass 
     3791        #pass 
Note: See TracChangeset for help on using the changeset viewer.