Changeset 71b25b2 in sasview for src/sas/sasgui/guiframe
- Timestamp:
- Apr 7, 2017 6:38:01 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.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- cac1828
- Parents:
- 982577b
- git-author:
- Jeff Krzywon <krzywon@…> (04/07/17 06:38:01)
- git-committer:
- krzywon <krzywon@…> (04/07/17 06:38:01)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/local_perspectives/plotting/parameters_panel_slicer.py
r982577b r71b25b2 9 9 from sas.sasgui.guiframe.events import EVT_SLICER 10 10 from sas.sasgui.guiframe.events import SlicerParameterEvent, SlicerEvent 11 from Plotter1D import ModelPanel1D12 11 from Plotter2D import ModelPanel2D 13 12 from sas.sascalc.dataloader.data_info import Data1D, Data2D 14 13 apply_params, EVT_APPLY_PARAMS = wx.lib.newevent.NewEvent() 15 14 auto_save, EVT_AUTO_SAVE = wx.lib.newevent.NewEvent() 16 auto_close, EVT_ON_CLOSE = wx.lib.newevent.NewEvent()17 15 18 16 … … 54 52 self.Bind(EVT_APPLY_PARAMS, self.apply_params_list_and_process) 55 53 self.Bind(EVT_AUTO_SAVE, self.save_files) 56 self.Bind(EVT_ON_CLOSE, self.on_close)57 54 58 55 def onEVT_SLICER(self, event): … … 157 154 # Checkbox for autosaving data 158 155 iy += 1 159 160 156 self.auto_save = wx.CheckBox(parent=self, id=wx.NewId(), 161 157 label="Auto save generated 1D:") … … 164 160 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 165 161 iy += 1 166 # TODO: Get list of loaded data, not plots - plot again167 # TODO: try/catch block to catch wx._core.PyDeadObjectError (pass)168 162 # File browser 169 163 save_to = "Save files to:" … … 178 172 # Append to file 179 173 iy += 1 180 default_value = " _{0}".format(self.type)174 default_value = "" 181 175 for key in params: 182 default_value += "_%d.2" % params[key] 176 default_value += "_{0}-".format(key) 177 default_value += "{:.5f}".format(params[key]) 183 178 append_text = "Append to file name:" 184 179 append = wx.StaticText(self, -1, append_text, style=wx.ALIGN_LEFT) … … 279 274 event = apply_params(params=params, plot_list=apply_to_list, 280 275 auto_save=save, append=append, 281 path=path) 282 wx.PostEvent(self, event) 283 event = auto_close() 276 path=path, type=type) 284 277 wx.PostEvent(self, event) 285 278 … … 297 290 :param type: The type of slicer to apply to the panel 298 291 """ 292 # Skip redrawing the current plot if no change 293 if self.parent == plot and self.type == type: 294 return 299 295 if type is None: 300 296 type = self.type_select.GetStringSelection() … … 350 346 # Apply parameter list to each plot as desired 351 347 for item in evt.plot_list: 352 item.slicer.set_params(evt.params)353 item.slicer.base.update()348 event = SlicerParameterEvent(type=evt.type, params=evt.params) 349 wx.PostEvent(item, event) 354 350 # Post an event to save each data set to file 355 351 if evt.auto_save: 356 352 event = auto_save(append_to_name=evt.append, 357 353 file_list=evt.plot_list, 358 path=evt.path )354 path=evt.path, type=evt.type) 359 355 wx.PostEvent(self, event) 360 356 … … 370 366 data_dic = {} 371 367 append = evt.append_to_name 368 names = [] 369 convert_dict = {"SectorInteractor": "SectorQ", 370 "AnnulusInteractor": "AnnulusPhi", 371 "BoxInteractorX": "SlabX", 372 "BoxInteractorY": "SlabY"} 373 for f_name in evt.file_list: 374 names.append(f_name.data2D.label) 372 375 for key, plot in main_window.plot_panels.iteritems(): 373 376 if not hasattr(plot, "data2D"): 374 377 for item in plot.plots: 375 data_dic[item] = plot.plots[item] 378 base = item.replace(convert_dict[evt.type], "") 379 if base in names: 380 data_dic[item] = plot.plots[item] 376 381 for item, data1d in data_dic.iteritems(): 377 382 base = item.split(".")[0] 378 383 save_to = evt.path + "\\" + base + append + ".xml" 379 384 writer.write(save_to, data1d) 380 # TODO: save all files381 385 382 386 def on_auto_save_checked(self, evt=None): … … 387 391 self.append_name.Enable(self.auto_save.IsChecked()) 388 392 self.path.Enable(self.auto_save.IsChecked()) 389 390 def on_close(self, evt=None):391 """392 Auto close the panel393 """394 self.Destroy()
Note: See TracChangeset
for help on using the changeset viewer.