Changeset 2ff9e37 in sasview for src/sas/sasgui/perspectives


Ignore:
Timestamp:
Jul 11, 2016 2:36:55 AM (8 years ago)
Author:
lewis
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:
d4f5637
Parents:
d888abf
git-author:
Lewis O'Driscoll <lewis.o'driscoll@…> (07/11/16 02:31:53)
git-committer:
Lewis O'Driscoll <lewis.o'driscoll@…> (07/11/16 02:36:55)
Message:

On project load, only plot extrapolation/transform if they were plotted before project save

Location:
src/sas/sasgui/perspectives/corfunc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/corfunc/corfunc_panel.py

    r6ccf18e r2ff9e37  
    9898        if self.state.background is not None: 
    9999            self.set_background(self.state.background) 
     100        if self.state.is_extrapolated: 
     101            self.compute_extrapolation() 
     102        else: 
     103            return 
     104        if self.state.is_transformed: 
     105            self.compute_transform() 
     106        else: 
     107            return 
    100108        if self.state.outputs is not None and self.state.outputs != {}: 
    101109            self.set_extracted_params(self.state.outputs) 
    102             self.compute_extrapolation() 
    103             self.compute_transform() 
    104110 
    105111    def get_state(self): 
     
    116122            state.file = self._data.title 
    117123            state.data = self._data 
     124        if self._extrapolated_data is not None: 
     125            state.is_extrapolated = True 
     126        if self._transformed_data is not None: 
     127            state.is_transformed = True 
    118128        self.state = state 
    119129 
     
    236246        state = self.get_state() 
    237247        if data is not None: 
     248            import pdb; pdb.set_trace() 
    238249            new_doc, sasentry = self._manager.state_reader._to_xml_doc(data) 
    239250            new_doc = state.toXML(doc=new_doc, entry_node=sasentry) 
  • src/sas/sasgui/perspectives/corfunc/corfunc_state.py

    rd888abf r2ff9e37  
    4646        self.background = None 
    4747        self.outputs = {} 
     48        self.is_extrapolated = False 
     49        self.is_transformed = False 
    4850 
    4951        self.saved_state = DEFAULT_STATE 
     
    161163            state.appendChild(element) 
    162164 
     165        # Whether or not the extrapolate & transform buttons have been clicked 
     166        element = new_doc.createElement("is_extrapolated") 
     167        top_element.appendChild(element) 
     168        element.appendChild(new_doc.createTextNode(str(int(self.is_extrapolated)))) 
     169 
     170        element = new_doc.createElement("is_transformed") 
     171        top_element.appendChild(element) 
     172        element.appendChild(new_doc.createTextNode(str(int(self.is_transformed)))) 
     173 
    163174        # Output parameters 
    164175        if self.outputs != {} and self.outputs is not None: 
     
    187198        :param node: node of an XML document to read from (optional) 
    188199        """ 
     200        import pdb; pdb.set_trace() 
    189201        if node.get('version') and node.get('version') == '1.0': 
    190202            # Parse filename 
     
    214226                            value = None 
    215227                        self.set_saved_state(name=item, value=value) 
     228 
     229            # Parse is_extrapolated and is_transformed 
     230            entry = get_content('ns:is_extrapolated', node) 
     231            if entry is not None: 
     232                self.is_extrapolated = bool(int(entry.text.strip())) 
     233            entry = get_content('ns:is_transformed', node) 
     234            if entry is not None: 
     235                self.is_transformed = bool(int(entry.text.strip())) 
    216236 
    217237            # Parse outputs 
Note: See TracChangeset for help on using the changeset viewer.