Merge branch 'swt2c-fix_stc_sip4.18' into sip-4.18.1

This commit is contained in:
Robin Dunn
2016-06-11 21:01:55 -07:00
2 changed files with 50 additions and 0 deletions

View File

@@ -68,6 +68,7 @@ def run():
c = module.find('wxStyledTextCtrl')
assert isinstance(c, etgtools.ClassDef)
c.bases = ['wxControl'] # wxTextCtrlIface is also a base...
c.piBases = ['wx.Control', 'wx.TextEntry']
tools.fixWindowClass(c, False)
module.addGlobalStr('wxSTCNameStr', c)
@@ -131,6 +132,34 @@ def run():
# forcibly mashed into an int in the C code
module.find('wxSTC_MASK_FOLDERS').forcedInt = True
# Make sure that all the methods from wxTextEntry and wxTextCtrl are
# included. This is needed because we are pretending that this class only
# derives from wxControl but the real C++ class also derives from
# wxTextCtrlIface which derives from wxTextEntryBase.
import textentry
mod = textentry.parseAndTweakModule()
klass = mod.find('wxTextEntry')
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)]
c.items.extend(items)
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)]
c.items.extend(items)
c.find('EmulateKeyPress').ignore()
c.find('IsMultiLine').ignore()
c.find('IsSingleLine').ignore()
# TODO: Add the UTF8 PyMethods from classic (see _stc_utf8_methods.py)

View File

@@ -222,6 +222,27 @@ class stc_Tests(wtc.WidgetTestCase):
stc.EVT_STC_INDICATOR_RELEASE
stc.EVT_STC_AUTOCOMP_CANCELLED
stc.EVT_STC_AUTOCOMP_CHAR_DELETED
def test_stcHasTextCtrlMethods(self):
# Just ensure that the common TextCtrl methods are present. This is
# done because the C++ class either derives from wxTextEntryBase
# or from wxTextCtrlIface, but these classes are not part of the API
# (and thus are not wrapped), so we have to kludge things.
# See etg/_stc.py for details.
t = stc.StyledTextCtrl(self.frame)
t.Cut
t.CanCut
t.DiscardEdits
t.GetDefaultStyle
t.GetNumberOfLines
t.GetStyle
t.IsModified
t.HitTest
t.AppendText
t.WriteText
t.ChangeValue