Ejemplo n.º 1
0
    def _find ( self, image_name ):
        """ Tries the find a current ImageLibraryItem matching the specified
            **image_name** and return it. Returns None if not found.
        """
        image = ImageLibrary.image_info( image_name )
        if image is not None:
            for item in self.items:
                if image is item.image:
                    return item

        return None
Ejemplo n.º 2
0
    def _find(self, image_name):
        """ Tries the find a current ImageLibraryItem matching the specified
            **image_name** and return it. Returns None if not found.
        """
        image = ImageLibrary.image_info(image_name)
        if image is not None:
            for item in self.items:
                if image is item.image:
                    return item

        return None
Ejemplo n.º 3
0
    def _image_names_modified ( self, object, name, removed, added ):
        """ Handles image names being added to or removed from the editor.
        """
        items = self.items

        # fixme: Remove this code if the problem in the TableEditor that allows
        # the same item to be in both the 'removed' and 'added' list is fixed:
        for name in [ name for name in removed if name in added ]:
            removed.remove( name )
            added.remove(   name )

        for image_name in added:
            item = self._find( image_name )
            if item is None:
                image = ImageLibrary.image_info( image_name )
                if image is not None:
                    items.append( self.item_class( image = image ) )

        for image_name in removed:
            item = self._find( image_name )
            if item is not None:
                items.remove( item )
Ejemplo n.º 4
0
    def _image_names_modified(self, object, name, removed, added):
        """ Handles image names being added to or removed from the editor.
        """
        items = self.items

        # fixme: Remove this code if the problem in the TableEditor that allows
        # the same item to be in both the 'removed' and 'added' list is fixed:
        for name in [name for name in removed if name in added]:
            removed.remove(name)
            added.remove(name)

        for image_name in added:
            item = self._find(image_name)
            if item is None:
                image = ImageLibrary.image_info(image_name)
                if image is not None:
                    items.append(self.item_class(image=image))

        for image_name in removed:
            item = self._find(image_name)
            if item is not None:
                items.remove(item)