def prepare_destruction(self, recursive=True):
        """Prepares the model for destruction

        Recursively un-registers all observers and removes references to child models
        """
        self.destruction_signal.emit()
        try:
            self.unregister_observer(self)
        except KeyError:  # Might happen if the observer was already unregistered
            pass
        if recursive:

            if self.state_copy:
                self.state_copy.prepare_destruction(recursive)
                self.state_copy = None
            else:
                if self.state_copy_initialized:
                    logger.verbose("Multiple calls of prepare destruction for {0}".format(self))

            # The next lines are commented because not needed and create problems if used why it is an open to-do
            # for port in self.input_data_ports[:] + self.output_data_ports[:] + self.outcomes[:]:
            #     if port.core_element is not None:
            #         # TODO setting data ports None in a Library state cause gtkmvc3 attribute getter problems why?
            #         port.prepare_destruction()

        del self.input_data_ports[:]
        del self.output_data_ports[:]
        del self.outcomes[:]
        self.state = None
def prepare_destruction ( self , recursive = True ) : self . destruction_signal . emit ( ) try : self . unregister_observer ( self ) except KeyError : pass if recursive : if self . state_copy : self . state_copy . prepare_destruction ( recursive ) self . state_copy = None else : if self . state_copy_initialized : logger . verbose ( "Multiple calls of prepare destruction for {0}" . format ( self ) ) del self . input_data_ports [ : ] del self . output_data_ports [ : ] del self . outcomes [ : ] self . state = None
Prepares the model for destruction

        Recursively un-registers all observers and removes references to child models