diff --git a/etg/bitmap.py b/etg/bitmap.py index 3dcbc54a..b29c7c08 100644 --- a/etg/bitmap.py +++ b/etg/bitmap.py @@ -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. diff --git a/etg/dataview.py b/etg/dataview.py index eccd649f..5ca7b686 100644 --- a/etg/dataview.py +++ b/etg/dataview.py @@ -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) diff --git a/etg/gdicmn.py b/etg/gdicmn.py index b130d2bc..c68ee2b7 100644 --- a/etg/gdicmn.py +++ b/etg/gdicmn.py @@ -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)') diff --git a/etg/menu.py b/etg/menu.py index abf79e80..abdf4f8b 100644 --- a/etg/menu.py +++ b/etg/menu.py @@ -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) diff --git a/etg/menuitem.py b/etg/menuitem.py index b6f51a9d..1eb311b0 100644 --- a/etg/menuitem.py +++ b/etg/menuitem.py @@ -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)) diff --git a/etg/pen.py b/etg/pen.py index 37e1610d..dce87363 100644 --- a/etg/pen.py +++ b/etg/pen.py @@ -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)) diff --git a/etg/sizer.py b/etg/sizer.py index b66d0884..766f1a70 100644 --- a/etg/sizer.py +++ b/etg/sizer.py @@ -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) diff --git a/etg/window.py b/etg/window.py index 56729ece..eb40bbcd 100644 --- a/etg/window.py +++ b/etg/window.py @@ -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)") diff --git a/etgtools/tweaker_tools.py b/etgtools/tweaker_tools.py index 248a9c0d..0ff0d200 100644 --- a/etgtools/tweaker_tools.py +++ b/etgtools/tweaker_tools.py @@ -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__