]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/wx/tools/pywxrc.py
use wxString in wxFileSystem::FindFileInPath()
[wxWidgets.git] / wxPython / wx / tools / pywxrc.py
index f26fb00f4f20924be58ea8e3dc5d1235abac5386..459a07674a9e6c1a26f0f24e7ade6fb9975cab31 100644 (file)
@@ -56,7 +56,7 @@ def get_resources():
 
     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
@@ -66,8 +66,8 @@ class xrc%(windowName)s(wx.%(windowClass)s):
     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
@@ -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 == "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())