Changeset f15da54 in sasview
- Timestamp:
- Apr 4, 2017 11:00:39 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:
- 1661cd5
- Parents:
- a099131
- git-author:
- Jeff Krzywon <krzywon@…> (04/04/17 11:00:39)
- git-committer:
- krzywon <krzywon@…> (04/04/17 11:00:39)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/local_perspectives/plotting/parameters_panel_slicer.py
ra099131 rf15da54 11 11 from Plotter2D import ModelPanel2D 12 12 from sas.sascalc.dataloader.data_info import Data1D, Data2D 13 ApplyParams, EVT_APPLY_PARAMS = wx.lib.newevent.NewEvent() 13 14 14 15 … … 17 18 Panel class to show the slicer parameters 18 19 """ 19 # TODO: show units20 # TODO: order parameters properly20 # TODO: show units 21 # TODO: order parameters properly 21 22 22 23 def __init__(self, parent, *args, **kwargs): … … 40 41 self.parent.Bind(EVT_SLICER, self.onEVT_SLICER) 41 42 self.parent.Bind(EVT_SLICER_PARS, self.onParamChange) 43 self.Bind(EVT_APPLY_PARAMS, self.apply_params_list) 42 44 43 45 def onEVT_SLICER(self, event): … … 141 143 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 142 144 iy += 1 143 button_label = "Apply Slicer to Selected Files"145 button_label = "Apply Slicer to Selected Plots" 144 146 self.batch_slicer_button = wx.Button(parent=self, 145 147 label=button_label) … … 196 198 def onBatchSlice(self, evt=None): 197 199 """ 198 Batch slicing button is pushed200 Method invoked with batch slicing button is pressed 199 201 :param evt: Event triggering hide/show of the batch slicer parameters 200 202 """ 201 self.parent.parent._data_panel._uncheck_all()202 203 apply_to_list = [] 203 plot_list = []204 204 spp = self.parent.parent 205 data_panel = spp._data_panel206 data_list = data_panel.list_cb_data207 205 params = self.parent.slicer.get_params() 208 206 type = self.type_select.GetStringSelection() 209 207 210 # Process each data file individually211 for item in self.data_list.CheckedStrings:212 # Get data_id213 num = len(item)214 for key in data_list:215 loaded_key = (key[:num]) if len(key) > num else key216 if loaded_key == item:217 selection = key218 break219 220 # Check the data checkbox221 data_ctrl = data_list[selection][0]222 self.check_item_and_children(data_ctrl=data_ctrl, check_value=True)223 plot_list.append(item)224 225 # Plot all checked data226 data_panel.on_plot()227 time.sleep(1.0)228 229 208 # Find loaded 2D data panels 230 209 for key, mgr in spp.plot_panels.iteritems(): 231 if mgr.graph.prop['title'] in plot_list:210 if mgr.graph.prop['title'] in self.data_list.CheckedStrings: 232 211 apply_to_list.append(mgr) 233 212 … … 235 214 for item in apply_to_list: 236 215 self._apply_slicer_to_plot(item, type) 237 item.slicer.set_params(params) 238 item.slicer.base.update() 216 217 event = ApplyParams(params=params, plot_list=apply_to_list) 218 wx.PostEvent(self, event) 239 219 240 220 # TODO: save file (if desired) … … 251 231 """ 252 232 Apply a slicer to *any* plot window, not just parent window 253 :param plot: 254 :return: 233 :param plot: 2D plot panel to apply a slicer to 234 :param type: The type of slicer to apply to the panel 235 :return: Return the plot with the slicer applied 255 236 """ 256 237 if type is None: … … 265 246 plot.onBoxavgY(None) 266 247 267 def check_item_and_children(self, data_ctrl, check_value=True):268 self.parent.parent._data_panel.tree_ctrl.CheckItem(data_ctrl,269 check_value)270 if data_ctrl.HasChildren():271 if check_value and not data_ctrl.IsExpanded():272 # Only select children if control is expanded273 # Always deselect children, regardless (see ticket #259)274 return275 for child_ctrl in data_ctrl.GetChildren():276 self.tree_ctrl.CheckItem(child_ctrl, check_value)277 278 248 def process_list(self): 249 self.checkme = None 279 250 main_window = self.parent.parent 280 251 self.loaded_data = [] 281 252 id = wx.NewId() 282 for key, value in main_window. _data_manager.stored_data.iteritems():283 if isinstance(value .data, Data2D):284 self.loaded_data.append(value.data .name)285 if key== self.parent.data2D.id:286 self.checkme = self.loaded_data.index(value.data.name)253 for key, value in main_window.plot_panels.iteritems(): 254 if isinstance(value, ModelPanel2D): 255 self.loaded_data.append(value.data2D.name) 256 if value.data2D.id == self.parent.data2D.id: 257 self.checkme = self.loaded_data.index(value.data2D.name) 287 258 self.data_list = wx.CheckListBox(parent=self, id=id, 288 259 choices=self.loaded_data, 289 name="Apply Slicer to Data Sets:") 290 self.data_list.Check(self.checkme) 260 name="Apply Slicer to 2D Plots:") 261 if self.checkme is not None: 262 self.data_list.Check(self.checkme) 291 263 self.data_list.Bind(wx.EVT_CHECKLISTBOX, self.onCheckBoxList) 292 264 293 265 def onCheckBoxList(self, e): 266 """ 267 Do not allow a checkbox to be unchecked 268 :param e: Event triggered when a checkbox list item is checked 269 """ 294 270 index = e.GetSelection() 295 271 if index == self.checkme: 296 272 self.data_list.Check(index) 273 274 def apply_params_list(self, evt=None): 275 for item in evt.plot_list: 276 item.slicer.set_params(evt.params) 277 item.slicer.base.update() 278 self.Destroy()
Note: See TracChangeset
for help on using the changeset viewer.