Remove a workaround for an old pygtk bug

The bug was documented as a "focus bug in pygtk" on nested Gtk.MenuItem
objects. The workaround was to switch the signal handler from "activate"
to "button-release-event". This was done in Mar 2012 and pygtk is no
longer supported upstream. I reverted the workaround and noticed no
issues during testing.

This allows all MenuItem callbacks to share a common interface and
should allow keyboard control of sub-menus.
This commit is contained in:
Yclept Nemo 2023-07-19 18:18:27 -04:00
parent 2effc3fe8a
commit e74e30b875
2 changed files with 9 additions and 9 deletions

View File

@ -101,7 +101,7 @@ class LadiManagerGtk(LadiManager):
return True
return False
def studio_configure(self, item, event, module):
def studio_configure(self, item, module):
LadiManager.launcher_exec(self, command=['%s' % self._launcher_which('ladi-control-center') , '-m', module])
def on_about(self, *args, **kwargs):

View File

@ -80,18 +80,18 @@ class LadiMenu(LadiManagerGtk):
item = Gtk.MenuItem(_("JACK engine"))
item.show()
menu.append(item)
item.connect("button-release-event", function, "engine")
item.connect("activate", function, "engine")
# 'params' item
item = Gtk.MenuItem(_('JACK "%s" driver') % jack.get_selected_driver())
item.show()
menu.append(item)
item.connect("button-release-event", function, "params")
item.connect("activate", function, "params")
for internal in jack.read_container(['internals']):
module = str(internal)
item = Gtk.MenuItem(_('JACK "%s"') % module)
item.show()
menu.append(item)
item.connect("button-release-event", function, module)
item.connect("activate", function, module)
except Exception as err:
sys.stderr.write(str(err))
sys.stderr.flush()
@ -109,7 +109,7 @@ class LadiMenu(LadiManagerGtk):
item = Gtk.MenuItem(studio)
item.show()
menu.append(item)
item.connect("button-release-event", function, studio) # "activate" is not used because of focus bug in pygtk
item.connect("activate", function, studio)
except Exception as e:
self.menu_clear(menu)
item = Gtk.MenuItem(_("Error obtaining studio list"))
@ -195,11 +195,11 @@ class LadiMenu(LadiManagerGtk):
menu.show_all()
return menu
def studio_load(self, item, event, studio):
LadiManagerGtk.studio_load(self, item=item, event=event, studio=studio)
def studio_load(self, item, studio):
LadiManagerGtk.studio_load(self, item=item, studio=studio)
def studio_delete(self, item, event, studio):
LadiManagerGtk.studio_delete(self, item=item, event=event, studio=studio)
def studio_delete(self, item, studio):
LadiManagerGtk.studio_delete(self, item=item, studio=studio)
def menu_activate(self):
menu = self.create_menu()