Hi there,

here's the problem: I have an app with a menubar and a popup-menu.
Certain submenus of the popup-menu and the menu-bar are similar, so I
decided to build this submenu only once using ItemFactory and attach it
to the appropriate MenuItems upon startup, but it doesn't work. Here's a
code sample:

def __setupMenus(self):
        menu = self.get_widget('edit_menu') # gtk.MenuItem
        factory = self.__makeEditSubmenu()  # gtk.ItemFacory
        submenu = factory.get_widget('<main>') # gtk.Menu
        submenu.show_all()
        menu.set_submenu(submenu)

I get no warnings or errors when I run this piece of code, but I don't
see any submenu entries if I activate the edit MenuItem. If I create the
submenu the "hard" way, everything works just fine:

def __setupMenus(self):
        menu = self.get_widget('edit_menu')
        submenu = gtk.Menu()
        item = gtk.MenuItem('foo')
        submenu.add(item)
        submenu.show_all()
        menu.set_submenu(submenu)

If I `print submenu` at the bottom of the method, I get the same
__repr__ for both, the gtk.Menu and the one generated by ItemFactory.
I also tried to submenu.reparent(menu), but that gave me a bunch of
assertion errors, so I guess it's not the right way either...

What's wrong here?

TIA,
Igor
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to