Ignore:
Timestamp:
Jul 11, 2016 4:36:55 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:
9454a27
Parents:
dc72638
git-author:
Lewis O'Driscoll <lewis.o'driscoll@…> (07/08/16 05:28:25)
git-committer:
Lewis O'Driscoll <lewis.o'driscoll@…> (07/11/16 04:36:55)
Message:

Plot qrange on textbox click

File:
1 edited

Legend:

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

    rdc72638 r688d029  
    6161        self._qmax1_input.Bind(wx.EVT_TEXT, self._on_enter_input) 
    6262        self._qmax2_input.Bind(wx.EVT_TEXT, self._on_enter_input) 
     63        self._qmin_input.Bind(wx.EVT_MOUSE_EVENTS, self._on_click_qrange) 
     64        self._qmax1_input.Bind(wx.EVT_MOUSE_EVENTS, self._on_click_qrange) 
     65        self._qmax2_input.Bind(wx.EVT_MOUSE_EVENTS, self._on_click_qrange) 
    6366        self._background_input.Bind(wx.EVT_TEXT, self._on_enter_input) 
    6467 
     
    226229        self.qmax = (new_qmax1, new_qmax2) 
    227230        self.background = float(self._background_input.GetValue()) 
     231        self._calculator.background = self.background 
    228232        from sas.sasgui.perspectives.corfunc.corfunc import GROUP_ID_IQ_DATA,\ 
    229233            IQ_DATA_LABEL 
    230         group_id = GROUP_ID_IQ_DATA 
    231234        if event is not None: 
    232             if self._manager is not None and\ 
    233                 event.GetEventObject() == self._background_input: 
     235            active_ctrl = event.GetEventObject() 
     236            if active_ctrl == self._background_input: 
    234237                from sas.sasgui.perspectives.corfunc.corfunc\ 
    235238                    import IQ_DATA_LABEL 
    236                 self._manager.show_data(self._data, IQ_DATA_LABEL, reset=True) 
     239                self._manager.show_data(self._data, IQ_DATA_LABEL, reset=False) 
     240            wx.PostEvent(self._manager.parent, PlotQrangeEvent( 
     241                ctrl=[self._qmin_input, self._qmax1_input, self._qmax2_input], 
     242                active=active_ctrl, id=IQ_DATA_LABEL, 
     243                group_id=GROUP_ID_IQ_DATA, leftdown=False)) 
     244 
     245    def _on_click_qrange(self, event=None): 
     246        if event is None: 
     247            return 
     248        event.Skip() 
     249        if not self._validate_inputs(): return 
     250        is_click = event.LeftDown() 
     251        if is_click: 
     252            from sas.sasgui.perspectives.corfunc.corfunc import GROUP_ID_IQ_DATA,\ 
     253                IQ_DATA_LABEL 
    237254            wx.PostEvent(self._manager.parent, PlotQrangeEvent( 
    238255                ctrl=[self._qmin_input, self._qmax1_input, self._qmax2_input], 
    239256                active=event.GetEventObject(), id=IQ_DATA_LABEL, 
    240                 group_id=group_id, leftdown=False)) 
     257                group_id=GROUP_ID_IQ_DATA, leftdown=is_click)) 
    241258 
    242259    def _validate_inputs(self): 
Note: See TracChangeset for help on using the changeset viewer.