The active_path plugin lets you browse directories and import files,
once activated you can just call a node:
  @path /path/to/somewhere
and double click on that to expand / import.  There are also context
menu commands to recursively import whole folders.  `@path .` works if
you want to start relative to the .leo file.

Really not sure what's going on with this thread, I think it started in
2013?  And seems to contain answers to posts I didn't see - should try
and get to the bottom of that.

Cheers -Terry


On Mon, 20 Jul 2015 06:59:08 -0500
"Edward K. Ream" <[email protected]> wrote:

> On Sat, Jul 18, 2015 at 1:10 PM, <[email protected]> wrote:
> 
> >
> > I'm new to this editor and try to import my python files. I can
> > create a @clean node (really cool feature btw) with the file name
> > and replace the new file with my already written python program.
> > Unfortunately this only creates a node with a lot of text. On the
> > search for more structured import I stumbled across this thread.
> >
> 
> ​For single files, use the import-file command.  This will prompt for
> a file, and import it to an @clean node using one of Leo's
> language-specific importers if possible.
> 
> For multiple files, run the following script, changing it as needed:
> 
> '''
> Recursively import all python files in a directory
> and clean the result.
> '''
> c.recursiveImport(
>     dir_ = << absolute path to a directory >>
>     kind = '@clean', #'@nosent','@auto','@file',
>     one_file = False,
>     safe_at_file = False, # True,
>     theTypes = ['.py',],
> )
> 
> Here is the docstring for c.recursiveImport:
> 
> '''
> Recursively import all python files in a directory and clean the
> results.
> 
> Parameters::
> dir_         The root directory or file to import.
> kind         One of ('@clean','@edit','@file','@nosent').
> one_file     True: import only the file given by dir_.
> safe_at_file True: produce @@file nodes instead of
>              @file nodes.
> theTypes     A list of file extensions to import.
>              None is equivalent to ['.py']
> 
> This method cleans imported files as follows:
> 
> - Replace backslashes with forward slashes in headlines.
> - Remove empty nodes.
> - Add @path directives that reduce the needed path specifiers in
> descendant nodes.
> - Add @file to nodes or replace @file with @@file.
> '''
> 
> Edward
> 

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to