Changeset 8eeb0b6 in sasview for prview/perspectives


Ignore:
Timestamp:
Sep 26, 2009 9:08:42 AM (15 years ago)
Author:
Mathieu Doucet <doucetm@…>
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, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
39b7019
Parents:
e627f19
Message:

prview: fix highlighting for prview text controls

File:
1 edited

Legend:

Unmodified
Added
Removed
  • prview/perspectives/pr/pr_widgets.py

    r9ff861b r8eeb0b6  
    2525        wx.TextCtrl.__init__(self, *args, **kwds) 
    2626         
     27        ## Set to True when the mouse is clicked while the whole string is selected 
     28        full_selection = False 
     29        ## Call back for EVT_SET_FOCUS events 
     30        _on_set_focus_callback = None 
    2731        # Bind appropriate events 
    2832        self.Bind(wx.EVT_LEFT_UP, self._highlight_text) 
     33        self.Bind(wx.EVT_SET_FOCUS, self._on_set_focus) 
     34 
     35    def _on_set_focus(self, event): 
     36        """ 
     37            Catch when the text control is set in focus to highlight the whole 
     38            text if necessary 
     39            @param event: mouse event 
     40        """ 
     41        event.Skip() 
     42        self.full_selection = True 
    2943         
    3044    def _highlight_text(self, event): 
     
    3347            @param event: mouse event 
    3448        """ 
    35         control  = event.GetEventObject() 
    36         # Check that we have a TextCtrl 
    37         if issubclass(control.__class__, wx.TextCtrl): 
    38             # Check whether text has been selected,  
    39             # if not, select the whole string 
    40  
    41             (start, end) = control.GetSelection() 
    42             if start==end: 
    43                 control.SetSelection(-1,-1) 
    44                  
    4549        # Make sure the mouse event is available to other listeners 
    4650        event.Skip() 
     51        control  = event.GetEventObject() 
     52        if self.full_selection: 
     53            self.full_selection = False 
     54            # Check that we have a TextCtrl 
     55            if issubclass(control.__class__, wx.TextCtrl): 
     56                # Check whether text has been selected,  
     57                # if not, select the whole string 
     58                (start, end) = control.GetSelection() 
     59                if start==end: 
     60                    control.SetSelection(-1,-1) 
    4761 
    4862class OutputTextCtrl(wx.TextCtrl): 
Note: See TracChangeset for help on using the changeset viewer.