Added wrappers for the OSXEnableAutomaticQuoteSubstitution, OSXEnableAutomaticDashSubstitution, and SXDisableAllSmartSubstitutions methods in wx.TextCtrl.

This commit is contained in:
Robin Dunn
2018-03-27 18:11:00 -07:00
parent 594dc69cf3
commit 4cbdab9e23
3 changed files with 45 additions and 3 deletions

View File

@@ -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:

View File

@@ -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()

View File

@@ -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)