# Path: snaked/core/prefs.py
# class ListSettings(object):
#     def __init__(self, name):
#         self.path = get_settings_path(name)
# 
#     def exists(self):
#         return os.path.exists(self.path)
# 
#     def load(self, default):
#         try:
#             return [l.strip() for l in open(self.path)]
#         except IOError:
#             return default
# 
#     def store(self, data):
#         open(self.path, 'w').write('\n'.join(data))


import sys
import snaked.plugins
        import traceback
from uxie.utils import join_to_data_dir, idle
from .prefs import ListSettings
    from snaked.core.gui.plugin_prefs import PluginDialog
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)
    except:
        traceback.print_exc()
    else:
        manager.add_plugin(p)

def get_available_plugins():

# Path: snaked/core/prefs.py
# class ListSettings(object):
#     def __init__(self, name):
#         self.path = get_settings_path(name)
# 
#     def exists(self):
#         return os.path.exists(self.path)
# 
#     def load(self, default):
#         try:
#             return [l.strip() for l in open(self.path)]
#         except IOError:
#             return default
# 
#     def store(self, data):
#         open(self.path, 'w').write('\n'.join(data))


# Path: snaked/core/plugins.py
import sys
import snaked.plugins
        import traceback
from uxie.utils import join_to_data_dir, idle
from .prefs import ListSettings
    from snaked.core.gui.plugin_prefs import PluginDialog

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)
    except:
        traceback.print_exc()
    else:
        manager.add_plugin(p)

def get_available_plugins():

        return ListSettings('enabled-plugins.db')