Changeset 75fbd17 in sasview for invariantview/perspectives
- Timestamp:
- Feb 9, 2011 2:04:24 AM (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:
- c83a5af
- Parents:
- 8240eab
- Location:
- invariantview/perspectives/invariant
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
invariantview/perspectives/invariant/invariant.py
r27f3831 r75fbd17 27 27 from DataLoader.loader import Loader 28 28 from .invariant_panel import InvariantPanel 29 from sans.guiframe.events import EVT_INVSTATE_UPDATE29 #from sans.guiframe.events import EVT_INVSTATE_UPDATE 30 30 31 31 from sans.guiframe.plugin_base import PluginBase … … 82 82 #add error back to the data 83 83 self.parent.Bind(ERR_DATA, self._on_data_error) 84 self.parent.Bind(EVT_INVSTATE_UPDATE, self.on_set_state_helper)84 #self.parent.Bind(EVT_INVSTATE_UPDATE, self.on_set_state_helper) 85 85 86 86 self.invariant_panel = InvariantPanel(parent=self.parent) … … 195 195 data = dlg.get_data() 196 196 if issubclass(data.__class__, LoaderData1D): 197 self.compute_helper(data_list[0])198 197 wx.PostEvent(self.parent, NewPlotEvent(plot=data_list[0], 199 198 title=data_list[0].title)) 199 self.compute_helper(data_list[0]) 200 200 else: 201 201 msg = "invariant cannot be computed for data of " … … 205 205 elif len(data_list) == 1: 206 206 if issubclass(data_list[0].__class__, LoaderData1D): 207 self.compute_helper(data_list[0])208 207 wx.PostEvent(self.parent, NewPlotEvent(plot=data_list[0], 209 208 title=data_list[0].title)) 209 self.compute_helper(data_list[0]) 210 210 else: 211 211 msg = "invariant cannot be computed for" … … 245 245 raise RuntimeError, msg 246 246 247 def set_state(self, state , datainfo=None):247 def set_state(self, state=None, datainfo=None): 248 248 """ 249 249 Call-back method for the state reader. … … 254 254 self.temp_state = None 255 255 try: 256 257 if datainfo is None: 256 if datainfo.__class__.__name__ == 'list': 257 data = datainfo[0] 258 if data is None: 258 259 msg = "invariant.set_state: datainfo parameter cannot" 259 260 msg += " be None in standalone mode" 260 261 raise RuntimeError, msg 261 262 262 name = datainfo.meta_data['invstate'].file 263 datainfo.meta_data['invstate'].file = name 264 datainfo.name = name 265 datainfo.filename = name 266 self.__data = datainfo 267 self.__data.group_id = datainfo.filename 268 self.__data.id = datainfo.filename 269 270 temp_state = copy.deepcopy(state) 263 name = data.meta_data['invstate'].file 264 data.meta_data['invstate'].file = name 265 data.name = name 266 data.filename = name 267 #datainfo = self.parent.create_gui_data(datainfo,None) 268 #self.__data = datainfo 269 #self.__data.group_id = data.filename 270 #self.__data.id = datainfo.filename 271 self.__data = data 272 wx.PostEvent(self.parent, NewPlotEvent(plot=self.__data, 273 reset=True, title=self.__data.title)) 274 #temp_state = copy.deepcopy(state) 275 temp_state = self.state_reader.get_state() 271 276 # set state 272 277 self.invariant_panel.is_state_data = True 273 278 274 279 # Make sure the user sees the invariant panel after loading 275 self.parent.set_perspective(self.perspective) 280 #self.parent.set_perspective(self.perspective) 281 self.on_perspective(event=None) 276 282 # Load the invariant states 277 283 self.temp_state = temp_state 278 #self.invariant_panel.set_state(state=temp_state,data=self.__data)279 280 except: 284 self.invariant_panel.set_state(state=temp_state,data=self.__data) 285 286 except: 281 287 logging.error("invariant.set_state: %s" % sys.exc_value) 282 288 -
invariantview/perspectives/invariant/invariant_state.py
r68d48fa r75fbd17 2 2 """ 3 3 4 import time4 #import time 5 5 import os 6 6 import sys … … 252 252 """ 253 253 from xml.dom.minidom import getDOMImplementation 254 import time 254 255 timestamp = time.time() 255 256 # Check whether we have to write a standalone XML file … … 319 320 for name, value_list in self.bookmark_list.iteritems(): 320 321 element = newdoc.createElement('mark_'+ str(name)) 321 _,date,state,comp_state = value_list322 time,date,state,comp_state = value_list 322 323 time_element = newdoc.createElement('time') 323 324 time_element.appendChild(newdoc.createTextNode(str(value_list[0]))) … … 643 644 ## CanSAS format flag 644 645 self.cansas = cansas 646 self.state = None 645 647 646 648 def read(self, path): … … 742 744 elif len(output) == 1: 743 745 # Call back to post the new state 744 745 self.call_back(state=output[0].meta_data['invstate'],746 datainfo = output[0])746 self.state = output[0].meta_data['invstate'] 747 #self.call_back(state=output[0].meta_data['invstate'], 748 # datainfo = output[0]) 747 749 return output[0] 748 750 else: 749 751 return output 750 752 753 def get_state(self): 754 return self.state 751 755 752 756 def write(self, filename, datainfo=None, invstate=None):
Note: See TracChangeset
for help on using the changeset viewer.