'Remove the OWWidget instance for node.'

def remove_widget_for_node(self, node):

    state = self.__initstate_for_node[node]
    if isinstance(state, WidgetManager.Delayed):
        del self.__initstate_for_node[node]
        self.__init_queue.remove(state)
    elif isinstance(state, WidgetManager.Materialized):
        node.properties = self._widget_settings(state.widget)
        self.__widgets.remove(state.widget)
        del self.__initstate_for_node[node]
        del self.__widget_for_node[node]
        del self.__node_for_widget[state.widget]
        node.title_changed.disconnect(state.widget.setCaption)
        state.widget.progressBarValueChanged.disconnect(node.set_progress)
        self.widget_for_node_removed.emit(node, state.widget)
        self._delete_widget(state.widget)
    elif isinstance(state, WidgetManager.PartiallyInitialized):
        widget = state.partially_initialized_widget
        raise RuntimeError("A    widget/node    {}    was    removed    while    being    initialized.    This    is    most    likely    a    result    of    an    explicit    QApplication.processEvents    call    from    the    '{}.{}'    widgets    __init__.\n".format(state.node.title, type(widget).__module__, type(widget).__init__))
