Menu critical error wxPython 2.8.1.1 Unicode on Ubuntu

Hello,

finally I could dulicate the bug, mentioned earlier a few days ago.

wxPython Unicode 2.8.1.1 on Ubuntu Edgy 6.10

To duplicate:
(first the submenu is created)
- choose: toggle submenu (submenu is empty)
- choose: toggle submenu (submenu is here again)
- choose: toggle submenu (submenu is empty) AND traceback:

Is that a bug?

Can I get this working using another approach?

If not: Is there any workaround in the meantime?

Big Problem is:
I get a segmentation fault in DrPython, when I quit the application,
  if this critical error is not produced during the run, then quit the
  application is ok (no segmenation fault)
  
In this sample, no segmentation fault happens, even if ther is the critical error befor (?).
How can I get this working?

Under Windows Xp, it is ok (wxPython 2.8.1.1 Unicode)

I would be grateful, please help! :slight_smile:

# Small Sample shows a bug (?) in wxPython 2.8.1.1 Unicode on Gtk (Ubuntu Edgy 6.10
# Franz Steinhaeusler, 11.02.2007:
# usage:
# first the submenu is created
# toggle submenu (submenu is empty)
# toggle submenu (submenu is here again)
# toggle submenu (submenu is empty) AND traceback:

···

#
#>python -u "Menu_Sample_Remove.py"
#GTK Accessibility Module initialized
#
#** (python:7724): CRITICAL **: gail_menu_item_ref_child: assertion `(i >= 0)' failed
#
#=====================================================================================
#

import wx

class MyFrame(wx.Frame):

    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, title=title)

        menuBar = wx.MenuBar()
        menu1 = wx.Menu()

        item = wx.MenuItem(menu1, 500, "&Item Check", "", wx.ITEM_CHECK)
        item.SetBitmaps(wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE, wx.ART_TOOLBAR, (16,16)),
            wx.ArtProvider.GetBitmap(wx.ART_FOLDER, wx.ART_TOOLBAR, (16,16)))
        menu1.AppendItem(item)

        self.submenu = wx.Menu()
        item = wx.MenuItem (menu1, 501, "Sub", "", subMenu = self.submenu)
        item.SetBitmap(wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE, wx.ART_TOOLBAR, (16,16)))

        menu1.AppendItem (item)
        item = wx.MenuItem(menu1, 502, "&Toggle Submenu", "", wx.ITEM_CHECK)
        menu1.AppendItem (item)
        menuBar.Append(menu1, "&Fun")
        self.Bind(wx.EVT_MENU, self.OnMenuSelect, id=502)
        self.OnMenuSelect(None)
        self.SetMenuBar(menuBar)

    def OnMenuSelect(self, event):
        mnuitems = self.submenu.GetMenuItems()
        num = len(mnuitems)
        x = 0
        if num == 0:
            self.submenu.Append(700, "test1")
            self.submenu.Append(701, "test2")
        else:
            while (x < num):
                self.submenu.Remove(700+x)
                x = x + 1
        
app = wx.App(0)
win = MyFrame(None, title="Small Menu Sample, wxPython Version: " + wx.VERSION_STRING + " " +\
  ["ansi", "unicode"] [wx.USE_UNICODE])
win.Show()
app.MainLoop()

--
Franz Steinhaeusler

Hi,

I use the same Ubuntu box and I run your code with no errors.

Mi configuracion/My config:

Ubuntu Edgy Eft 6.10
Linux Kernel 2.6.17-11-386
Gnome 2.16.1
Python 2.4.4c1
wxPython 2.8.1.1 Unicode
Python IDE: Ulipad 3.6

···

El dom, 11-02-2007 a las 10:45 +0100, Franz Steinhäusler escribió:

Hello,

finally I could dulicate the bug, mentioned earlier a few days ago.

--
Saludos / Best regards

Mario Lacunza Vásquez
Desarrollador de Software - Webmaster
Linux Registered User #439179
Desarrollador 2 Estrellas VS2005

Website : http://mlacunzav[DOT]cogia[DOT]net
Email : mlacunza[AT]gmail.com / mario_lacunza[AT]yahoo.es
Blog : http://mlacunza.blogspot.com
Lima - Peru

Hm, strange, thanks.

I hope, someone else will have this error. :slight_smile:

···

On Sun, 11 Feb 2007 10:28:21 -0500, Mario Lacunza <mlacunza@gmail.com> wrote:

El dom, 11-02-2007 a las 10:45 +0100, Franz Steinhäusler escribió:

Hello,

finally I could dulicate the bug, mentioned earlier a few days ago.

Hi,

I use the same Ubuntu box and I run your code with no errors.

Mi configuracion/My config:

Ubuntu Edgy Eft 6.10
Linux Kernel 2.6.17-11-386
Gnome 2.16.1
Python 2.4.4c1
wxPython 2.8.1.1 Unicode
Python IDE: Ulipad 3.6

--
Franz Steinhaeusler

This works for me as well, though I did have to comment out the
SetBitMap for the first menu item I got "in GtkAppend(): only normal
menu items can have bitmaps" but after I did that everything worked
fine

Python: 2.4.2 (#2, Mar 4 2006, 02:19:37)
[GCC 3.3.1 (Mandrake Linux 9.2 3.3.1-2mdk)]
wxPython Version: 2.8.1.1
Platform: Linux-2.6.16.27.tex1.lve-i686-Mobile_AMD_Sempron-tm-_Processor_3000+-with-mandrake-2006-Texstar

Hm,

could it be that I thave another library libgail or so?

How can I discover the version of the library then?
How to update it?

···

--

Franz Steinhaeusler

I'm not good informed or in other words an ubuntu newbie.
  
  I (re) isntalled following modules, but no chance:
    libgail-gnome-module_1.1.3-2ubuntu2_i386.deb
    libgail18_1.9.3-0ubuntu1_i386.deb
    libgail-common_1.9.3-0ubuntu1_i386.deb
    
  I tried another sample (without submenu, but still the same).
  
# Small Sample shows a bug (?) in wxPython 2.8.1.1 Unicode on Gtk (Ubuntu Edgy 6.10
# Franz Steinhaeusler, 11.02.2007:
# usage:
# first the submenu is created
# toggle submenu (submenu is empty)
# toggle submenu (submenu is here again)
# toggle submenu (submenu is empty) AND traceback:

···

#
#>python -u "Menu_Sample_Remove.py"
#GTK Accessibility Module initialized
#
#** (python:7724): CRITICAL **: gail_menu_item_ref_child: assertion `(i >= 0)' failed
#
#=====================================================================================
#

import wx

class MyFrame(wx.Frame):

    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, title=title)

        menuBar = wx.MenuBar()
        self.menu1 = wx.Menu()

        item = wx.MenuItem(self.menu1, 500, "&Toggle Menu", "", wx.ITEM_CHECK)
        self.menu1.AppendItem(item)

        self.showfull = False
        menuBar.Append(self.menu1, "&Test Toggle Menu")
        self.Bind(wx.EVT_MENU, self.OnMenuSelect, id=500)
        self.OnMenuSelect(None)
        self.SetMenuBar(menuBar)

    def OnMenuSelect(self, event):
        mnuitems = self.menu1.GetMenuItems()
        num = len(mnuitems)
        x = 0
        if not self.showfull:
            self.showfull = True
            self.menu1.Append(700, "test1")
            self.menu1.Append(701, "test2")
        else:
            self.showfull = False
            self.menu1.Delete (700)
            self.menu1.Delete (701)

app = wx.App(0)
win = MyFrame(None, title="Small Menu Sample, wxPython Version: " + wx.VERSION_STRING + " " +\
  ["ansi", "unicode"] [wx.USE_UNICODE])
win.Show()
app.MainLoop()

--
Franz Steinhaeusler

Franz Steinhäusler wrote:

Hello,

finally I could dulicate the bug, mentioned earlier a few days ago.

wxPython Unicode 2.8.1.1 on Ubuntu Edgy 6.10

To duplicate:
(first the submenu is created)
- choose: toggle submenu (submenu is empty)
- choose: toggle submenu (submenu is here again)
- choose: toggle submenu (submenu is empty) AND traceback:

Is that a bug?

Works fine for me too.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Franz Steinhäusler wrote:

  I'm not good informed or in other words an ubuntu newbie.
    I (re) isntalled following modules, but no chance:
    libgail-gnome-module_1.1.3-2ubuntu2_i386.deb
    libgail18_1.9.3-0ubuntu1_i386.deb
    libgail-common_1.9.3-0ubuntu1_i386.deb

Does it make any difference if you remove them? Or are there too many dependencies from other packages to be able to remove them? It may be because I use KDE and not GNOME, but I don't have the libgail-gnome-module package installed...

Have you made any changes in the system configuration tools related to accessibility?

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Sorry for being so insistent,
  
I don't know, what could be wrong.

With google, I don't find an satisfying answer (If only this would bring me further)

Who knows a good place (forum, newsgroup) to ask that (ubuntu/gnome developer/packager directly?).

The strange thing is that Dj Gilcrease and
Mario Lacunza have no problems with edgy ubuntu 2.8.1.1 unicode.
  
I could not deinstalle the modules, because many programs
are depending on them.

Has it to do with accesibility modules at all (gail)?
  
Screenshot of package manager

http://mitglied.lycos.de/drpython/pics/libgail_packages.png

(Even the libgail-dbg, I uninstalled afterwards)

···

On Mon, 12 Feb 2007 11:51:50 -0800, Robin Dunn <robin@alldunn.com> wrote:

Franz Steinhäusler wrote:

  I'm not good informed or in other words an ubuntu newbie.
  
  I (re) isntalled following modules, but no chance:
    libgail-gnome-module_1.1.3-2ubuntu2_i386.deb
    libgail18_1.9.3-0ubuntu1_i386.deb
    libgail-common_1.9.3-0ubuntu1_i386.deb

Does it make any difference if you remove them? Or are there too many
dependencies from other packages to be able to remove them? It may be
because I use KDE and not GNOME, but I don't have the
libgail-gnome-module package installed...

Have you made any changes in the system configuration tools related to
accessibility?

--
Franz Steinhaeusler