source: sasview/sansview/perspectives/fitting/pagestate.py @ 40f9745

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 40f9745 was cfc0913, checked in by Gervaise Alina <gervyh@…>, 15 years ago

working on saving page status

  • Property mode set to 100644
File size: 3.5 KB
RevLine 
[c77d859]1
2
3import wx
[6f023e8]4import copy
[c77d859]5
[cfc0913]6class PageState(object):
[c77d859]7    """
8        Contains info to reconstruct a page
9    """
10    def __init__(self, parent,model=None, data=None):
11       
12        """
13            Initialization of the Panel
14        """
15        #TODO: remove this once the inheritence is cleaned up
16        ## Data member to store the dispersion object created
17        self._disp_obj_dict = {}
[cfc0913]18        ## reset True change the state of exsiting button
19        self.reset = False
[c77d859]20        #Data used for fitting
21        self.data = data
22        # flag to allow data2D plot
[cfc0913]23        self.enable2D = False
[c77d859]24        # model on which the fit would be performed
25        self.model = model
26        #fit page manager
27        self.manager = None
28        #Store the parent of this panel parent
29        # For this application fitpanel is the parent
30        self.parent  = parent
31        # Event_owner is the owner of model event
32        self.event_owner = None
[c9a4377]33        ##page name
[cfc0913]34        self.page_name = ""
[c77d859]35        # Contains link between  model ,all its parameters, and panel organization
[cfc0913]36        self.parameters =[]
[c77d859]37        # Contains list of parameters that cannot be fitted and reference to
38        #panel objects
[cfc0913]39        self.fixed_param =[]
[c77d859]40        # Contains list of parameters with dispersity and reference to
41        #panel objects
[cfc0913]42        self.fittable_param =[]
[c77d859]43        #list of dispersion paramaters
[cfc0913]44        self.disp_list =[]
[c77d859]45        #contains link between a model and selected parameters to fit
[cfc0913]46        self.param_toFit =[]
[c77d859]47        #dictionary of model type and model class
[cfc0913]48        self.model_list_box = None
49       
[c77d859]50        ## save  current value of combobox
51        self.formfactorcombobox = ""
52        self.structurecombobox  = ""
[cfc0913]53        self.disp_box=""
[c77d859]54        ## Qrange
[cfc0913]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
[c9a4377]65       
[cfc0913]66   
67    def save_data(self, data):
[c77d859]68        """
[cfc0913]69            Save data
[c77d859]70        """
[cfc0913]71        self.data = copy.deepcopy(data)
[c77d859]72   
[59a7f2d]73   
[cfc0913]74       
[6f023e8]75    def clone(self):
76        model=None
77        if self.model !=None:
78            model = self.model.clone()
79       
[cfc0913]80        obj          = PageState( self.parent,model= model )
[6f023e8]81        obj.data = copy.deepcopy(self.data)
[dcf29d7]82        obj.model_list_box = copy.deepcopy(self.model_list_box)
83        obj.manager = self.manager
84        obj.event_owner = self.event_owner
[cfc0913]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
[6f023e8]92        return obj
[c77d859]93
[cfc0913]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
101       
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       
[c77d859]117       
Note: See TracBrowser for help on using the repository browser.