FIx the %Extract used in the wxListWrapper and wxArrayWrapper templates to include the module name

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@69136 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2011-09-18 04:40:55 +00:00
parent 462c8b7932
commit 91a404fd22
9 changed files with 23 additions and 16 deletions

View File

@@ -66,7 +66,7 @@ def run():
c.find('InitStandardHandlers').ignore()
module.find('wxBitmapHandler').ignore()
#module.addItem(tools.wxListWrapperTemplate('wxList', 'wxBitmapHandler'))
#module.addItem(tools.wxListWrapperTemplate('wxList', 'wxBitmapHandler', module))
# TODO: The ctors and methods from Classic for converting to/from
# buffer objects with raw bitmap access.

View File

@@ -63,7 +63,7 @@ def run():
tools.fixWindowClass(c)
module.addItem(tools.wxArrayWrapperTemplate('wxDataViewItemArray', 'wxDataViewItem'))
module.addItem(tools.wxArrayWrapperTemplate('wxDataViewItemArray', 'wxDataViewItem', module))
#-----------------------------------------------------------------
tools.doCommonTweaks(module)

View File

@@ -301,7 +301,7 @@ def run():
""")
c.addPyCode('RealPoint.__safe_for_unpickling__ = True')
module.addItem(tools.wxListWrapperTemplate('wxPointList', 'wxPoint'))
module.addItem(tools.wxListWrapperTemplate('wxPointList', 'wxPoint', module))
c = module.find('wxColourDatabase')
c.addPyMethod('FindColour', '(self, colour)', 'return self.Find(colour)')

View File

@@ -72,7 +72,7 @@ def run():
c.find('FindItem.menu').out = True
tools.removeVirtuals(c)
module.addItem(tools.wxListWrapperTemplate('wxMenuList', 'wxMenu'))
module.addItem(tools.wxListWrapperTemplate('wxMenuList', 'wxMenu', module))
#-----------------------------------------------------------------
tools.doCommonTweaks(module)

View File

@@ -45,7 +45,7 @@ def run():
c.find('SetMarginWidth').ignore()
c.find('GetTextColour').ignore()
c.find('SetTextColour').ignore()
module.addItem(tools.wxListWrapperTemplate('wxMenuItemList', 'wxMenuItem'))
module.addItem(tools.wxListWrapperTemplate('wxMenuItemList', 'wxMenuItem', module))

View File

@@ -64,8 +64,8 @@ def run():
module.find('wxLIGHT_GREY_PEN').ignore()
module.find('wxThePenList').ignore()
#module.addItem(tools.wxListWrapperTemplate('wxBrushList', 'wxBrush'))
#module.addItem(tools.wxListWrapperTemplate('wxPenList', 'wxPen'))
#module.addItem(tools.wxListWrapperTemplate('wxBrushList', 'wxBrush', module))
#module.addItem(tools.wxListWrapperTemplate('wxPenList', 'wxPen', module))

View File

@@ -33,6 +33,10 @@ def run():
module = etgtools.ModuleDef(PACKAGE, MODULE, NAME, DOCSTRING)
etgtools.parseDoxyXML(module, ITEMS)
#-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings.
c = module.find('wxSizer')
for func in c.findAll('Add') + c.findAll('Insert') + c.findAll('Prepend'):
sizer = func.findItem('sizer')
@@ -69,10 +73,8 @@ def run():
module.addPyCode("PySizer = wx.deprecated(Sizer)")
module.addItem(tools.wxListWrapperTemplate('wxSizerItemList', 'wxSizerItem'))
#-----------------------------------------------------------------
# Tweak the parsed meta objects in the module object as needed for
# customizing the generated code and docstrings.
module.addItem(tools.wxListWrapperTemplate('wxSizerItemList', 'wxSizerItem', module))
#-----------------------------------------------------------------
tools.doCommonTweaks(module)

View File

@@ -258,11 +258,12 @@ def run():
# Add a wrapper for wxWindowList and a new iterator class for it that
# makes wxWindowList quack like a read-only Python sequence.
module.addItem(tools.wxListWrapperTemplate('wxWindowList', 'wxWindow'))
module.addItem(tools.wxListWrapperTemplate('wxWindowList', 'wxWindow', module))
module.addCppFunction('wxWindowList*', 'GetTopLevelWindows', '()',
briefDoc="Returns a list-like object of the the application's top-level windows, (frames,dialogs, etc.)",
body="return &wxTopLevelWindows;")
module.addPyCode("PyWindow = wx.deprecated(Window)")
module.addPyCode("Window.SetSizeWH = wx.deprecated(Window.SetSizeWH)")

View File

@@ -480,10 +480,11 @@ def convertFourDoublesTemplate(CLASS):
# Templates for creating wrappers for type-specific wxList and wxArray classes
def wxListWrapperTemplate(ListClass, ItemClass, RealItemClass=None):
def wxListWrapperTemplate(ListClass, ItemClass, module, RealItemClass=None):
if RealItemClass is None:
RealItemClass = ItemClass
moduleName = module.module
ListClass_pyName = removeWxPrefix(ListClass)
# *** TODO: This can probably be done in a way that is not SIP-specfic.
@@ -568,7 +569,7 @@ public:
%End
}};
%Extract(id=pycode)
%Extract(id=pycode{moduleName})
def _{ListClass_pyName}___repr__(self):
return "{ListClass_pyName}: " + repr(list(self))
{ListClass_pyName}.__repr__ = _{ListClass_pyName}___repr__
@@ -576,10 +577,13 @@ del _{ListClass_pyName}___repr__
%End
'''.format(**locals()))
def wxArrayWrapperTemplate(ArrayClass, ItemClass, RealItemClass=None):
def wxArrayWrapperTemplate(ArrayClass, ItemClass, module, RealItemClass=None):
if RealItemClass is None:
RealItemClass = ItemClass
moduleName = module.module
ArrayClass_pyName = removeWxPrefix(ArrayClass)
# *** TODO: This can probably be done in a way that is not SIP-specfic.
@@ -628,7 +632,7 @@ public:
%End
}};
%Extract(id=pycode)
%Extract(id=pycode{moduleName})
def _{ArrayClass_pyName}___repr__(self):
return "{ArrayClass_pyName}: " + repr(list(self))
{ArrayClass_pyName}.__repr__ = _{ArrayClass_pyName}___repr__