Ignore:
Timestamp:
Apr 6, 2009 4:56:35 PM (15 years ago)
Author:
Gervaise Alina <gervyh@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
40f9745
Parents:
ddfcd90
Message:

working on saving page status

File:
1 moved

Legend:

Unmodified
Added
Removed
  • sansview/perspectives/fitting/pagestate.py

    rdcf29d7 rcfc0913  
    44import copy 
    55 
    6 class PageInfo(object): 
     6class PageState(object): 
    77    """ 
    88        Contains info to reconstruct a page 
     
    1616        ## Data member to store the dispersion object created 
    1717        self._disp_obj_dict = {} 
    18  
     18        ## reset True change the state of exsiting button 
     19        self.reset = False 
    1920        #Data used for fitting  
    2021        self.data = data 
    2122        # flag to allow data2D plot 
    22         self.enable2D=False 
     23        self.enable2D = False 
    2324        # model on which the fit would be performed 
    2425        self.model = model 
     
    3132        self.event_owner = None 
    3233        ##page name 
    33         self.page_name="" 
     34        self.page_name = "" 
    3435        # Contains link between  model ,all its parameters, and panel organization 
    35         self.parameters=[] 
     36        self.parameters =[] 
    3637        # Contains list of parameters that cannot be fitted and reference to  
    3738        #panel objects  
    38         self.fixed_param=[] 
     39        self.fixed_param =[] 
    3940        # Contains list of parameters with dispersity and reference to  
    4041        #panel objects  
    41         self.fittable_param=[] 
     42        self.fittable_param =[] 
    4243        #list of dispersion paramaters 
    43         self.disp_list=[] 
     44        self.disp_list =[] 
    4445        #contains link between a model and selected parameters to fit  
    45         self.param_toFit=[] 
     46        self.param_toFit =[] 
    4647        #dictionary of model type and model class 
    47         self.model_list_box =None 
    48         ## list of check box    
    49         self.list_of_radiobox={}  
     48        self.model_list_box = None 
     49        
    5050        ## save  current value of combobox 
    5151        self.formfactorcombobox = "" 
    5252        self.structurecombobox  = "" 
     53        self.disp_box="" 
    5354        ## Qrange 
    54         self.qmin=None 
    55         self.qmax=None 
    56         self.npts=None 
     55        ## Q range 
     56        self.qmin= 0.001 
     57        self.qmax= 0.1 
     58        self.npts = None 
     59        ## enable smearering state 
     60        self.enable_smearer = False 
     61        ## disperity selection 
     62        self.enable_disp= False 
     63        ## state of selected all check button 
     64        self.cb1 = False 
    5765        
    58          
    59                    
    60     def save_radiobox_state(self, object ): 
     66    
     67    def save_data(self, data): 
    6168        """ 
    62             save  radiobox state  
    63             @param object: radiobox 
    64             self.list_of_check= ["label", id, state] 
    65             
     69            Save data 
    6670        """ 
    67         label = object.GetLabel() 
    68         id = object.GetId() 
    69         state = object.GetValue() 
    70         self.list_of_radiobox[label]=[label, id, state]     
     71        self.data = copy.deepcopy(data) 
    7172     
    7273     
     74         
    7375    def clone(self): 
    7476        model=None 
     
    7678            model = self.model.clone() 
    7779         
    78         obj          = PageInfo( self.parent,model= model ) 
     80        obj          = PageState( self.parent,model= model ) 
    7981        obj.data = copy.deepcopy(self.data) 
    8082        obj.model_list_box = copy.deepcopy(self.model_list_box) 
    8183        obj.manager = self.manager 
    8284        obj.event_owner = self.event_owner 
     85        obj.parameters = copy.deepcopy(self.parameters) 
     86        obj.fixed_param = copy.deepcopy(self.fixed_param) 
     87        obj.fittable_param = copy.deepcopy(self.fittable_param) 
     88        obj.enable_disp= self.enable_disp 
     89        obj.enable_smearer = self.enable_smearer 
     90        obj.disp_box= copy.deepcopy(self.disp_box) 
     91        obj.cb1 = self.cb1 
    8392        return obj 
    8493 
     94class PageMemento(object): 
     95    """ 
     96        Store the state of a fitpage or model page of fitpanel 
     97    """ 
     98    def __init__(self, state): 
     99        """ Initialization""" 
     100        self.state = state 
    85101        
     102    def setState(self,state): 
     103        """ 
     104            set current state 
     105            @param state: new state 
     106        """ 
     107        self.state = state 
     108         
     109    def getState(self): 
     110        """ 
     111            @return state 
     112        """ 
     113        return self.state 
     114        
     115        
     116        
     117        
Note: See TracChangeset for help on using the changeset viewer.