Пример #1
0
    def edit_contexts(self, editor):
        import shutil
        from os.path import join, exists, dirname
        from snaked.util import make_missing_dirs

        contexts = join(editor.project_root, '.snaked_project', 'contexts')
        if not exists(contexts):
            make_missing_dirs(contexts)
            shutil.copy(join(dirname(__file__), 'contexts.template'), contexts)

        e = editor.open_file(contexts)
        e.file_saved.connect(self, 'on_context_saved')
Пример #2
0
def edit_external_tools(editor):
    import shutil
    from os.path import join, exists, dirname
    from snaked.util import make_missing_dirs

    filename = join_to_settings_dir('external.tools')
    if not exists(filename):
        make_missing_dirs(filename)
        shutil.copy(join(dirname(__file__), 'external.tools.template'), filename)

    e = editor.open_file(filename)
    e.connect('file-saved', on_external_tools_save)
Пример #3
0
    def edit_context(self, ctx):
        user_snippet_filename = join_to_settings_dir('snippets', ctx + '.snippets')
        if ctx in self.existing_snippets and \
                self.existing_snippets[ctx] != user_snippet_filename:

            import shutil
            make_missing_dirs(user_snippet_filename)
            shutil.copy(self.existing_snippets[ctx], user_snippet_filename)

        idle(self.hide)
        e = self.editor().open_file(user_snippet_filename)
        e.connect('file-saved', on_snippet_saved, ctx)
Пример #4
0
def edit_rope_hints(editor):
    import shutil
    from os.path import join, exists, dirname
    from snaked.util import make_missing_dirs

    if not editor.project_root:
        editor.message('Can not determine current project.\n'
            'Are you editing read-only file?\n'
            'Also check existence of .snaked_project directory', 8000)
        return

    ropehints = join(editor.project_root, '.ropeproject', 'ropehints.py')
    if not exists(ropehints):
        make_missing_dirs(ropehints)
        shutil.copy(join(dirname(__file__), 'ropehints_tpl.py'), ropehints)

    editor.open_file(ropehints)
Пример #5
0
def get_settings_path(name):
    filename = join_to_settings_dir(name)
    make_missing_dirs(filename)
    return filename