Changeset f24925ab in sasview
- Timestamp:
- Aug 1, 2010 2:32:53 PM (14 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, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- d45e7e9
- Parents:
- 0399c78
- Location:
- invariantview/perspectives/invariant
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
invariantview/perspectives/invariant/invariant.py
rd318616 rf24925ab 47 47 # for your plug-in. This defines your plug-in "perspective" 48 48 self.perspective = [] 49 50 # is this data from *.inv file?51 self.is_state_data = False52 49 53 50 self.state_reader = None … … 238 235 if data is None: 239 236 return 240 if self.is_state_data: 241 self.is_state_data = False 242 else: 237 # set current data if not it's a state data 238 if not self.invariant_panel.is_state_data: 243 239 # Store reference to data 244 240 self.__data = data … … 253 249 :param state: invariant state 254 250 """ 255 256 251 # Write the state to file 257 252 # First, check that the data is of the right type 258 259 253 current_plottable = self.__data 260 254 … … 280 274 self.__data.group_id = datainfo.filename 281 275 self.__data.id = datainfo.filename 282 276 283 277 temp_state = copy.deepcopy(state) 284 278 # set state 279 self.invariant_panel.is_state_data = True 285 280 # Load the invariant states 286 281 # Make sure the user sees the invariant panel after loading 287 282 self.parent.set_perspective(self.perspective) 288 # set state 289 self.is_state_data = True 290 self.invariant_panel.is_state_data = True 291 self.invariant_panel.set_state(state=temp_state,data=self.__data) 292 283 self.invariant_panel.set_state(state=temp_state,data=self.__data) 293 284 294 285 except: 295 286 logging.error("invariant.set_state: %s" % sys.exc_value) 296 297 287 298 288 299 289 def plot_theory(self, data=None, name=None): -
invariantview/perspectives/invariant/invariant_panel.py
r0399c78 rf24925ab 81 81 # default flags for state 82 82 self.new_state = False 83 self.is_state_data = False 83 84 self.is_power_out = False 84 self.is_state_data = False85 85 86 86 #container of invariant value … … 117 117 def on_select_data(self, event=None): 118 118 """ 119 On select data by combobox or contextmenu orby set_data119 On select data by combobox or by set_data 120 120 """ 121 121 if event !=None: 122 self.state 122 123 n = self.data_cbbox.GetCurrentSelection() 124 self.data_cbbox.SetSelection(n) 123 125 data, path = self.data_cbbox.GetClientData(n) 124 #warning message for losing all the calculation and states125 126 if self._data !=None: 126 if self._data.name != data.name: 127 if self._show_message(): 128 self._manager.compute_helper(data=data) 129 data = self._data 127 self._manager.compute_helper(data=data) 128 data = self._data 130 129 return 131 130 … … 149 148 return 150 149 151 count_bf = self.data_cbbox.GetCount()150 #count_bf = self.data_cbbox.GetCount() 152 151 for data, path in list: 153 152 if data.__class__.__name__ != "Data2D" and \ … … 158 157 159 158 count = self.data_cbbox.GetCount() 160 if count >0: 161 # set data only on the first or state data 162 if count ==1 or self.is_state_data: 163 self.data_cbbox.Enable() 164 self._data = data 165 self.on_select_data(event=None) 166 self.is_state_data = False 167 159 if count > 0: 160 self.data_cbbox.Enable() 161 # reset data (cb) only on the first data 162 if count ==1: 163 try: 164 #check if the data is from inv file 165 self._data.meta_data['invstate'].file 166 except: 167 self._data = data 168 self.on_select_data(event=None) 169 170 #data = self._data 168 171 title = "Untitled" 169 172 if hasattr(data,"title"): … … 174 177 title = str(data.name) 175 178 179 if self.is_state_data: 180 self.data_cbbox.SetValue(title) 181 self.data_cbbox.Enable(True) 182 self.is_state_data = False 183 176 184 wx.PostEvent(self.parent, NewPlotEvent(plot=data, title=title)) 177 185 … … 206 214 item=data.name) 207 215 else: 208 pos = self.data_cbbox.FindString(data.name)209 self.data_cbbox.SetSelection(pos)216 position = self.data_cbbox.FindString(data.name) 217 self.data_cbbox.SetSelection(position) 210 218 211 219 self.data_min_tcl.SetLabel(str(data_qmin)) … … 251 259 self.state = IState() 252 260 else: 261 self.new_state = True 253 262 if not self.set_current_data(data, path=None): 254 263 return 255 self.new_state = True256 264 self.state = state 257 265 … … 282 290 self.state.data = self._data 283 291 self.new_state = False 292 self.is_state_data = False 284 293 285 294 … … 1174 1183 Show warning message when resetting data 1175 1184 """ 1185 # no message for now 1186 return True 1176 1187 count_bf = self.data_cbbox.GetCount() 1177 1188 if count_bf > 1:
Note: See TracChangeset
for help on using the changeset viewer.