Changeset df27aa8 in sasview for src/sas/sasgui
- Timestamp:
- Mar 24, 2017 1:51:00 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:
- dfa1579
- Parents:
- ba90c32
- git-author:
- Jeff Krzywon <krzywon@…> (03/24/17 13:51:00)
- git-committer:
- krzywon <krzywon@…> (03/24/17 13:51:00)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/local_perspectives/plotting/parameters_panel_slicer.py
rba90c32 rdf27aa8 8 8 from sas.sasgui.guiframe.events import EVT_SLICER 9 9 from sas.sasgui.guiframe.events import SlicerParameterEvent, SlicerEvent 10 from Plotter2D import ModelPanel2D 10 11 11 12 … … 138 139 main_window = self.parent.parent 139 140 self.loaded_data = main_window._data_manager.data_name_dict 141 # TODO: remove 1D data from choices 142 # TODO: auto check current data set 140 143 choices = self.loaded_data.keys() 141 144 self.data_list = wx.CheckListBox(parent=self, id=id, … … 205 208 for item in self.data_list.CheckedStrings: 206 209 # Get data_id 207 data_dict = self.parent.parent._data_manager.get_by_name([item]) 208 data_ids = data_dict.keys() 209 # Plot data 210 self.parent.parent.plot_data(state_id=[], data_id=data_ids, theory_id=[]) 211 # TODO: apply slicer 210 num = len(item) 211 spp = self.parent.parent 212 data_panel = spp._data_panel 213 data_list = data_panel.list_cb_data 214 for key in data_list: 215 loaded_key = (key[:num]) if len(key) > num else key 216 if loaded_key == item: 217 selection = key 218 break 219 # Check the data checkbox 220 data_ctrl = data_list[selection][0] 221 self.check_item_and_children(data_ctrl=data_ctrl, check_value=True) 222 # Plot all checked data 223 data_panel.on_plot() 224 panel = plot_mgr = None 225 plot_mgrs = spp.plot_panels 226 for key, mgr in plot_mgrs.iteritems(): 227 if isinstance(mgr, ModelPanel2D): 228 plot_mgr = mgr 229 break 230 if plot_mgr is not None: 231 # TODO: find proper plot window 232 panels = plot_mgr._manager.plot_panels 233 for _, pane in panels.iteritems(): 234 if pane.window_name == item: 235 panel = pane 236 # TODO: apply slicer 237 print(panels) 238 if panel is not None: 239 self._apply_slicer_to_plot(panel) 212 240 # TODO: save file (if desired) 213 241 # TODO: send to fitting (if desired) 214 plot = None215 slicer = None216 f_name = None217 242 218 243 def onChangeSlicer(self, evt): 219 244 """ 220 Change the slicer type when changed in the dropdown245 Event driven slicer change when self.type_select changes 221 246 :param evt: Event triggering this change 247 """ 248 self._apply_slicer_to_plot(self.parent) 249 250 def _apply_slicer_to_plot(self, plot): 251 """ 252 Apply a slicer to *any* plot window, not just parent window 253 :param plot: 254 :return: 222 255 """ 223 256 type = self.type_select.GetStringSelection() 224 257 if self.type != type: 225 258 if type == "SectorInteractor": 226 self.parent.onSectorQ(None)259 plot.onSectorQ(None) 227 260 elif type == "AnnulusInteractor": 228 self.parent.onSectorPhi(None)261 plot.onSectorPhi(None) 229 262 elif type == "BoxInteractorX": 230 self.parent.onBoxavgX(None)263 plot.onBoxavgX(None) 231 264 elif type == "BoxInteractorY": 232 self.parent.onBoxavgY(None) 265 plot.onBoxavgY(None) 266 267 def check_item_and_children(self, data_ctrl, check_value=True): 268 self.parent.parent._data_panel.tree_ctrl.CheckItem(data_ctrl, check_value) 269 if data_ctrl.HasChildren(): 270 if check_value and not data_ctrl.IsExpanded(): 271 # Only select children if control is expanded 272 # Always deselect children, regardless (see ticket #259) 273 return 274 for child_ctrl in data_ctrl.GetChildren(): 275 self.tree_ctrl.CheckItem(child_ctrl, check_value)
Note: See TracChangeset
for help on using the changeset viewer.