~ubuntu-branches/ubuntu/raring/wxwidgets2.8/raring

« back to all changes in this revision

Viewing changes to wxPython/wx/tools/Editra/src/eclib/txtentry.py

  • Committer: Package Import Robot
  • Author(s): Stéphane Graber
  • Date: 2012-01-07 13:59:25 UTC
  • mfrom: (1.1.9) (5.1.10 sid)
  • Revision ID: package-import@ubuntu.com-20120107135925-2601miy9ullcon9j
Tags: 2.8.12.1-6ubuntu1
* Resync from Debian, changes that were kept:
  - debian/rules: re-enable mediactrl. This allows libwx_gtk2u_media-2.8 to be
    built, as this is required by some applications (LP: #632984)
  - debian/control: Build-dep on libxt-dev for mediactrl.
  - Patches
    + fix-bashism-in-example
* Add conflict on python-wxgtk2.8 (<< 2.8.12.1-6ubuntu1~) to python-wxversion
  to guarantee upgrade ordering when moving from pycentral to dh_python2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
"""
15
15
 
16
16
__author__ = "Cody Precord <cprecord@editra.org>"
17
 
__svnid__ = "$Id: txtentry.py 57479 2008-12-21 18:19:21Z CJP $"
18
 
__revision__ = "$Revision: 57479 $"
 
17
__svnid__ = "$Id: txtentry.py 67500 2011-04-15 22:51:55Z CJP $"
 
18
__revision__ = "$Revision: 67500 $"
19
19
 
20
20
__all__ = ["CommandEntryBase",]
21
21
 
35
35
        if validator != wx.DefaultValidator:
36
36
            clone = validator.Clone()
37
37
 
38
 
        wx.SearchCtrl.__init__(self, parent, id, value, pos,
39
 
                               size, style, validator, name)
 
38
        super(CommandEntryBase, self).__init__(parent, id, value, pos,
 
39
                                               size, style, validator, name)
40
40
 
41
41
        # Attributes
42
42
        self._txtctrl = None  # For msw/gtk
 
43
        self._enterhook = None
43
44
 
44
45
        # Hide the search button and text by default
45
46
        self.ShowSearchButton(False)
57
58
                    child.Bind(wx.EVT_KEY_UP, self.OnKeyUp)
58
59
                    break
59
60
        else:
 
61
            self._txtctrl = self
60
62
            self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
61
63
            self.Bind(wx.EVT_KEY_UP, self.OnKeyUp)
62
64
 
63
65
        # Event management
64
66
        self.Bind(wx.EVT_TEXT_ENTER, self.OnEnter)
65
67
 
 
68
    EnterCallback = property(lambda self: self._enterhook,
 
69
                             lambda self, cback: setattr(self, '_enterhook', cback))
 
70
 
66
71
    def GetTextControl(self):
67
72
        """Get the wx.TextCtrl window.
68
73
        @note: only for msw/gtk
80
85
 
81
86
    def OnEnter(self, evt):
82
87
        """Handle the Enter key event"""
83
 
        evt.Skip()
 
88
        if self.EnterCallback:
 
89
            self.EnterCallback()
 
90
        else:
 
91
            evt.Skip()
84
92
 
85
93
    def SetFocus(self):
86
94
        """Set the focus and select the text in the field"""