Ejemplo n.º 1
0
 def _addMenuItems(self, obj):
     """
     Registers any menu items that are specified by the
     featurelet's info.
     """
     info = self._info
     menu_id = self._menu_id
     supporter = IMenuSupporter(obj)
     menu_items = info.get('menu_items', tuple())
     for item_info in menu_items:
         supporter.addMenuItem(menu_id, item_info)
Ejemplo n.º 2
0
    def _removeMenuItems(self, obj, prior_info):
        """
        Removes any menu items that were registered with this
        supporter as a result of a prior installation of this
        featurelet.  Will not affect any menu items that were not
        installed by this featurelet.
        """
        prior_menu_items = prior_info.get('menu_items')
        if prior_menu_items is None:
            return

        menu_id = self._menu_id
        supporter = IMenuSupporter(obj)
        for item in prior_menu_items:
            supporter.removeMenuItem(menu_id, item.get('title'))