Changeset a684c64 in sasview for src/sas/sasgui/perspectives/corfunc
- Timestamp:
- Jul 11, 2016 4:36:55 AM (8 years ago)
- 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)
- Location:
- src/sas/sasgui/perspectives/corfunc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/corfunc/corfunc_panel.py
r1150083 ra684c64 20 20 'd0': "Average Core Thickness: ", 21 21 'A': "PolyDispersity: ", 22 ' Lc/max': "Filling Fraction: "22 'fill': "Filling Fraction: " 23 23 } 24 24 … … 62 62 self.qmax = (0, 0) 63 63 self.background = 0 64 self.extracted_params = None 64 65 # Dictionary for saving refs to text boxes used to display output data 65 66 self._output_boxes = None … … 97 98 if self.state.background is not None: 98 99 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) 99 102 100 103 def get_state(self): … … 107 110 state.set_saved_state('qmax2_tcl', self.qmax[1]) 108 111 state.set_saved_state('background_tcl', self.background) 112 state.outputs = self.extracted_params 109 113 if self._data is not None: 110 114 state.file = self._data.title … … 134 138 self._calculator.set_data(data) 135 139 # Reset the outputs 136 for key in OUTPUT_STRINGS.keys(): 137 self._output_boxes[key].SetValue("-") 140 self.set_extracted_params(None) 138 141 if self._manager is not None: 139 142 from sas.sasgui.perspectives.corfunc.corfunc import IQ_DATA_LABEL … … 220 223 StatusEvent(status=msg, info="Error")) 221 224 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) 225 226 226 227 def save_project(self, doc=None): … … 257 258 self._background_input.SetValue(str(bg)) 258 259 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) 259 270 260 271 -
src/sas/sasgui/perspectives/corfunc/corfunc_state.py
r6970e51 ra684c64 24 24 # List of output parameters, used by __str__ 25 25 output_list = [ 26 [ "long_period", "Long Period"],27 [ "hard_block_thickness", "Average Hard Block Thickness"],28 [ "interface_thickness", "Average Interface Thickness"],29 [ "core_thickness", "Average Core Thickness"],30 [ "polydispersity", "PolyDispersity"],31 [ "filling", "Filling Fraction"]26 ['max', "Long Period (A): "], 27 ['Lc', "Average Hard Block Thickness (A): "], 28 ['dtr', "Average Interface Thickness (A): "], 29 ['d0', "Average Core Thickness: "], 30 ['A', "PolyDispersity: "], 31 ['fill', "Filling Fraction: "] 32 32 ] 33 33 … … 44 44 self.qmax = [0, 0] 45 45 self.background = None 46 self.outputs = None46 self.outputs = {} 47 47 48 48 self.saved_state = DEFAULT_STATE … … 160 160 state.appendChild(element) 161 161 162 # Output parameters 163 output = new_doc.createElement("output") 164 top_element.appendChild(output) 165 for item in output_list: 166 element = new_doc.createElement(item[0]) 167 element.appendChild(new_doc.createTextNode(self.outputs[item[0]])) 168 output.appendChild(element) 162 169 163 170 # Save the file or return the original document with the state … … 206 213 self.set_saved_state(name=item, value=value) 207 214 215 # Parse outputs 216 entry = get_content('ns:output', node) 217 if entry is not None: 218 for item in output_list: 219 parameter = get_content("ns:{}".format(item[0]), entry) 220 if parameter is not None: 221 self.outputs[item[0]] = parameter.text.strip() 222 208 223 209 224 … … 214 229 215 230 type_name = "Corfunc" 231 232 type = ["Invariant file (*.inv)|*.inv", 233 "SASView file (*.svs)|*.svs"] 234 235 ext = ['.cor', '.COR', '.svs', '.SVS'] 216 236 217 237 def __init__(self, callback): … … 234 254 basename = os.path.basename(path) 235 255 root, ext = os.path.splitext(basename) 236 if ext.lower() != '.xml' and ext.lower() != '.svs':256 if not ext.lower() in self.ext: 237 257 raise IOError, "{} is not a supported file type".format(ext) 238 258 tree = etree.parse(path, parser=etree.ETCompatXMLParser())
Note: See TracChangeset
for help on using the changeset viewer.