Changeset cac1828 in sasview for src/sas/sasgui/guiframe
- Timestamp:
- Apr 7, 2017 11:39:57 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:
- 377ca62f
- Parents:
- 71b25b2
- git-author:
- Jeff Krzywon <krzywon@…> (04/07/17 11:39:57)
- git-committer:
- krzywon <krzywon@…> (04/07/17 11:39:57)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/local_perspectives/plotting/parameters_panel_slicer.py
r71b25b2 rcac1828 3 3 import wx 4 4 import wx.lib.newevent 5 import time6 5 from sas.sascalc.dataloader.readers.cansas_reader import Reader 7 6 from sas.sasgui.guiframe.events import EVT_SLICER_PARS … … 37 36 self.auto_save = None 38 37 self.path = None 39 self.type_list = ["SectorInteractor", "AnnulusInteractor", 40 "BoxInteractorX", "BoxInteractorY"] 41 self.type_select = wx.ComboBox(parent=self, choices=self.type_list) 42 self.append_name = wx.TextCtrl(parent=self, id=wx.NewId(), 43 name="Append to file name:") 38 self.type_list = [] 39 self.type_select = None 40 self.append_name = None 44 41 self.data_list = None 45 42 label = "Right-click on 2D plot for slicer options" … … 49 46 # Bindings 50 47 self.parent.Bind(EVT_SLICER, self.onEVT_SLICER) 51 self. parent.Bind(EVT_SLICER_PARS, self.onParamChange)48 self.Bind(EVT_SLICER_PARS, self.onParamChange) 52 49 self.Bind(EVT_APPLY_PARAMS, self.apply_params_list_and_process) 53 50 self.Bind(EVT_AUTO_SAVE, self.save_files) … … 128 125 self.bck.Add(text, (iy, ix), (1, 1), 129 126 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 127 self.type_list = ["SectorInteractor", "AnnulusInteractor", 128 "BoxInteractorX", "BoxInteractorY"] 129 self.type_select = wx.ComboBox(parent=self, choices=self.type_list) 130 130 self.Bind(wx.EVT_COMBOBOX, self.onChangeSlicer) 131 131 index = self.type_select.FindString(type) … … 174 174 default_value = "" 175 175 for key in params: 176 default_value += "_{0} -".format(key)177 default_value += " {:.5f}".format(params[key])176 default_value += "_{0}".format(key).split(" [")[0] 177 default_value += "-{:.5f}".format(params[key]) 178 178 append_text = "Append to file name:" 179 179 append = wx.StaticText(self, -1, append_text, style=wx.ALIGN_LEFT) 180 self.append_name = wx.TextCtrl(parent=self, id=wx.NewId(), 181 name="Append to file name:") 180 182 self.append_name.SetValue(default_value) 181 183 self.append_name.Enable(False) … … 246 248 # parent here is plotter2D 247 249 event = SlicerParameterEvent(type=self.type, params=params) 248 wx.PostEvent(self , event)250 wx.PostEvent(self.parent, event) 249 251 250 252 def on_batch_slicer(self, evt=None): 251 253 """ 252 Method invoked w ithbatch slicing button is pressed254 Method invoked when batch slicing button is pressed 253 255 :param evt: Event triggering hide/show of the batch slicer parameters 254 256 """ … … 271 273 272 274 # Post an event to apply appropriate slicer params to each slicer 273 # Event needed due to how apply_slicer_to_plot works 274 event = apply_params(params=params, plot_list=apply_to_list, 275 event_params = apply_params(params=params, apply_to_list=apply_to_list, 275 276 auto_save=save, append=append, 276 277 path=path, type=type) 277 wx.PostEvent(self, event )278 wx.PostEvent(self, event_params) 278 279 279 280 def onChangeSlicer(self, evt): … … 292 293 # Skip redrawing the current plot if no change 293 294 if self.parent == plot and self.type == type: 295 return 296 # Do not draw a slicer on a 1D plot 297 if not isinstance(plot, ModelPanel2D): 294 298 return 295 299 if type is None: … … 345 349 """ 346 350 # Apply parameter list to each plot as desired 347 for item in evt. plot_list:351 for item in evt.apply_to_list: 348 352 event = SlicerParameterEvent(type=evt.type, params=evt.params) 349 353 wx.PostEvent(item, event) … … 351 355 if evt.auto_save: 352 356 event = auto_save(append_to_name=evt.append, 353 file_list=evt. plot_list,357 file_list=evt.apply_to_list, 354 358 path=evt.path, type=evt.type) 355 359 wx.PostEvent(self, event) … … 380 384 data_dic[item] = plot.plots[item] 381 385 for item, data1d in data_dic.iteritems(): 382 base = item.split(".")[0]386 base = ('.').join(item.split('.')[:-1]) 383 387 save_to = evt.path + "\\" + base + append + ".xml" 384 388 writer.write(save_to, data1d)
Note: See TracChangeset
for help on using the changeset viewer.