metapho package¶
Subpackages¶
Submodules¶
metapho.imagelist module¶
- metapho.imagelist.add_images(newlist_or_img)[source]¶
Pass either a list of MetaphoImage or a single MetaphoImage.
- metapho.imagelist.pop_image(imgno=None, advance=False)[source]¶
Remove the indicated image from the list and return it. If img is None, remove the current image. If deleting the current image, leave the pointer on the image before the removed one unless advance is True; if popping any other image, don’t move the pointer.
metapho.metapho module¶
The base class for metapho images. Programs with a GUI can inherit from MetaphoImage.
- class metapho.metapho.MetaphoImage(filename, displayed=True)[source]¶
Bases:
objectAn image, with additional info such as rotation and tags.
- classmethod clean_up_nonexistent_files(topdir)[source]¶
For any file that was referenced in a tag file but doesn’t exist on disk, see if perhaps it’s been moved to a different subdirectory under topdir. If so, adjust file path appropriately.
Return a set of filenames removed in case the caller wants to warn the user or take other action. XXX Maybe better to convert to a list before returning?
- delete()[source]¶
Delete the image file FROM DISK, and the image object from the imageList. DOES NOT ASK FOR CONFIRMATION – do that (if desired) from the calling program.
- classmethod find_nonexistent_files()[source]¶
Returns a list of images in the imagelist that don’t exist on disk.
metapho.tagger module¶
- class metapho.tagger.Tagger[source]¶
Bases:
objectManages tags for images.
- IGNORE_DIRNAMES = ['html', 'web', 'bad', '.*_assets$']¶
- SKIP_EXTENSIONS = ['.cr2', '.arw', '.xcf', '.mvi', '.avi', '.mov', '.thm', '.mp4', '.mkv', '.pto', '.txt', '.wav', '.mp3', '.xml', '.pp3']¶
- add_tag(tag, img, category=None)[source]¶
Add a tag to the given image, in the given category or else the current one. img is a metapho.MetaphoImage. 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.
- change_tag(entryno, newstr)[source]¶
Update a tag’s string. Called on focus_out from one of the text entries (in GUI metapho). The entryno should be the same as the index in the current category. Changes it for all categories, not just the current one.
- check_commondir(d)[source]¶
Keep track of the dir common to all directories we use: XXX commondir code is still somewhat experimental.
- find_untagged_files(topdir)[source]¶
Return a list of untagged files and a list of directories in which nothing is tagged, under topdir.
- classmethod ignore_directory(d, path=None)[source]¶
Detect directory names that don’t need to be indexed separately and aren’t likely to have a Tags file; for instance, those that likely contain copies of what’s in the parent, or small copies for a web page. Also, you can skip tagging by creating a file named NoTags.
- static print_files_by_directory(filelist)[source]¶
Given a list of pathnames, group them by which directory they belong to and print them in an organized way.
- process_tag(tagname, filenames)[source]¶
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. Filenames can be relpaths or absolute normpaths.
- read_all_tags_for_images()[source]¶
Read tags in all directories used by known images, plus the common dir, plus . Leave the pointer where it was before.
- read_tags(dirname, recursive=True)[source]¶
Read in tags from files named in the given directory, and tag images in the imagelist appropriately. (Don’t add any new images to the imagelist.) Tags will be appended to the tag_list. If recursive is True, we’ll also look for Tags files in subdirectories.
Module contents¶
metapho: an image tagger and viewer.
- class metapho.Tagger[source]¶
Bases:
objectManages tags for images.
- IGNORE_DIRNAMES = ['html', 'web', 'bad', '.*_assets$']¶
- SKIP_EXTENSIONS = ['.cr2', '.arw', '.xcf', '.mvi', '.avi', '.mov', '.thm', '.mp4', '.mkv', '.pto', '.txt', '.wav', '.mp3', '.xml', '.pp3']¶
- add_tag(tag, img, category=None)[source]¶
Add a tag to the given image, in the given category or else the current one. img is a metapho.MetaphoImage. 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.
- change_tag(entryno, newstr)[source]¶
Update a tag’s string. Called on focus_out from one of the text entries (in GUI metapho). The entryno should be the same as the index in the current category. Changes it for all categories, not just the current one.
- check_commondir(d)[source]¶
Keep track of the dir common to all directories we use: XXX commondir code is still somewhat experimental.
- find_untagged_files(topdir)[source]¶
Return a list of untagged files and a list of directories in which nothing is tagged, under topdir.
- classmethod ignore_directory(d, path=None)[source]¶
Detect directory names that don’t need to be indexed separately and aren’t likely to have a Tags file; for instance, those that likely contain copies of what’s in the parent, or small copies for a web page. Also, you can skip tagging by creating a file named NoTags.
- static print_files_by_directory(filelist)[source]¶
Given a list of pathnames, group them by which directory they belong to and print them in an organized way.
- process_tag(tagname, filenames)[source]¶
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. Filenames can be relpaths or absolute normpaths.
- read_all_tags_for_images()[source]¶
Read tags in all directories used by known images, plus the common dir, plus . Leave the pointer where it was before.
- read_tags(dirname, recursive=True)[source]¶
Read in tags from files named in the given directory, and tag images in the imagelist appropriately. (Don’t add any new images to the imagelist.) Tags will be appended to the tag_list. If recursive is True, we’ll also look for Tags files in subdirectories.