Chapter 2: Installing Leo

System requirements
Installing leo.py
Installing the Windows version of Leo
Quick start

System requirements

leo.py is Leo2 written in Python and Tk. It should work on any platform that supports Python 2.2 or later and Tk 8.3 or later. The Borland version of Leo runs under Windows 95/98/Me/XP/NT.

Installing leo.py

  1. Download Python from http://python.org/
  2. Download tcl/Tk from http://tcl.activestate.com/software/tcltk/
  3. Leo is distributed as a single compressed folder. Simply uncompress this folder and run leo.py. You can run leo.py by double-clicking leo.py. You can also run leo.py from a Python interpreter as follows:
import leo leo.run() # runs leo.py, opening a new outline.
leo.go() # runs leo.py after reloading all modules.
leo.open(fileName) # runs leo.py, reloads all modules, and opens fileName.

Installing the Windows version of Leo

For leo.py: Leo is distributed as a single compressed folder. Simply uncompress this folder and run leo.py. You can run leo.py by double-clicking leo.py. You can also run leo.py from a Python interpreter as follows:

	import leo
	leo.run() # runs leo.py, opening a new outline.
	leo.go() # runs leo.py after reloading all modules.
	leo.open(fileName) # runs leo.py, reloads all modules, and opens fileName.

leo.py 2.4 and above will open .leo files automatically provided that you associate leo.py with .leo files. Here is how to open leo.py when double-clicking a .leo file on Windows 2K or XP. I'm not sure it will work for Windows 95/98/Me.

In Windows 2K or XP, Go to Start->Settings->Control panel, open the "Folder Options" applet. Select the "file types" tab from the Folder Options window. Press the "new" button. Enter LEO into the "Create New Extension" File Extension text field. Press OK.

With LEO still highlighted in the Registered File Types list box, press the Advanced button. Change the default file type field to something like "Leo Literate Outline", press the Icon button and browse to the LeoDoc icon in your [leo installdir]\leo-2.3\Icons folder. Click OK. This gets the icons right and registers the description of the .leo file.

You now have to tell windows what to do to open the file properly. Press the new button to open the "New Action" window. In the Action field type Open. In the "Action used to perform action" type:

	[python install dir]\pythonw.exe [leo install dir]\leo.py %1

You should now be able to double click on a leo file in explorer with leo.py. If you like to see the DOS window open, use python.exe rather than pythonw.exe in the above. This is useful for seeing exceptions; if you don't have the DOS window open Leo will just go away if an uncaught exception happens.

For the Borland version of Leo: The Icons folder contains two Icons, called LeoApp and LeoDoc, that represent the Leo application and Leo documents respectively.  In Windows, to associate LeoDoc with .leo files, open the Setting:Folder Options:File Type panel, create an entry for .leo files. Then choose Change Icon and select the LeoDoc icon. Associate leo.py as the application to open .leo files.

Quick start

This is the minimum you need to use Leo effectively.

  1. Write body text using the noweb languages. See Using noweb, CWEB and Directives.
  2. Create source files (derived files) using the Tangle command. Only @root directives under the currently selected headline are tangled by the Tangle command. Warning: The Tangle command will overwrite files specified in @root directives if they exist.
  3. Use the Untangle command to propagate changes made to derived files back into the outline Untangle is useful only for making small syntactic changes. Don't attempt to change the structure of an outline by modifying derived files; it won't work.
  4. Many command key abbreviations are specified in the Syntax Coloring panel.
  5. See the Appendices for a concise summary of information about Leo.