pywxrc generates wrong python code.

In wxPython v2.8.3:
I use xrcedit to create a main menu, and then use pywxrc script to
generate .py code. As below for menu part:

···

========
class xrcMAINMENU(wx.MenuBar):
    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
        set additional window styles using SetWindowStyle() and
SetExtraStyle()."""
        pass

    def __init__(self, parent):
        # Two stage creation (see
http://wiki.wxpython.org/index.cgi/TwoStageCreation)
        pre = wx.PreMenuBar() #!!!!!!ERROR!!!!!
        self.PreCreate(pre)
        get_resources().LoadOnMenuBar(pre, parent, "MAINMENU")
        self.PostCreate(pre)

        # Define variables for the controls
        self.IDM_CONNECT = self.FindItemById(xrc.XRCID("IDM_CONNECT"))

But wx module does not have a function named PreMenuBar(). What should
I do? Is this a bug?
Thank you.

ShenLei

Hi, I have patched the pywxrc script. Now it can generates correct
code for "MenuBar" and "Menu".

Please see the attachment.

I am trying to submit this patch to wxPython project. But I'm not
familiar with the wxPython.sourceforge patching system.... Anyway, let
me try it. :slight_smile:

Hope this patch can help you.

ShenLei

pywxrc.py (19.7 KB)

I made a slight improvement for code flow in pywxrc. It behaves
identical with my previous version, but with a more logical form for
"MenuBar" and "MenuItem". Please see the attachment.

I have submitted the patch (No. 1710943) to sourceforge.wxPython. But
it seems that the patch list is almost not in use for a very long time
(last updated in 2006-10-27). Is there any other place to sumbit
patchs to wxPython? Please help me to merge this fixed pywxrc.

Thank you.

pywxrc.py (19.7 KB)

···

----
ShenLei