Changeset 02a8779 in sasview for src/sas/sasgui/perspectives


Ignore:
Timestamp:
Jul 11, 2016 4:17:35 AM (8 years ago)
Author:
lewis
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.1.1, release-4.1.2, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
a2db1ab
Parents:
37e7223
Message:

Plot qrange on data load and qrange no longer disappears when background clicked

Location:
src/sas/sasgui/perspectives/corfunc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/corfunc/corfunc.py

    r37e7223 r02a8779  
    116116                        info='error')) 
    117117 
    118     def show_data(self, data, label, reset=False): 
     118    def show_data(self, data, label, reset=False, active_ctrl=None): 
    119119        """ 
    120120        Show data read from a file 
     
    149149        if label == IQ_EXTRAPOLATED_DATA_LABEL or label == TRANSFORM_LABEL: 
    150150            self.parent.update_theory(data_id=label, theory=new_plot) 
     151        if label == IQ_DATA_LABEL or label == IQ_EXTRAPOLATED_DATA_LABEL: 
     152            wx.CallAfter(self.corfunc_panel.plot_qrange, active=active_ctrl, 
     153                leftdown=True) 
    151154 
    152155    def clear_data(self): 
  • src/sas/sasgui/perspectives/corfunc/corfunc_panel.py

    r37e7223 r02a8779  
    278278                self._output_boxes[key].SetValue(value) 
    279279 
     280    def plot_qrange(self, active=None, leftdown=False): 
     281        if active is None: 
     282            active = self._qmin_input 
     283        wx.PostEvent(self._manager.parent, PlotQrangeEvent( 
     284            ctrl=[self._qmin_input, self._qmax1_input, self._qmax2_input], 
     285            active=active, id=IQ_DATA_LABEL, is_corfunc=True, 
     286            group_id=GROUP_ID_IQ_DATA, leftdown=leftdown)) 
     287 
    280288 
    281289    def _compute_background(self, event=None): 
     
    298306            active_ctrl = event.GetEventObject() 
    299307            if active_ctrl == self._background_input: 
    300                 from sas.sasgui.perspectives.corfunc.corfunc\ 
    301                     import IQ_DATA_LABEL 
    302                 self._manager.show_data(self._data, IQ_DATA_LABEL, reset=False) 
    303             wx.PostEvent(self._manager.parent, PlotQrangeEvent( 
    304                 ctrl=[self._qmin_input, self._qmax1_input, self._qmax2_input], 
    305                 active=active_ctrl, id=IQ_DATA_LABEL, is_corfunc=True, 
    306                 group_id=GROUP_ID_IQ_DATA, leftdown=False)) 
     308                self._manager.show_data(self._data, IQ_DATA_LABEL, 
     309                    reset=False, active_ctrl=active_ctrl) 
    307310 
    308311    def _on_click_qrange(self, event=None): 
     
    311314        event.Skip() 
    312315        if not self._validate_inputs(): return 
    313         is_click = event.LeftDown() 
    314         if is_click: 
    315             wx.PostEvent(self._manager.parent, PlotQrangeEvent( 
    316                 ctrl=[self._qmin_input, self._qmax1_input, self._qmax2_input], 
    317                 active=event.GetEventObject(), id=IQ_DATA_LABEL, 
    318                 group_id=GROUP_ID_IQ_DATA, leftdown=is_click)) 
     316        self.plot_qrange(active=event.GetEventObject(), 
     317            leftdown=event.LeftDown()) 
    319318 
    320319    def _validate_inputs(self): 
Note: See TracChangeset for help on using the changeset viewer.