registers options with the .registerOption and
.registerOptions methods (which accept a short name, a long
name, a default value, and a description string) and then
automatically returns a list of variables corresponding to the
options initialized to sensible values (.process)
method). Arguments are registered with a name and a
description (method .registerArgument).
Also has a built-in "help" option that prints the usage string
and exits.
Todo:
automatical testing of allowed option values and types. Move option
definitions into a container class.
direct text output to a file and/or to a window/the console
Detail:
adds support for writing stdout to a log file in addition to
(or in lieu of) writing to a window or the console. Also,
catches all output in a StringIO buffer until the method
.`getStartupLog` is called, which returns the content of the
buffer and reverts to the behavior of the base class. The
log file can either be passed to the constructor (fileName)
or set later by calling the .`setLogFile` method.
After calling .processOptions with the constructor keyword
argument dictionary as argument, all declared options can
be accessed with the .getOption method and set with the
.setOption method.
Notes:
if the constructor dictionary does not provide a value for
an option, the declared default value is used
the options dictionary can be updated in derived
classes (e.g., to declare new options or to assign new
default values to existing options)
the name of the option container ("OPTIONS") can be overridden
with the .getOptionContainerName method
if a value for <optioncallback> is passed, this must
be either a callable (which will be called with self and
the new option value as arguments) or a string (which will
be interpreted as the name of a method to be called with the
new option value as argument)
call this to extract all options declared for this class from the
constructor keyword argument initD.
Since the call to this method always precedes all other
initializations, it is not safe to call option callbacks at this
stage. You will have to explicitly call .initializeOptions for that
purpose.
features "smart redirection": if there is a GUI, a window is
created for displaying output (created with the virtual method
.createWindow, showing header as title); otherwise, output is
written to stream.