(cls, widget, master, button_label, set_attr_callback)
return vizrank, button
Equip the widget with VizRank button and dialog, and monkey patch the
        widget's `closeEvent` and `hideEvent` to close/hide the vizrank, too.

        Args:
            widget (QWidget): the widget into whose layout to insert the button
            master (Orange.widgets.widget.OWWidget): the master widget
            button_label: the label for the button
            set_attr_callback: the callback for setting the projection chosen
                in the vizrank

        Returns:
            tuple with Vizrank dialog instance and push button
Equip the widget with VizRank button and dialog, and monkey patch the
        widget's `closeEvent` and `hideEvent` to close/hide the vizrank, too.
Equip the widget with VizRank button and dialog and monkey patch the widget s closeEvent and hideEvent to close / hide the vizrank too .
def add_vizrank(cls, widget, master, button_label, set_attr_callback):
        """
        Equip the widget with VizRank button and dialog, and monkey patch the
        widget's `closeEvent` and `hideEvent` to close/hide the vizrank, too.

        Args:
            widget (QWidget): the widget into whose layout to insert the button
            master (Orange.widgets.widget.OWWidget): the master widget
            button_label: the label for the button
            set_attr_callback: the callback for setting the projection chosen
                in the vizrank

        Returns:
            tuple with Vizrank dialog instance and push button
        """
        # Monkey patching could be avoided by mixing-in the class (not
        # necessarily a good idea since we can make a mess of multiple
        # defined/derived closeEvent and hideEvent methods). Furthermore,
        # per-class patching would be better than per-instance, but we don't
        # want to mess with meta-classes either.

        vizrank = cls(master)
        button = gui.button(
            widget, master, button_label, callback=vizrank.reshow,
            enabled=False)
        vizrank.selectionChanged.connect(lambda args: set_attr_callback(*args))

        master_close_event = master.closeEvent
        master_hide_event = master.hideEvent
        master_delete_event = master.onDeleteWidget

        def closeEvent(event):
            vizrank.close()
            master_close_event(event)

        def hideEvent(event):
            vizrank.hide()
            master_hide_event(event)

        def deleteEvent():
            vizrank.keep_running = False
            vizrank.shutdown()
            master_delete_event()

        master.closeEvent = closeEvent
        master.hideEvent = hideEvent
        master.onDeleteWidget = deleteEvent
        return vizrank, button
def add_vizrank ( cls , widget , master , button_label , set_attr_callback ) : # Monkey patching could be avoided by mixing-in the class (not # necessarily a good idea since we can make a mess of multiple # defined/derived closeEvent and hideEvent methods). Furthermore, # per-class patching would be better than per-instance, but we don't # want to mess with meta-classes either. vizrank = cls ( master ) button = gui . button ( widget , master , button_label , callback = vizrank . reshow , enabled = False ) vizrank . selectionChanged . connect ( lambda args : set_attr_callback ( * args ) ) master_close_event = master . closeEvent master_hide_event = master . hideEvent master_delete_event = master . onDeleteWidget def closeEvent ( event ) : vizrank . close ( ) master_close_event ( event ) def hideEvent ( event ) : vizrank . hide ( ) master_hide_event ( event ) def deleteEvent ( ) : vizrank . keep_running = False vizrank . shutdown ( ) master_delete_event ( ) master . closeEvent = closeEvent master . hideEvent = hideEvent master . onDeleteWidget = deleteEvent return vizrank , button