mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-09 13:30:08 +01:00
Merge pull request #838 from RobinD42/fix-issue836
Copy MethodDefs for Start and GetNext from base class
This commit is contained in:
@@ -32,13 +32,16 @@ def run():
|
||||
# Tweak the parsed meta objects in the module object as needed for
|
||||
# customizing the generated code and docstrings.
|
||||
|
||||
c = module.find('wxTextCompleter')
|
||||
c = tc = module.find('wxTextCompleter')
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
c.addPrivateCopyCtor()
|
||||
c.addDefaultCtor(prot='public')
|
||||
|
||||
c = module.find('wxTextCompleterSimple')
|
||||
c.addDefaultCtor(prot='public')
|
||||
c.copyFromClass(tc, 'Start')
|
||||
c.copyFromClass(tc, 'GetNext')
|
||||
|
||||
# TODO: Change GetCompletions to return the wxArrayString instead of
|
||||
# passing it as a parameter?
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import sys
|
||||
import os
|
||||
import pprint
|
||||
import xml.etree.ElementTree as et
|
||||
import copy
|
||||
|
||||
from .tweaker_tools import FixWxPrefix, magicMethods, \
|
||||
guessTypeInt, guessTypeFloat, guessTypeStr, \
|
||||
@@ -1106,6 +1107,21 @@ private:
|
||||
self.mustHaveAppFlag = value
|
||||
|
||||
|
||||
def copyFromClass(self, klass, name):
|
||||
"""
|
||||
Copy an item from another class into this class. If it is a pure
|
||||
virtual method in the other class then assume that it has a concrete
|
||||
implementation in this class and change the flag.
|
||||
|
||||
Returns the new item.
|
||||
"""
|
||||
item = copy.deepcopy(klass.find(name))
|
||||
if isinstance(item, MethodDef) and item.isPureVirtual:
|
||||
item.isPureVirtual = False
|
||||
self.addItem(item)
|
||||
return item
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class EnumDef(BaseDef):
|
||||
|
||||
@@ -22,6 +22,7 @@ class testcompleter_Tests(wtc.WidgetTestCase):
|
||||
t = wx.TextCtrl(self.frame)
|
||||
t.AutoComplete(MyTextCompleter())
|
||||
|
||||
|
||||
def test_textCompleterSimple(self):
|
||||
class MyTextCompleterSimple(wx.TextCompleterSimple):
|
||||
def __init__(self):
|
||||
|
||||
Reference in New Issue
Block a user