CLASS_HEADER = """\
class xrc%(windowName)s(wx.%(windowClass)s):
- def PreCreate(self):
+ def PreCreate(self, pre):
\"\"\" This function is called during the class's initialization.
Override it for custom setup before the window is created usually to
def __init__(self, parent):
# Two stage creation (see http://wiki.wxpython.org/index.cgi/TwoStageCreation)
pre = wx.Pre%(windowClass)s()
+ self.PreCreate(pre)
get_resources().LoadOn%(windowClass)s(pre, parent, "%(windowName)s")
- self.PreCreate()
self.PostCreate(pre)
# Define variables for the controls
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\"))
"""
windowClass = re.sub("^wx", "", windowClass)
windowName = topWindow.getAttribute("name")
- if windowClass == "Menu":
+ 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())