Table of Contents
This module contains all the standard function calls that can be made in the context of a compass-style script.
Utility, executes the executable against the run file.
Assuming that the runfile is dumped into the project directory. It starts a search for the executable with in this order:
- local directory
- project directory
- METLIB directory
If we are unable to locate the executable, we simply run it without an explicit directory, and rely on the fact generally %MEDEXE% is on your path.
This function is equivalent to making the following call:
<path>\<exename> /f<runfilename>
Where the <path> was determined by the above rules.
Utility to allow you to run compass-style procedures from the command line.
This function also goes ahead and attempts to read the command line arguments for various options. When executing the procedure from the command line use --help (-h) for a usage message.
You can also see the help message by inspecting cmpsys.COMMANDLINE_USAGE.
0 | Indicates the user simply quit the panel-application window. |
1 | Indicates that the user wanted to execute their procedure against the sub-routine |
If a -h or --help option is found in the command line arguments, the program will display an usage message to sys.stdout, and the script will terminate via a sys.exit(0) call.
If an unknown option is found in the command line arguments, the program will display an usage message to sys.stderr, and the script will terminate via a sys.exit(-1) call.
If an program error occurs, such as selecting an invalid project file with the command line option or anything else, then a sys.exit(-2) is generated.
Returns a list of files for a given type.
This examines the Project Control File (PCF) and the project directory to return a listing of files for a given type.
So for example, say the PCF had the following file 15s listed in it,
- test15.dat
- test15.blt
- test15.slt
But the project directory only had the test15.blt file located in it, then a call to this function would return,
This is useful, since most of the time a user may have only copied a select list of files that are described within the PCF's file 15 list.
Retrieves a panel reference from the currently active procedure based on the title (or panelname) of that panel.
There are two major assumptions that are made when you call this function:
- That the panel has already been constructed. The order of construction is not guaranteed, so its best not to call this function within the context of GPanel.makewidgets().
- That there is an active procedure window open. When the procedure window closes, all resources are released, which implies that we can no longer access the panels.
Standard compass gmain.
Note
That the grailmain function defined in the grail.gsys module will automatically select this function and all its configuration options, if and only if you are running within a compass application.
In other words, you do not need to insert any reference to this function within your script.
Starts the procedure's window and event loop.
Will take the mxpertstring and insert it into a batch file. The batch file will have a :mxend label, and will set minteract equal to "on" at the start, and equal to nothing at the end. For example, the following string,
REM this is a test.
will generate the following batch file,
set minteract=on REM this is a test :mxend set minteract=
If your compass style script is being executed from the command line, then you will need to use this function in order to execute the contents of your mxpert string.
Returns path to the grail procedures configuration file.
Location is determined by examining the User's ROOT_DIR. The grail procedures configuration filename is defined by this modules CMPSYS_USR_FILE constant.
Defines the command line usage. This message is displayed if,
- A compass-style script is created.
- The script uses fromcommandline().
- The user types --help (-h) to display the usage message.
[1] | (1, 2) "sys -- System-specific parameters and functions." Python Library Reference. 28 May 2004. 21 December 2001. <http://www.python.org/doc/2.2/lib/module-sys.html> |
[2] | Lundh, Fredrik. "The PhotoImage Class". An Introduction to Tkinter. 28 May 2004. 1 December 1999. <http://www.pythonware.com/library/tkinter/introduction/photoimage.htm> |