Changeset 39f0bf4 in sasview


Ignore:
Timestamp:
Mar 22, 2017 7:22:37 AM (7 years ago)
Author:
krzywon
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
Message:

Modified slicer parameter panel to incorporate batch slicing. Added slicer combobox to slicer panel. Renamed files to be more explicit.

Location:
src/sas/sasgui/guiframe/local_perspectives/plotting
Files:
1 edited
2 moved

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter2D.py

    rb2b36932 r39f0bf4  
    128128        self.title_font = None 
    129129        self.title_color = 'black' 
     130        self.batch_slicer = None 
    130131        ## Graph 
    131132        self.graph = Graph() 
     
    359360                if self.slicer.__class__.__name__ != "BoxSum": 
    360361                    wx_id = ids.next() 
    361                     slicerpop.Append(wx_id, '&Edit Slicer Parameters') 
     362                    name = '&Edit Slicer Parameters and Batch Slicing' 
     363                    slicerpop.Append(wx_id, name) 
    362364                    wx.EVT_MENU(self, wx_id, self._onEditSlicer) 
    363365            slicerpop.AppendSeparator() 
     
    558560        """ 
    559561        self.onCircular(event, True) 
    560  
    561562    def onCircular(self, event, ismask=False): 
    562563        """ 
     
    628629        """ 
    629630        if self.slicer != None: 
    630             from SlicerParameters import SlicerParameterPanel 
     631            from parameters_panel_slicer import SlicerParameterPanel 
    631632            dialog = SlicerParameterPanel(self, -1, "Slicer Parameters") 
    632633            dialog.set_slicer(self.slicer.__class__.__name__, 
     
    666667        params = self.slicer.get_params() 
    667668        ## Create a new panel to display results of summation of Data2D 
    668         from slicerpanel import SlicerPanel 
     669        from parameters_panel_boxsum import SlicerPanel 
    669670        win = MDIFrame(self.parent, None, 'None', (100, 200)) 
    670671        new_panel = SlicerPanel(parent=win, id=-1, 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/parameters_panel_slicer.py

    rd85c194 r39f0bf4  
    77from sas.sasgui.guiframe.utils import format_number 
    88from sas.sasgui.guiframe.events import EVT_SLICER 
    9 from sas.sasgui.guiframe.events import SlicerParameterEvent 
     9from sas.sasgui.guiframe.events import SlicerParameterEvent, SlicerEvent 
    1010 
    1111 
     
    5656        """ 
    5757        self.bck.Clear(True) 
     58        self.bck.Add((5, 5), (0, 0), (1, 1), 
     59                     wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 5) 
    5860        self.type = type 
    5961        if type == None: 
    6062            label = "Right-click on 2D plot for slicer options" 
    6163            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), 
    6365                         flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, border=15) 
    6466        else: 
    6567            title = wx.StaticText(self, -1, 
    6668                                  "Slicer Parameters", style=wx.ALIGN_LEFT) 
    67             self.bck.Add(title, (0, 0), (1, 2), 
     69            self.bck.Add(title, (1, 0), (1, 2), 
    6870                         flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, border=15) 
    6971            ix = 0 
    70             iy = 0 
     72            iy = 1 
    7173            self.parameters = [] 
    7274            keys = params.keys() 
     
    104106                    self.bck.Add(ctl, (iy, ix), (1, 1), 
    105107                                 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) 
    106137            iy += 1 
    107138            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) 
    110141        self.bck.Layout() 
    111142        self.bck.Fit(self) 
     
    145176            event = SlicerParameterEvent(type=self.type, params=params) 
    146177            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.