From 7dc46e9d9e48e83326f6dcd59e179cf8f3f46873 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 2 May 2007 06:12:06 +0000 Subject: [PATCH] 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 --- wxPython/wx/tools/pywxrc.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/wxPython/wx/tools/pywxrc.py b/wxPython/wx/tools/pywxrc.py index 9093b2e125..459a07674a 100644 --- a/wxPython/wx/tools/pywxrc.py +++ b/wxPython/wx/tools/pywxrc.py @@ -89,12 +89,19 @@ class xrc%(windowName)s(wx.%(windowClass)s): pre.thisown = 0 if hasattr(self, '_setOORInfo'): 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 +""" + CREATE_MENUITEM_VAR = """\ self.%(widgetName)s = self.FindItemById(xrc.XRCID(\"%(widgetName)s\")) """ @@ -227,7 +234,9 @@ class XmlResourceCompiler: windowClass = re.sub("^wx", "", windowClass) 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()) else: outputList.append(self.templates.CLASS_HEADER % locals())