def __init__(self, parent, menu, item, controller):

        self.item = item
        action = item.action

        # FIXME v3: This is a wx'ism and should be hidden in the toolkit code.
        self.control_id = None

        if action.image is None:
            self.control = menu.addAction(action.name, self._qt4_on_triggered,
                    action.accelerator)
        else:
            self.control = menu.addAction(action.image.create_icon(),
                    action.name, self._qt4_on_triggered, action.accelerator)
        menu.menu_items.append(self)

        self.control.setToolTip(action.tooltip)
        self.control.setWhatsThis(action.description)
        self.control.setEnabled(action.enabled)
        self.control.setVisible(action.visible)

        if getattr(action, 'menu_role', False):
            if action.menu_role == "About":
                self.control.setMenuRole(QtGui.QAction.AboutRole)
            elif action.menu_role == "Preferences":
                self.control.setMenuRole(QtGui.QAction.PreferencesRole)

        if action.style == 'toggle':
            self.control.setCheckable(True)
            self.control.setChecked(action.checked)
        elif action.style == 'radio':
            # Create an action group if it hasn't already been done.
            try:
                ag = item.parent._qt4_ag
            except AttributeError:
                ag = item.parent._qt4_ag = QtGui.QActionGroup(parent)

            self.control.setActionGroup(ag)

            self.control.setCheckable(True)
            self.control.setChecked(action.checked)

        # Listen for trait changes on the action (so that we can update its
        # enabled/disabled/checked state etc).
        action.on_trait_change(self._on_action_enabled_changed, 'enabled')
        action.on_trait_change(self._on_action_visible_changed, 'visible')
        action.on_trait_change(self._on_action_checked_changed, 'checked')
        action.on_trait_change(self._on_action_name_changed, 'name')
        action.on_trait_change(self._on_action_accelerator_changed,
                               'accelerator')

        # Detect if the control is destroyed.
        self.control.destroyed.connect(self._qt4_on_destroyed)

        if controller is not None:
            self.controller = controller
            controller.add_to_menu(self)
Returns the portbinding host_id for dvr service port.
dataset/ETHPy150Open enthought/pyface/pyface/ui/qt4/action/action_item.py/_MenuItem.__init__--crossover with--dataset/ETHPy150Open openstack/neutron/neutron/db/l3_dvr_db.py/L3_NAT_with_dvr_db_mixin._get_dvr_service_port_hostid