(self, main_action_id, ids, widget)
return b
Creates an :obj:`.OWButton` with a popup-menu and adds it to the parent ``widget``.
Creates an :obj:`.OWButton` with a popup-menu and adds it to the parent ``widget``.
Creates an : obj : . OWButton with a popup - menu and adds it to the parent widget .
def menu_button(self, main_action_id, ids, widget):
        '''
            Creates an :obj:`.OWButton` with a popup-menu and adds it to the parent ``widget``.
        '''
        id, _, attr_name, attr_value, callback, icon_name = self._expand_id(main_action_id)
        b = OWButton(parent=widget)
        m = QMenu(b)
        b.setMenu(m)
        b._actions = {}

        m.triggered[QAction].connect(b.setDefaultAction)

        if main_action_id:
            main_action = OWAction(self._plot, icon_name, attr_name, attr_value, callback,
                                   parent=b)
            m.triggered.connect(main_action.trigger)

        for id in ids:
            id, _, attr_name, attr_value, callback, icon_name = self._expand_id(id)
            a = OWAction(self._plot, icon_name, attr_name, attr_value, callback, parent=m)
            m.addAction(a)
            b._actions[id] = a

        if m.actions():
            b.setDefaultAction(m.actions()[0])
        elif main_action_id:
            b.setDefaultAction(main_action)


        b.setPopupMode(QToolButton.MenuButtonPopup)
        b.setMinimumSize(40, 30)
        return b
def menu_button ( self , main_action_id , ids , widget ) : id , _ , attr_name , attr_value , callback , icon_name = self . _expand_id ( main_action_id ) b = OWButton ( parent = widget ) m = QMenu ( b ) b . setMenu ( m ) b . _actions = { } m . triggered [ QAction ] . connect ( b . setDefaultAction ) if main_action_id : main_action = OWAction ( self . _plot , icon_name , attr_name , attr_value , callback , parent = b ) m . triggered . connect ( main_action . trigger ) for id in ids : id , _ , attr_name , attr_value , callback , icon_name = self . _expand_id ( id ) a = OWAction ( self . _plot , icon_name , attr_name , attr_value , callback , parent = m ) m . addAction ( a ) b . _actions [ id ] = a if m . actions ( ) : b . setDefaultAction ( m . actions ( ) [ 0 ] ) elif main_action_id : b . setDefaultAction ( main_action ) b . setPopupMode ( QToolButton . MenuButtonPopup ) b . setMinimumSize ( 40 , 30 ) return b