Changeset a099131 in sasview
- Timestamp:
- Mar 31, 2017 2:28:20 PM (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:
- f15da54
- Parents:
- dfa1579
- git-author:
- Jeff Krzywon <krzywon@…> (03/31/17 14:28:20)
- git-committer:
- krzywon <krzywon@…> (03/31/17 14:28:20)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/local_perspectives/plotting/parameters_panel_slicer.py
rdfa1579 ra099131 3 3 import wx 4 4 import wx.lib.newevent 5 import time 5 6 #from copy import deepcopy 6 7 from sas.sasgui.guiframe.events import EVT_SLICER_PARS … … 71 72 self.bck.Add(title, (1, 0), (1, 2), 72 73 flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, border=15) 73 ix = 074 74 iy = 1 75 75 self.parameters = [] … … 147 147 self.bck.Add(self.batch_slicer_button, (iy, ix), (1, 1), 148 148 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 149 # TODO: Select all button 149 150 # TODO: Check box for saving file 150 151 # TODO: append to file information and file type … … 198 199 :param evt: Event triggering hide/show of the batch slicer parameters 199 200 """ 201 self.parent.parent._data_panel._uncheck_all() 202 apply_to_list = [] 203 plot_list = [] 204 spp = self.parent.parent 205 data_panel = spp._data_panel 206 data_list = data_panel.list_cb_data 207 params = self.parent.slicer.get_params() 208 type = self.type_select.GetStringSelection() 209 200 210 # Process each data file individually 201 211 for item in self.data_list.CheckedStrings: 202 212 # Get data_id 203 213 num = len(item) 204 spp = self.parent.parent205 data_panel = spp._data_panel206 data_list = data_panel.list_cb_data207 214 for key in data_list: 208 215 loaded_key = (key[:num]) if len(key) > num else key … … 210 217 selection = key 211 218 break 219 212 220 # Check the data checkbox 213 221 data_ctrl = data_list[selection][0] 214 222 self.check_item_and_children(data_ctrl=data_ctrl, check_value=True) 215 # Plot all checked data 216 data_panel.on_plot() 217 panel = plot_mgr = None 218 plot_mgrs = spp.plot_panels 219 for key, mgr in plot_mgrs.iteritems(): 220 if isinstance(mgr, ModelPanel2D): 221 plot_mgr = mgr 222 break 223 if plot_mgr is not None: 224 # TODO: find proper plot window 225 panels = plot_mgr._manager.plot_panels 226 for _, pane in panels.iteritems(): 227 if pane.window_name == item: 228 panel = pane 229 # TODO: apply slicer 230 print(panels) 231 if panel is not None: 232 self._apply_slicer_to_plot(panel) 233 # TODO: save file (if desired) 234 # TODO: send to fitting (if desired) 223 plot_list.append(item) 224 225 # Plot all checked data 226 data_panel.on_plot() 227 time.sleep(1.0) 228 229 # Find loaded 2D data panels 230 for key, mgr in spp.plot_panels.iteritems(): 231 if mgr.graph.prop['title'] in plot_list: 232 apply_to_list.append(mgr) 233 234 # Apply slicer to selected panels 235 for item in apply_to_list: 236 self._apply_slicer_to_plot(item, type) 237 item.slicer.set_params(params) 238 item.slicer.base.update() 239 240 # TODO: save file (if desired) 241 # TODO: send to fitting (if desired) 235 242 236 243 def onChangeSlicer(self, evt): … … 241 248 self._apply_slicer_to_plot(self.parent) 242 249 243 def _apply_slicer_to_plot(self, plot ):250 def _apply_slicer_to_plot(self, plot, type=None): 244 251 """ 245 252 Apply a slicer to *any* plot window, not just parent window … … 247 254 :return: 248 255 """ 249 type = self.type_select.GetStringSelection()250 if self.type != type:251 252 253 254 255 256 257 258 256 if type is None: 257 type = self.type_select.GetStringSelection() 258 if type == "SectorInteractor": 259 plot.onSectorQ(None) 260 elif type == "AnnulusInteractor": 261 plot.onSectorPhi(None) 262 elif type == "BoxInteractorX": 263 plot.onBoxavgX(None) 264 elif type == "BoxInteractorY": 265 plot.onBoxavgY(None) 259 266 260 267 def check_item_and_children(self, data_ctrl, check_value=True): 261 self.parent.parent._data_panel.tree_ctrl.CheckItem(data_ctrl, check_value) 268 self.parent.parent._data_panel.tree_ctrl.CheckItem(data_ctrl, 269 check_value) 262 270 if data_ctrl.HasChildren(): 263 271 if check_value and not data_ctrl.IsExpanded():
Note: See TracChangeset
for help on using the changeset viewer.