diff --git a/etg/property.py b/etg/property.py index f1f8e29d..c96ba012 100644 --- a/etg/property.py +++ b/etg/property.py @@ -42,9 +42,12 @@ def run(): # Tweak the parsed meta objects in the module object as needed for # customizing the generated code and docstrings. - c = module.find('wxPGAttributeStorage') + c = module.find('wxPGCellData') assert isinstance(c, etgtools.ClassDef) - + c.find('~wxPGCellData').ignore(False) + + + c = module.find('wxPGAttributeStorage') # TODO: Add methods to add a Python iterator using these methods c.find('StartIteration').ignore() c.find('GetNext').ignore() @@ -57,13 +60,89 @@ def run(): c = module.find('wxPGChoicesData') tools.ignoreConstOverloads(c) - + #c.addDtor() + c.find('~wxPGChoicesData').ignore(False) + c = module.find('wxPGChoices') c.find('wxPGChoices').findOverload('wxChar **').ignore() tools.ignoreConstOverloads(c) - - + + # Ignore some string constants (#defines) coming from dox, and add them + # back in Python code. They are wchar_t* values and this seened the + # simplest way to deal with them. + for name in [ 'wxPG_ATTR_DEFAULT_VALUE', + 'wxPG_ATTR_MIN', + 'wxPG_ATTR_MAX', + 'wxPG_ATTR_UNITS', + 'wxPG_ATTR_HINT', + 'wxPG_ATTR_INLINE_HELP', + 'wxPG_ATTR_AUTOCOMPLETE', + 'wxPG_BOOL_USE_CHECKBOX', + 'wxPG_BOOL_USE_DOUBLE_CLICK_CYCLING', + 'wxPG_FLOAT_PRECISION', + 'wxPG_STRING_PASSWORD', + 'wxPG_UINT_BASE', + 'wxPG_UINT_PREFIX', + 'wxPG_FILE_WILDCARD', + 'wxPG_FILE_SHOW_FULL_PATH', + 'wxPG_FILE_SHOW_RELATIVE_PATH', + 'wxPG_FILE_INITIAL_PATH', + 'wxPG_FILE_DIALOG_TITLE', + 'wxPG_FILE_DIALOG_STYLE', + 'wxPG_DIR_DIALOG_MESSAGE', + 'wxPG_ARRAY_DELIMITER', + 'wxPG_DATE_FORMAT', + 'wxPG_DATE_PICKER_STYLE', + 'wxPG_ATTR_SPINCTRL_STEP', + 'wxPG_ATTR_SPINCTRL_WRAP', + 'wxPG_ATTR_SPINCTRL_MOTIONSPIN', + 'wxPG_ATTR_MULTICHOICE_USERSTRINGMODE', + 'wxPG_COLOUR_ALLOW_CUSTOM', + 'wxPG_COLOUR_HAS_ALPHA', + + # and some other #defines with similar issues + 'wxNullProperty', + 'wxPGChoicesEmptyData', + ]: + module.find(name).ignore() + + module.addPyCode("""\ + PG_ATTR_DEFAULT_VALUE = u"DefaultValue" + PG_ATTR_MIN = u"Min" + PG_ATTR_MAX = u"Max" + PG_ATTR_UNITS = u"Units" + PG_ATTR_HINT = u"Hint" + PG_ATTR_INLINE_HELP = u"InlineHelp" + PG_ATTR_AUTOCOMPLETE = u"AutoComplete" + PG_BOOL_USE_CHECKBOX = u"UseCheckbox" + PG_BOOL_USE_DOUBLE_CLICK_CYCLING = u"UseDClickCycling" + PG_FLOAT_PRECISION = u"Precision" + PG_STRING_PASSWORD = u"Password" + PG_UINT_BASE = u"Base" + PG_UINT_PREFIX = u"Prefix" + PG_FILE_WILDCARD = u"Wildcard" + PG_FILE_SHOW_FULL_PATH = u"ShowFullPath" + PG_FILE_SHOW_RELATIVE_PATH = u"ShowRelativePath" + PG_FILE_INITIAL_PATH = u"InitialPath" + PG_FILE_DIALOG_TITLE = u"DialogTitle" + PG_FILE_DIALOG_STYLE = u"DialogStyle" + PG_DIR_DIALOG_MESSAGE = u"DialogMessage" + PG_ARRAY_DELIMITER = u"Delimiter" + PG_DATE_FORMAT = u"DateFormat" + PG_DATE_PICKER_STYLE = u"PickerStyle" + PG_ATTR_SPINCTRL_STEP = u"Step" + PG_ATTR_SPINCTRL_WRAP = u"Wrap" + PG_ATTR_SPINCTRL_MOTIONSPIN = u"MotionSpin" + PG_ATTR_MULTICHOICE_USERSTRINGMODE= u"UserStringMode" + PG_COLOUR_ALLOW_CUSTOM = u"AllowCustom" + PG_COLOUR_HAS_ALPHA = u"HasAlpha" + + NullProperty = None + PGChoicesEmptyData = None + """) + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) diff --git a/etg/propgrid.py b/etg/propgrid.py index 659024a8..63bf9c0e 100644 --- a/etg/propgrid.py +++ b/etg/propgrid.py @@ -48,6 +48,12 @@ def run(): module.find('wxPGSortCallback').ignore() + # See note in propgridiface.py + for item in module.allItems(): + if hasattr(item, 'type') and item.type == 'wxPGPropArg': + item.type = 'const wxPGPropArgCls &' + + #----------------------------------------------------------------- tools.doCommonTweaks(module) diff --git a/etg/propgrideditors.py b/etg/propgrideditors.py index 88f88481..d76a15c3 100644 --- a/etg/propgrideditors.py +++ b/etg/propgrideditors.py @@ -24,7 +24,7 @@ ITEMS = [ 'wxPGWindowList', 'wxPGComboBoxEditor', 'wxPGChoiceAndButtonEditor', 'wxPGTextCtrlAndButtonEditor', - 'wxPGCheckBoxEditor', + #'wxPGCheckBoxEditor', This needs #define wxPG_INCLUDE_CHECKBOX 1 'wxPGEditorDialogAdapter', 'wxPGMultiButton', ] diff --git a/etg/propgridiface.py b/etg/propgridiface.py index cf360f96..d0025086 100644 --- a/etg/propgridiface.py +++ b/etg/propgridiface.py @@ -52,6 +52,16 @@ def run(): tools.wxArrayPtrWrapperTemplate('wxArrayPGProperty', 'wxPGProperty', module)) + # wxPGPropArg is a typedef for "const wxPGPropArgCls&" so having the + # wrappers treat it as a normal type can be problematic. ("new cannot be + # applied to a reference type", etc.) Let's just ignore it an replace it + # everywhere for the real type. + module.find('wxPGPropArg').ignore() + for item in module.allItems(): + if hasattr(item, 'type') and item.type == 'wxPGPropArg': + item.type = 'const wxPGPropArgCls &' + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module) diff --git a/etg/propgridpagestate.py b/etg/propgridpagestate.py index 99599379..33ac346b 100644 --- a/etg/propgridpagestate.py +++ b/etg/propgridpagestate.py @@ -49,6 +49,9 @@ def run(): tools.ignoreConstOverloads(c) + module.find('wxPG_IT_CHILDREN').ignore() + + #----------------------------------------------------------------- tools.doCommonTweaks(module) tools.runGenerators(module)