Miscellaneous Modules
TEA for Espresso contains several modules that you are unlikely to ever need to access directly, but are nonetheless available.
tea_utils
This module is deprecated. Please do not use it.
In most scenarios you won’t need to load anything from tea_utils. It currently only houses the custom loading action that’s used by the main class to load TEA action scripts and the logic for refreshing symlinks that enable custom user actions.
load_action target (string), *roots (array)
Searches for the module target in common TEA-locations (see Support folder) appended to each element in roots.
import os
from tea_utils import *
roots = [
os.path.expanduser('~/Library/Application Support/Espresso'),
my_bundle_path
]
target_module = load_action('action_name', *roots)
if target_module is None:
# Couldn't find the module, do something about it
else:
target_module.act(context)
# Or you could run any other functions in the module
refresh_symlinks bundle_path (string), rebuild (bool : False
)
Walks the file system and adds or updates symlinks to the TEA user actions folder. You should never need to use this function.
zencoding
The zencoding module provides the latest features from the Zen Coding project. Unfortunately, documentation is currently scarce for zencoding, so please explore the source if you need information on how it works.
You can also see word_to_snippet.py or balance.py for examples of Zen Coding in use within TEA.
persistent_re
This class allows you to easily check a string against multiple regex without needing to run the regex twice. See insert_url_snippet.py for an extended example. Example usage:
from persistent_re import *
gre = persistent_re()
if gre.match(r'foo(bar)$', text):
return gre.last.group(1)
elif elif gre.search(r'bar(foo)', text):
return gre.last.group(1)