Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: /leo/plugins/, /leo/scripts/

Discussion topic

Back to topic list

CVS update: /leo/plugins/, /leo/scripts/

Author bwmulder
Full name Bernhard Mulder
Date 2006-07-17 08:43:47 PDT
Message User: bwmulder
Date: 2006-07-17 08:43:47-0700


 Add convert_to_shadow script; update mod_shadow comment

File Changes:

Directory: /leo/plugins/

File [changed]: mod_shadow.py
Url: http://leo.tigris.or​g/source/browse/leo/​plugins/mod_shadow.p​y?r1=1.4&r2=1.5
Delta lines: +13 -21
--- mod_shadow.py 2006-07-15 08:34:53-0700 1.4
+++ mod_shadow.py 2006-07-17 08:43:44-0700 1.5
@@ -7,28 +7,14 @@
 Use a subfolder for files with Leo comments.
-Adapted for post 4.2 (cvs versoin).
-I have not yet written unit tests for this plugin. Please use with
-I have seen some messages when updating from external
-sources, which I have not yet analysed.
 This plugin allows you to use Leo with files which contain no
 Leo comments, and still have information flow in both directions:
 from the file into Leo, and from Leo into the file.
-To start using this plugin:
- - Go to the directories where the sources are.
- - Create a subfolder called LeoShadow (or whatever you have set shodow_subdir to).
- - Copy the files into the subfolder.
- - Replace the files with files of length 0.
- (actually: <= 2, so that on Windows you can say: @echo.>filename)
- - Enable this plugin.
- - Start Leo.
+ The simplest way to start using this plugin is to use the 'convert_to_shadow.py'
+ script in the scripts section.
- After starting, Leo will copy the files from the LeoShadow subfolder to the old
+ After (re)starting, Leo will copy the files from the LeoShadow subfolder to the old
     location after removing all sentinels.
     After this initial setup, changes in Leo will be reflected both in the file
@@ -37,8 +23,14 @@
     Conversely, changes in the file without sentinels will flow back to the file
     in the leo subfolder, and show up in Leo.
+ Text insertions within a node will show up as expected. Text insertion
+ at the end of the node will show up and the end of the node.
+ Note that the plugin never structures input; this has to be done manually
+ within Leo.
 You can change the name of the shadow subfolder, default Leo, via the mod_shadow.ini
-configuration file.
+configuration file (to be changed in the near future).
     verbosity >= 1: print logon message in status pane.
@@ -98,8 +90,8 @@
 #@+node:ekr.20060715​100156.55:<< globals >>
 __version__ = "$Rev: 2900 $"
 __author__ = "Bernhard Mulder"
-__date__ = "$Date: 2006/07/15 15:34:53 $"
-__cvsid__ = "$Id: mod_shadow.py,v 1.4 2006/07/15 15:34:53 edream Exp $"
+__date__ = "$Date: 2006/07/17 15:43:44 $"
+__cvsid__ = "$Id: mod_shadow.py,v 1.5 2006/07/17 15:43:44 bwmulder Exp $"
 #@-node:ekr.20060715​100156.55:<< globals >>
 #@<< Notes >>

Directory: /leo/scripts/

File [added]: convert_to_shadow.py
Url: http://leo.tigris.or​g/source/browse/leo/​scripts/convert_to_s​hadow.py?rev=1.1​&content-type=text/v​nd.viewcvs-markup
Added lines: 52
Put files into the LeoShadow subfolder.


   1. convert.py <filename> LeoShadow x

   This copy file <filename> into the subfolder leoShadow,
   adds the prefix, and creates an empty file at the
   current location.

   After restarting Leo, <filename> will be re-created without

   2. convert -all LeoShadow x

   Apply 'convert.py <filename> LeoShadow x' to all .py files.

   Must be run in the directory with the .py files.

   x is the prefix specified the for mod_shadow plugin.
import os, sys, shutil

def convert(filename, leoFolder, prefix):
   if not os.path.exists(leoFolder):
       assert os.path.exists(leoFolder)
       assert os.path.isdir(leoFolder)
   dir, name = os.path.split(filename)
   newname = os.path.join(dir, leoFolder, prefix + name)
   if os.path.exists(newname):
   print "Putting", filename, "into the shadow folder", leoFolder
   os.rename(filename, newname)
   f = open(filename, "w")

if __name__ == '__main__':
    scriptname, filename, leoFolder, prefix = sys.argv
    if filename == '-all':
        for filename in os.listdir("."):
            rest, extension = os.path.splitext(filename)
            if extension == '.py':
                if (extension not in ['.leo', '.pyc'] and
                    not filename.startswith(​"convert")):
                    if os.path.isfile(filename):
                        convert(filename, leoFolder, prefix)
        convert(filename, leoFolder, prefix)

« Previous message in topic | 1 of 1 | Next message in topic »


Show all messages in topic

CVS update: /leo/plugins/, /leo/scripts/ bwmulder Bernhard Mulder 2006-07-17 08:43:47 PDT
Messages per page: