diff --git a/CHANGES.rst b/CHANGES.rst index 0368fbfc..61087cb8 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -23,9 +23,13 @@ is included in the wxPython source archives. Along with this change a new maintenance releases of the 4.0.x series of wxPython, which will still track the ``WX_3_0_BRANCH`` wxWidgets branch. + New and improved stuff in this release: -* +* Added wrappers for the OSXEnableAutomaticQuoteSubstitution, + OSXEnableAutomaticDashSubstitution, and OSXDisableAllSmartSubstitutions + methods in wx.TextCtrl. + Other changes in this release: diff --git a/etg/_stc.py b/etg/_stc.py index 797e93e3..6a1ef9c7 100644 --- a/etg/_stc.py +++ b/etg/_stc.py @@ -147,13 +147,18 @@ def run(): not c.findItem(item.name)] c.items.extend(items) + tc_excludes = ['OSXEnableAutomaticQuoteSubstitution', + 'OSXEnableAutomaticDashSubstitution', + 'OSXDisableAllSmartSubstitutions', + ] import textctrl mod = textctrl.parseAndTweakModule() klass = mod.find('wxTextCtrl') items = [item for item in klass.items if isinstance(item, etgtools.MethodDef) and not item.isCtor and not item.isDtor and - not c.findItem(item.name)] + not c.findItem(item.name) and + not item.name in tc_excludes] c.items.extend(items) c.find('EmulateKeyPress').ignore() diff --git a/etg/textctrl.py b/etg/textctrl.py index e45cee34..6695fb10 100644 --- a/etg/textctrl.py +++ b/etg/textctrl.py @@ -106,10 +106,43 @@ def parseAndTweakModule(): doc="NOP, for file-like compatibility.", body="") + + # OSX methods for controlling native features + c.addCppMethod('void', 'OSXEnableAutomaticQuoteSubstitution', '(bool enable)', + doc="Mac-only method for turning on/off automatic quote substitutions.", + body="""\ + #ifdef __WXMAC__ + self->OSXEnableAutomaticQuoteSubstitution(enable); + #else + wxPyRaiseNotImplemented(); + #endif + """) + + c.addCppMethod('void', 'OSXEnableAutomaticDashSubstitution', '(bool enable)', + doc="Mac-only method for turning on/off automatic dash substitutions.", + body="""\ + #ifdef __WXMAC__ + self->OSXEnableAutomaticDashSubstitution(enable); + #else + wxPyRaiseNotImplemented(); + #endif + """) + + c.addCppMethod('void', 'OSXDisableAllSmartSubstitutions', '()', + doc="Mac-only method to disable all automatic text substitutions.", + body="""\ + #ifdef __WXMAC__ + self->OSXDisableAllSmartSubstitutions(); + #else + wxPyRaiseNotImplemented(); + #endif + """) + + + c = module.find('wxTextUrlEvent') tools.fixEventClass(c) - module.addPyCode("""\ EVT_TEXT = wx.PyEventBinder( wxEVT_TEXT, 1) EVT_TEXT_ENTER = wx.PyEventBinder( wxEVT_TEXT_ENTER, 1)