def discover_snippet_contexts(): dirs_to_scan = [ os.path.join(os.path.dirname(__file__), 'snippets'), join_to_data_dir('snaked', 'snippets'), ] for d in dirs_to_scan: if os.path.exists(d): for name in os.listdir(d): path = os.path.join(d, name) nm, ext = os.path.splitext(name) if ext == '.snippets' and os.path.isfile(path): existing_snippet_contexts[nm] = path
import sys from uxie.utils import join_to_data_dir, idle from .prefs import ListSettings import snaked.plugins snaked.plugins.__path__.insert(0, join_to_data_dir('snaked', 'plugins')) default_enabled_plugins = ['save_positions', 'edit_and_select', 'python', 'complete_words', 'hash_comment', 'python_flakes', 'goto_line', 'search'] enabled_plugins = [] enabled_plugins_prefs = ListSettings('enabled-plugins.db') def get_package(name): try: return sys.modules[name] except KeyError: __import__(name) return sys.modules[name] def get_plugin(name): package_name = 'snaked.plugins.' + name return get_package(package_name) def init_plugin(name, manager): try: p = get_plugin(name)