Package metapho :: Module metapho :: Class Tagger
[hide private]

Class Tagger

source code

object --+
         |
        Tagger
Known Subclasses:

Manages tags for images.

Instance Methods [hide private]
 
__init__(self)
tagger: an object to manage metapho image tags
source code
 
__repr__(self)
Returns a string summarizing all known images and tags, suitable for printing on stdout or pasting into a Tags file.
source code
 
rename_category(self, old, new) source code
 
write_tag_file(self)
Save the current set of tags to a Tags file chosen from the top-level directory used in the images we've seen.
source code
 
read_tags(self, dirname)
Read in tags from files named in the given directory, and tag images in the imagelist appropriately.
source code
 
process_tag(self, tagname, filenames)
After reading a tag from a tags file, add it to the global tags list if it isn't there already, and add the given filenames to it.
source code
 
add_tag(self, tag, img)
Add a tag to the given image.
source code
 
remove_tag(self, tag, img) source code
 
clear_tags(self, img) source code
 
toggle_tag(self, tagno, img)
Toggle tag number tagno for the given img.
source code
 
match_tag(self, pattern)
Return a list of tags matching the pattern.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]
  commondir
Current format supported: category Animals tag squirrels: img_001.jpg img_030.jpg tag horses: img_042.jpg tag penguins: img 008.jpg category Places tag New Mexico: img_020.jpg img_042.jpg tag Bruny Island: img 008.jpg
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

tagger: an object to manage metapho image tags

Overrides: object.__init__

__repr__(self)
(Representation operator)

source code 

Returns a string summarizing all known images and tags, suitable for printing on stdout or pasting into a Tags file.

Overrides: object.__repr__

write_tag_file(self)

source code 

Save the current set of tags to a Tags file chosen from the top-level directory used in the images we've seen. If there was a previous Tags file there, it will be saved as Tags.bak.

read_tags(self, dirname)

source code 

Read in tags from files named in the given directory, and tag images in the imagelist appropriately. Tags will be appended to the tag_list.

add_tag(self, tag, img)

source code 

Add a tag to the given image. img is a metapho.Image. tag may be a string, which can be a new string or an existing one, or an integer index into the tag list. Return the index (in the global tags list) of the tag just added, or None if error.