This code may be used as a start for editing on remote machines.

Put this in an @button FTP-ls node:

from ftplib import FTP

def ftp_get(line):

directory = p
x=FTP('host', 'user_name', 'password')

for filename in x.nlst():
    p = directory.insertAsLastChild()
    x.retrlines('RETR ' + filename, ftp_get)
    p.setTnodeText('\n'.join(bodyLines)) # use p.setBodyStringOrPane('\n'.join(bodyLines)) for Leo4.4.1.1



Create a node having a header string that is the name of a directory on your remote FTP-host. While this node is selected, press the FTP-ls button to obtain a subtree in which every node represents a subdirectory or file.

Since I'm using this on a configuration where there are no subdirectories, I have no problem filling the body panes with the contents of files in the directory. I don't know what will happen in the retrlines function when filename is a subdirectory.

I use this button for analyzing remote code mainly. I think to make changes to the remote code would involve writing a local file and subsequently upload it.

Scripting for 4.4.2 --edreamleo, Thu, 12 Oct 2006 04:04:53 -0700 reply

As the result of 'the big reorg' (making positions, vnodes and tnodes independent of Leo, especially c) the proper way to set headline and body text are:

c.setBodyString(p,body) # set body text of p to body.
c.setHeadString(p,head) # set headline text of p to head.

You can prevent c.setBodyString from redrawing the body pane more than once using the standard pattern:

    << code that might redraw the body our outline panes >>