Patch #1710943, Fix a bug in pywxrc script for "MenuBar" and "Menu"

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@45747 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2007-05-02 06:12:06 +00:00
parent 5ae04a0c4e
commit 7dc46e9d9e

View File

@@ -89,8 +89,15 @@ class xrc%(windowName)s(wx.%(windowClass)s):
pre.thisown = 0 pre.thisown = 0
if hasattr(self, '_setOORInfo'): if hasattr(self, '_setOORInfo'):
self._setOORInfo(self) self._setOORInfo(self)
if hasattr(self, '_setCallbackInfo'):
self._setCallbackInfo(self, self.__class__) # Define variables for the menu items
"""
MENUBAR_CLASS_HEADER = """\
class xrc%(windowName)s(wx.%(windowClass)s):
def __init__(self):
pre = get_resources().LoadMenuBar("%(windowName)s")
self.PostCreate(pre)
# Define variables for the menu items # Define variables for the menu items
""" """
@@ -227,7 +234,9 @@ class XmlResourceCompiler:
windowClass = re.sub("^wx", "", windowClass) windowClass = re.sub("^wx", "", windowClass)
windowName = topWindow.getAttribute("name") windowName = topWindow.getAttribute("name")
if windowClass in ["Menu", "MenuItem"]: if windowClass in ["MenuBar"]:
outputList.append(self.templates.MENUBAR_CLASS_HEADER % locals())
elif windowClass in ["Menu"]:
outputList.append(self.templates.MENU_CLASS_HEADER % locals()) outputList.append(self.templates.MENU_CLASS_HEADER % locals())
else: else:
outputList.append(self.templates.CLASS_HEADER % locals()) outputList.append(self.templates.CLASS_HEADER % locals())