Source

rope_py3k / ropeide / editingcontexts.py

from ropeide import editingtools


class EditingContext(object):

    def __init__(self, name, core):
        self.core = core
        self.name = name

    def _get_editing_tools(self):
        project = self.core.get_open_project()
        return editingtools.get_editingtools_for_context(
            self, project, self.core.get_prefs())

    editingtools = property(_get_editing_tools)

contexts = {}

def init_contexts(core):
    for name in ['python', 'rst', 'others', 'none']:
        if name not in contexts:
            context = EditingContext(name, core)
            globals()[name] = context
            contexts[name] = context