mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-07 04:20:07 +01:00
Refactor tweaks into a tweaker_tools method, apply to wx.TextEntry, wx.ComboBox, and wx.RichTextCtrl
This commit is contained in:
@@ -36,6 +36,8 @@ def run():
|
||||
assert isinstance(c, etgtools.ClassDef)
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
tools.fixTextClipboardMethods(c)
|
||||
|
||||
c.find('wxComboBox').findOverload('wxString choices').ignore()
|
||||
c.find('wxComboBox').findOverload('wxArrayString').find('choices').default = 'wxArrayString()'
|
||||
c.find('wxComboBox').findOverload('wxArrayString').find('value').default = 'wxEmptyString'
|
||||
|
||||
@@ -75,10 +75,8 @@ def run():
|
||||
|
||||
c.find('SetListStyle.def').name = 'styleDef'
|
||||
c.find('ApplyStyle.def').name = 'styleDef'
|
||||
|
||||
for method in ("Cut", "Copy", "Paste", "Undo", "Redo"):
|
||||
c.find(method).isVirtual = True
|
||||
c.find("Can{}".format(method)).isVirtual = True
|
||||
|
||||
tools.fixTextClipboardMethods(c)
|
||||
|
||||
c.addPyMethod('GetDefaultStyle', '(self)', 'return self.GetDefaultStyleEx()',
|
||||
deprecated='Use GetDefaultStyleEx instead')
|
||||
|
||||
@@ -66,11 +66,6 @@ def parseAndTweakModule():
|
||||
|
||||
tools.fixWindowClass(c)
|
||||
|
||||
# Re-enable virtualness for (Can)Cut/Copy/Paste/Undo/Redo
|
||||
for method in ('Cut', 'Copy', 'Paste', 'Undo', 'Redo'):
|
||||
c.find(method).isVirtual = True
|
||||
c.find("Can{}".format(method)).isVirtual = True
|
||||
|
||||
c.addCppMethod('void', 'MacCheckSpelling', '(bool check)',
|
||||
doc="""\
|
||||
Turn on the native spell checking for the text widget on
|
||||
|
||||
@@ -47,6 +47,9 @@ def parseAndTweakModule():
|
||||
c.find('SetSelection.to').name = 'to_'
|
||||
c.find('AutoComplete').findOverload('wxTextCompleter').find('completer').transfer = True
|
||||
|
||||
# Re-enable virtualness for (Can)Cut/Copy/Paste/Undo/Redo
|
||||
tools.fixTextClipboardMethods(c)
|
||||
|
||||
return module
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
@@ -381,7 +381,16 @@ def fixRefCountedClass(klass):
|
||||
if isinstance(item, extractors.MethodDef) and item.isCtor:
|
||||
item.transfer = True
|
||||
|
||||
def fixTextClipboardMethods(klass):
|
||||
"""
|
||||
Adds virtual behavior to Copy/Cut/Paste/Undo/Redo methods, and their Can*
|
||||
counterparts, of the given class.
|
||||
|
||||
:param ClassDef klass: The class to modify.
|
||||
"""
|
||||
for method in ('Cut', 'Copy', 'Paste', 'Undo', 'Redo'):
|
||||
klass.find(method).isVirtual = True
|
||||
klass.find("Can{}".format(method)).isVirtual = True
|
||||
|
||||
def removeVirtuals(klass):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user