OOF2: The Manual

Chapter 8. Writing OOF2 Extensions

This chapter describes the contents of the source files for OOF2 extensions. It begins with an overview of some import classes. Chapter 7 describes how to assemble the source files into a loadable extension module.

8.1. Source Directory Layout

The OOF2 source code is divided into four main directories:

Most of these directories have a subdirectory called IO for files related to user interactions (menus and such). Inside IO a directory called GUI holds the gtk-specific code for the graphical user interface. It's not always obvious what belongs in IO and what doesn't, so we regretted making that distinction, and the most recent subdirectory, SRC/orientationmap, skips IO and just contains GUI directly.

As a general rule, files in SRC/common don't include or import any files in any other subdirectories. Files in SRC/engine, SRC/image, and SRC/orientationmap include or import code from SRC/common but from nowhere else. Similarly, all of the code in any GUI directory refers to code in the directories above it, but nothing in the directories above refers to anything in GUI. This ensures that the program will work correctly when not using the GUI.[56]

Additional directories within SRC don't have IO or GUI subdirectories. They are

  • EXTENSIONS: Source code for internal extensions.
  • Eigen and unsupported: a copy of the Eigen library and its unsupported extensions.
  • tutorials: the OOF2 tutorials.

Of these, only EXTENSIONS is important to extension authors, probably.



[56] The only exception to these rules is that the code for starting the GUI and loading the various modules, in SRC/common/oof.py, needs to be able to initialize the other modules.