source: sasview/sansview/perspectives/fitting/pagestate.py @ 847091f

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 847091f was 60132ef, checked in by Gervaise Alina <gervyh@…>, 15 years ago

working on dispersity

  • Property mode set to 100644
File size: 4.1 KB
Line 
1
2
3import copy
4
5class PageState(object):
6    """
7        Contains info to reconstruct a page
8    """
9    def __init__(self, parent,model=None, data=None):
10       
11        """
12            Initialization of the Panel
13        """
14        #TODO: remove this once the inheritence is cleaned up
15        ## Data member to store the dispersion object created
16        self._disp_obj_dict = {}
17        ## reset True change the state of exsiting button
18        self.reset = False
19        #Data used for fitting
20        self.data = data
21        # flag to allow data2D plot
22        self.enable2D = False
23        # model on which the fit would be performed
24        self.model = model
25        #fit page manager
26        self.manager = None
27        #Store the parent of this panel parent
28        # For this application fitpanel is the parent
29        self.parent  = parent
30        # Event_owner is the owner of model event
31        self.event_owner = None
32        ##page name
33        self.page_name = ""
34        # Contains link between  model ,all its parameters, and panel organization
35        self.parameters =[]
36        # Contains list of parameters that cannot be fitted and reference to
37        #panel objects
38        self.fixed_param =[]
39        # Contains list of parameters with dispersity and reference to
40        #panel objects
41        self.fittable_param =[]
42        ## orientation parameters
43        self.orientation_params=[]
44        #list of dispersion paramaters
45        self.disp_list =[]
46        #contains link between a model and selected parameters to fit
47        self.param_toFit =[]
48        ##dictionary of model type and model class
49        self.model_list_box = None
50        ## save the state of the context menu
51        self.saved_states={}
52        ## save  current value of combobox
53        self.formfactorcombobox = ""
54        self.structurecombobox  = ""
55        ## the indice of the current selection
56        self.disp_box = 0
57        ## Qrange
58        ## Q range
59        self.qmin= 0.001
60        self.qmax= 0.1
61        self.npts = None
62        ## enable smearering state
63        self.enable_smearer = False
64        ## disperity selection
65        self.enable_disp= False
66        ## state of selected all check button
67        self.cb1 = False
68       
69   
70    def save_data(self, data):
71        """
72            Save data
73        """
74        self.data = copy.deepcopy(data)
75
76       
77    def clone(self):
78        model=None
79        if self.model !=None:
80            model = self.model.clone()
81       
82        obj          = PageState( self.parent,model= model )
83        obj.data = copy.deepcopy(self.data)
84        obj.model_list_box = copy.deepcopy(self.model_list_box)
85        obj.manager = self.manager
86        obj.event_owner = self.event_owner
87        obj.parameters = copy.deepcopy(self.parameters)
88        obj.fixed_param = copy.deepcopy(self.fixed_param)
89        obj.fittable_param = copy.deepcopy(self.fittable_param)
90        obj.orientation_params =  copy.deepcopy(self.orientation_params)
91        obj.enable_disp = copy.deepcopy(self.enable_disp)
92        obj.enable_smearer = copy.deepcopy(self.enable_smearer)
93        obj.disp_box = copy.deepcopy(self.disp_box)
94        obj.qmin = copy.deepcopy(self.qmin)
95        obj.qmax = copy.deepcopy(self.qmax)
96        obj.npts = copy.deepcopy(self.npts )
97        obj.cb1 = copy.deepcopy(self.cb1)
98        for name, state in self.saved_states.iteritems():
99            copy_name = copy.deepcopy(name)
100            copy_state = state.clone()
101            obj.saved_states[copy_name]= copy_state
102        return obj
103
104class PageMemento(object):
105    """
106        Store the state of a fitpage or model page of fitpanel
107    """
108    def __init__(self, state):
109        """ Initialization"""
110        self.state = state
111       
112    def setState(self,state):
113        """
114            set current state
115            @param state: new state
116        """
117        self.state = state
118       
119    def getState(self):
120        """
121            @return state
122        """
123        return self.state
124       
125       
126       
127       
Note: See TracBrowser for help on using the repository browser.