The Project template wizard lists a selection of templates. The default
set is found automatically by GPS in the share/gps/templates
directory
of your GPS installation.
It is possible to register new directories in which GPS will look for
templates, by using the Shell/Python command
GPS.ProjectTemplate.add_templates_dir
.
To create a new project template, first create a subdirectory in the
share/gps/templates/
directory, or in one of the directories which has
been registered through GPS.ProjectTemplate.add_templates_dir
. Then, in
this directory, create one template description file.
A template description file is a text file with the .gpt
extension,
with the following syntax:
Name: <name> Category: <category> Project: <project file> <optional_hook_line> <variable_1>: <variable_1_default_value>: <variable_1_description> <variable_2>: <variable_2_default_value>: <variable_3_description> <etc> [Description] <the description>
Where the following should be defined:
/
.
post_hook: <python_file>
where
<python_file>
is the name of a Python file present in the same directory
as the template description file. This Python file will be run by GPS once,
right after the project template is deployed
When deploying templates, GPS will copy in the destination directory chosen by the use all files and directories present in the directory that contains the template description file, except the Python file indicated as post_hook, and the template description file itself.
As it deploys templates, GPS will replace strings of the form
@_<variable_name>_@
with the value of the variable.
If <variable_name>
is all lower case, the substitution will be
transformed to lower-case. If <variable_name>
is in Mixed_Case, the
substitution will be transformed into Mixed_Case as well. If it is in upper
case, then the substitution will contain the original value specified by the
user.