Пример #1
0
    def destroy(self):
        """W.destroy () -> None

        Destroys the widget and removes it from its event system.

        Causes the widget to destroy itself as well as its controls and
        removes all from the connected event manager and sprite groups
        using the sprite.kill() method.
        """
        if isinstance(self.parent, BaseWidget):
            raise AttributeError("widget still has a parent relationship")
        self.run_signal_handlers(SIG_DESTROYED)
        self.emit(SIG_DESTROYED, self)

        # Clear the associated controls.
        _pop = self._controls.pop
        while len(self._controls) > 0:
            control = _pop()
            control.parent = None
            control.destroy()
            del control
        del self._controls

        if self._indexable != None:
            index = self._indexable
            self._indexable = None
            index.remove_index(self)
        if self._manager != None:
            self._manager.remove_object(self)

        BaseObject.destroy(self)  # Clear BaseObject internals.
        self.kill()  # Clear Sprite
        #del self.parent
        del self._indexable
        del self._bg
        del self._style
        del self._image
        del self._rect
        del self._oldrect
        del self
Пример #2
0
    def destroy (self):
        """W.destroy () -> None

        Destroys the widget and removes it from its event system.

        Causes the widget to destroy itself as well as its controls and
        removes all from the connected event manager and sprite groups
        using the sprite.kill() method.
        """
        if isinstance (self.parent, BaseWidget):
            raise AttributeError ("widget still has a parent relationship")
        self.run_signal_handlers (SIG_DESTROYED)
        self.emit (SIG_DESTROYED, self)

        # Clear the associated controls.
        _pop = self._controls.pop
        while len (self._controls) > 0:
            control = _pop ()
            control.parent = None
            control.destroy ()
            del control
        del self._controls

        if self._indexable != None:
            index = self._indexable
            self._indexable = None
            index.remove_index (self)
        if self._manager != None:
            self._manager.remove_object (self)
        
        BaseObject.destroy (self) # Clear BaseObject internals.
        self.kill ()              # Clear Sprite
        #del self.parent
        del self._indexable
        del self._bg
        del self._style
        del self._image
        del self._rect
        del self._oldrect
        del self
Пример #3
0
    def destroy (self):
        """W.destroy () -> None

        Destroys the widget and removes it from its event system.

        Causes the widget to destroy itself as well as its controls and
        removes all from the connected event manager and sprite groups
        using the sprite.kill() method. If the event manager supports
        the Indexable interface, the widget will invoke the
        remove_index() of it.

        Note: This method only works as supposed using a render loop,
        which supports the Renderer class specification.
        """
        if self.parent:
            raise ValueError ("widget still has a parent relationship")
        
        # Clear the associated controls.
        _pop = self._controls.pop
        while len (self._controls) > 0:
            control = _pop ()
            control.parent = None
            control.destroy ()
            del control
        del self._controls

        if self.manager and isinstance (self.manager, Indexable):
            self.manager.remove_index (self)
        
        BaseObject.destroy (self) # Clear BaseObject internals.
        self.kill ()              # Clear Sprite
        del self.parent
        del self._style
        del self._image
        del self._rect
        del self