Ignore:
Timestamp:
Dec 21, 2016 11:59:49 AM (8 years ago)
Author:
krzywon
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
2d09bc2
Parents:
a6fccd7
Message:

Added versioning to pagestate and fit saves to ensure past changes are skipped but future changes are not.

File:
1 edited

Legend:

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

    r9e0aa69a rfa487d93  
    351351        obj.cb1 = copy.deepcopy(self.cb1) 
    352352        obj.smearer = copy.deepcopy(self.smearer) 
     353        obj.version = copy.deepcopy(self.version) 
    353354 
    354355        for name, state in self.saved_states.iteritems(): 
     
    479480                self.str_parameters, True) 
    480481            formfactor, str_params = convert.convert_model( 
    481                 self.formfactorcombobox, str_pars) 
     482                self.formfactorcombobox, str_pars, False, self.version) 
    482483            for key, value in str_params.iteritems(): 
    483484                params[key] = value 
    484485 
    485         # Only convert if old != new, otherwise all the same 
    486         if formfactor != self.formfactorcombobox or \ 
    487                         structurefactor != self.structurecombobox: 
    488             # Spherical SLD number of layers changed between 3.1.2 and 4.0 
    489             if self.formfactorcombobox == 'SphericalSLDModel': 
    490                 self.multi_factor += 1 
    491             self.formfactorcombobox = formfactor 
    492             self.structurecombobox = structurefactor 
    493             self.parameters = [] 
    494             self.parameters = self.param_remap_from_sasmodels_convert(params) 
     486        if self.formfactorcombobox == 'SphericalSLDModel': 
     487            self.multi_factor += 1 
     488        self.formfactorcombobox = formfactor 
     489        self.structurecombobox = structurefactor 
     490        self.parameters = [] 
     491        self.parameters = self.param_remap_from_sasmodels_convert(params) 
    495492 
    496493    def _repr_helper(self, list, rep): 
     
    10161013 
    10171014        if node.get('version'): 
    1018  
     1015            # Get the version for model conversion purposes 
    10191016            self.version = tuple(int(e) for e in 
    10201017                                 str.split(node.get('version'), ".")) 
     1018            # The tuple must be at least 3 items long 
     1019            while len(self.version) < 3: 
     1020                ver_list = list(self.version) 
     1021                ver_list.append(0) 
     1022                self.version = tuple(ver_list) 
     1023 
    10211024            # Get file name 
    10221025            entry = get_content('ns:filename', node) 
     
    18341837                        name = original_fname 
    18351838                    state.data.group_id = name 
     1839                    state.version = fitstate.version 
    18361840                    # store state in fitting 
    18371841                    self.call_back(state=state, 
Note: See TracChangeset for help on using the changeset viewer.