Changeset b697396b in sasview for src/sas/sasgui/guiframe
- Timestamp:
- Apr 5, 2017 11:41:47 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:
- 0d8ee36
- Parents:
- 1661cd5
- git-author:
- Jeff Krzywon <krzywon@…> (04/05/17 11:41:47)
- git-committer:
- krzywon <krzywon@…> (04/05/17 11:41:47)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/local_perspectives/plotting/parameters_panel_slicer.py
rf15da54 rb697396b 4 4 import wx.lib.newevent 5 5 import time 6 #from copy import deepcopy7 6 from sas.sasgui.guiframe.events import EVT_SLICER_PARS 8 7 from sas.sasgui.guiframe.utils import format_number … … 139 138 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 140 139 iy += 1 140 # Create a list box with all of the 2D plots 141 141 self.process_list() 142 142 self.bck.Add(self.data_list, (iy, ix), (1, 1), 143 143 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 144 144 iy += 1 145 # Button to start batch slicing 145 146 button_label = "Apply Slicer to Selected Plots" 146 147 self.batch_slicer_button = wx.Button(parent=self, … … 149 150 self.bck.Add(self.batch_slicer_button, (iy, ix), (1, 1), 150 151 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 151 # TODO: Select all button152 152 # TODO: Check box for saving file 153 153 # TODO: append to file information and file type … … 206 206 type = self.type_select.GetStringSelection() 207 207 208 # Find loaded 2D data panels208 # Find desired 2D data panels 209 209 for key, mgr in spp.plot_panels.iteritems(): 210 210 if mgr.graph.prop['title'] in self.data_list.CheckedStrings: 211 211 apply_to_list.append(mgr) 212 212 213 # Apply slicer t o selected panels213 # Apply slicer type to selected panels 214 214 for item in apply_to_list: 215 215 self._apply_slicer_to_plot(item, type) 216 216 217 # Post an event to apply appropriate slicer params to each slicer 218 # Event needed due to how apply_slicer_to_plot works 217 219 event = ApplyParams(params=params, plot_list=apply_to_list) 218 220 wx.PostEvent(self, event) 219 220 221 # TODO: save file (if desired) 221 222 # TODO: send to fitting (if desired) … … 233 234 :param plot: 2D plot panel to apply a slicer to 234 235 :param type: The type of slicer to apply to the panel 235 :return: Return the plot with the slicer applied236 236 """ 237 237 if type is None: … … 247 247 248 248 def process_list(self): 249 """ 250 Populate the check list from the currently plotted 2D data 251 """ 249 252 self.checkme = None 250 253 main_window = self.parent.parent 251 254 self.loaded_data = [] 252 255 id = wx.NewId() 256 # Iterate over the loaded plots and find all 2D panels 253 257 for key, value in main_window.plot_panels.iteritems(): 254 258 if isinstance(value, ModelPanel2D): 255 259 self.loaded_data.append(value.data2D.name) 256 260 if value.data2D.id == self.parent.data2D.id: 261 # Set current plot panel as uncheckable 257 262 self.checkme = self.loaded_data.index(value.data2D.name) 258 263 self.data_list = wx.CheckListBox(parent=self, id=id, 259 264 choices=self.loaded_data, 260 265 name="Apply Slicer to 2D Plots:") 261 if self.checkme is not None: 262 self.data_list.Check(self.checkme) 266 # Check all items bty default 267 for item in range(len(self.data_list.Items)): 268 self.data_list.Check(item) 263 269 self.data_list.Bind(wx.EVT_CHECKLISTBOX, self.onCheckBoxList) 264 270 265 271 def onCheckBoxList(self, e): 266 272 """ 267 Do not allow a checkbox to beunchecked273 Prevent a checkbox item from being unchecked 268 274 :param e: Event triggered when a checkbox list item is checked 269 275 """ … … 273 279 274 280 def apply_params_list(self, evt=None): 281 """ 282 Event based parameter setting. 283 :param evt: Event triggered to apply parameters to a list of plots 284 evt should have attrs plot_list and params 285 """ 286 # Apply parameter list to each plot as desired 275 287 for item in evt.plot_list: 276 288 item.slicer.set_params(evt.params) 277 289 item.slicer.base.update() 290 # Close the slicer window 278 291 self.Destroy()
Note: See TracChangeset
for help on using the changeset viewer.