I am following Isaac Sim tutorials to setup my own extension. Upon starting my extension, I setup new menu items, which I remove when the extension is shut down. For this, I use remove_menu_items. It may happen that after removing items, the menu is empty. In this case, I want to remove the whole menu.
I am missing a function to show the list of menu items so I can decide whether to delete the menu. I am also missing a function to delete the menu itself and refresh the menu.
Right now I am using private functions to achieve this:
def on_shutdown(self):
remove_menu_items(self._menu_items, "DSD")
self._menu_items = None
instance = get_instance()
if len(instance._menu_defs['DSD']) == 0:
print("Deleting DSD menu")
del instance._menu_defs['DSD']
instance.rebuild_menus()
print("Shutdown")