Changeset 39f0bf4 in sasview for src/sas/sasgui/guiframe/local_perspectives/plotting/parameters_panel_slicer.py
- Timestamp:
- Mar 22, 2017 9:22:37 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:
- e075203
- Parents:
- 09f2328
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/local_perspectives/plotting/parameters_panel_slicer.py
rd85c194 r39f0bf4 7 7 from sas.sasgui.guiframe.utils import format_number 8 8 from sas.sasgui.guiframe.events import EVT_SLICER 9 from sas.sasgui.guiframe.events import SlicerParameterEvent 9 from sas.sasgui.guiframe.events import SlicerParameterEvent, SlicerEvent 10 10 11 11 … … 56 56 """ 57 57 self.bck.Clear(True) 58 self.bck.Add((5, 5), (0, 0), (1, 1), 59 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 5) 58 60 self.type = type 59 61 if type == None: 60 62 label = "Right-click on 2D plot for slicer options" 61 63 title = wx.StaticText(self, -1, label, style=wx.ALIGN_LEFT) 62 self.bck.Add(title, ( 0, 0), (1, 2),64 self.bck.Add(title, (1, 0), (1, 2), 63 65 flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, border=15) 64 66 else: 65 67 title = wx.StaticText(self, -1, 66 68 "Slicer Parameters", style=wx.ALIGN_LEFT) 67 self.bck.Add(title, ( 0, 0), (1, 2),69 self.bck.Add(title, (1, 0), (1, 2), 68 70 flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, border=15) 69 71 ix = 0 70 iy = 072 iy = 1 71 73 self.parameters = [] 72 74 keys = params.keys() … … 104 106 self.bck.Add(ctl, (iy, ix), (1, 1), 105 107 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 108 ix = 0 109 iy += 1 110 111 # Change slicer within the window 112 txt = "Slicer" 113 text = wx.StaticText(self, -1, txt, style=wx.ALIGN_LEFT) 114 self.bck.Add(text, (iy, ix), (1, 1), 115 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 116 type_list = ["SectorInteractor", "AnnulusInteractor", 117 "BoxInteractorX", "BoxInteractorY"] 118 self.type_select = wx.ComboBox(parent=self, choices=type_list) 119 self.Bind(wx.EVT_COMBOBOX, self.onChangeSlicer) 120 index = self.type_select.FindString(self.type) 121 self.type_select.SetSelection(index) 122 self.bck.Add(self.type_select, (iy, 1), (1, 1), 123 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 124 125 # batch slicing parameters 126 iy += 1 127 button_label = "Batch Slicing" 128 self.batch_slicer_button = wx.Button(parent=self, label=button_label) 129 self.Bind(wx.EVT_BUTTON, self.onToggleBatchSlicing) 130 self.bck.Add(self.batch_slicer_button, (iy, ix), (1, 1), 131 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 132 self.batch_slice_params = wx.GridBagSizer(5, 5) 133 self.bck.Hide(item=self.batch_slice_params, recursive=True) 134 iy += 1 135 self.bck.Add(self.batch_slice_params, (iy, ix), (1, 1), 136 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 106 137 iy += 1 107 138 ix = 1 108 self.bck.Add(( 20, 20), (iy, ix), (1, 1),109 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15)139 self.bck.Add((5, 5), (iy, ix), (1, 1), 140 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 5) 110 141 self.bck.Layout() 111 142 self.bck.Fit(self) … … 145 176 event = SlicerParameterEvent(type=self.type, params=params) 146 177 wx.PostEvent(self.parent, event) 178 179 def onToggleBatchSlicing(self, evt=None): 180 """ 181 Batch slicing parameters button is pushed 182 :param evt: Event triggering hide/show of the batch slicer parameters 183 """ 184 if self.bck.IsShown(item=self.batch_slice_params): 185 self.bck.Hide(item=self.batch_slice_params, recursive=True) 186 else: 187 self.bck.Show(item=self.batch_slice_params, recursive=True) 188 189 def onChangeSlicer(self, evt): 190 """ 191 Change the slicer type when changed in the dropdown 192 :param evt: Event triggering this change 193 """ 194 type = self.type_select.GetStringSelection() 195 if self.type != type: 196 if type == "SectorInteractor": 197 self.parent.onSectorQ(None) 198 elif type == "AnnulusInteractor": 199 self.parent.onSectorPhi(None) 200 elif type == "BoxInteractorX": 201 self.parent.onBoxavgX(None) 202 elif type == "BoxInteractorY": 203 self.parent.onBoxavgY(None)
Note: See TracChangeset
for help on using the changeset viewer.