def _menu_hide_stuff(self, menu):
"""
Hide the menu if it has no menu items, or all menu items are hidden.
"""
for sub in menu.get_children():
assert isinstance(sub, Gtk.MenuItem)
if sub.get_submenu():
self._menu_hide_stuff(sub.get_submenu())
if not [c for c in sub.get_submenu().get_children() if c.get_property('visible')]:
sub.hide()
评论列表
文章目录