Ignore:
Timestamp:
Jul 11, 2016 4: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:
3560196
Parents:
173ee3a
git-author:
Lewis O'Driscoll <lewis.o'driscoll@…> (07/08/16 11:31:43)
git-committer:
Lewis O'Driscoll <lewis.o'driscoll@…> (07/11/16 04:36:55)
Message:

Implement saving/loading calculated parameters on project save

File:
1 edited

Legend:

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

    r1150083 ra684c64  
    2020    'd0': "Average Core Thickness: ", 
    2121    'A': "PolyDispersity: ", 
    22     'Lc/max': "Filling Fraction: " 
     22    'fill': "Filling Fraction: " 
    2323} 
    2424 
     
    6262        self.qmax = (0, 0) 
    6363        self.background = 0 
     64        self.extracted_params = None 
    6465        # Dictionary for saving refs to text boxes used to display output data 
    6566        self._output_boxes = None 
     
    9798        if self.state.background is not None: 
    9899            self.set_background(self.state.background) 
     100        if self.state.outputs is not None and self.state.outputs != {}: 
     101            self.set_extracted_params(self.state.outputs) 
    99102 
    100103    def get_state(self): 
     
    107110        state.set_saved_state('qmax2_tcl', self.qmax[1]) 
    108111        state.set_saved_state('background_tcl', self.background) 
     112        state.outputs = self.extracted_params 
    109113        if self._data is not None: 
    110114            state.file = self._data.title 
     
    134138        self._calculator.set_data(data) 
    135139        # Reset the outputs 
    136         for key in OUTPUT_STRINGS.keys(): 
    137             self._output_boxes[key].SetValue("-") 
     140        self.set_extracted_params(None) 
    138141        if self._manager is not None: 
    139142            from sas.sasgui.perspectives.corfunc.corfunc import IQ_DATA_LABEL 
     
    220223                StatusEvent(status=msg, info="Error")) 
    221224            return 
    222         for key in OUTPUT_STRINGS.keys(): 
    223             value = params[key] 
    224             self._output_boxes[key].SetValue(value) 
     225        self.set_extracted_params(params) 
    225226 
    226227    def save_project(self, doc=None): 
     
    257258        self._background_input.SetValue(str(bg)) 
    258259        self._calculator.background = bg 
     260 
     261    def set_extracted_params(self, params): 
     262        self.extracted_params = params 
     263        if params is None: 
     264            for key in OUTPUT_STRINGS.keys(): 
     265                self._output_boxes[key].SetValue('-') 
     266        else: 
     267            for key in OUTPUT_STRINGS.keys(): 
     268                value = params[key] 
     269                self._output_boxes[key].SetValue(value) 
    259270 
    260271 
Note: See TracChangeset for help on using the changeset viewer.