tool_templates¶
Tool template classes.
| authors: |
|
|---|---|
| date: | 24.1.2018 |
Module Contents¶
-
class
tool_templates.ToolTemplate(toolbox, name, tooltype, path, includes, description=None, inputfiles=None, inputfiles_opt=None, outputfiles=None, cmdline_args=None, execute_in_work=True)[source]¶ Bases:
metaobject.MetaObjectSuper class for various tool templates.
-
toolbox¶ QMainWindow instance
Type: ToolBoxUI
-
name¶ Name of the tool
Type: str
-
description¶ Short description of the tool
Type: str
-
path¶ Path to tool
Type: str
-
includes¶ List of files belonging to the tool template (relative to ‘path’) # TODO: Change to src_files
Type: str
-
inputfiles¶ List of required data files
Type: list
-
inputfiles_opt¶ List of optional data files (wildcards may be used)
Type: list, optional
-
outputfiles¶ List of output files (wildcards may be used)
Type: list, optional
-
cmdline_args¶ Tool command line arguments (read from tool definition file)
Type: str, optional
-
execute_in_work¶ Execute in work folder?
Type: bool
-
set_return_code(self, code, description)[source]¶ Set a return code and associated text description for the tool.
Parameters: - code (int) – Return code
- description (str) – Description
-
set_def_path(self, path)[source]¶ Set definition file path for tool.
Parameters: path (str) – Absolute path to the definition file.
-
static
check_definition(ui, data)[source]¶ Check that a tool template definition contains the required keys and that it is in correct format.
Parameters: - ui (ToolboxUI) – QMainWindow instance
- data (dict) – Tool template definition
Returns: Dictionary or None if there was a problem in the tool definition.
-
-
class
tool_templates.GAMSTool(toolbox, name, tooltype, path, includes, description=None, inputfiles=None, inputfiles_opt=None, outputfiles=None, cmdline_args=None, execute_in_work=True)[source]¶ Bases:
tool_templates.ToolTemplateClass for GAMS tool templates.
-
name¶ GAMS Tool name
Type: str
-
description¶ GAMS Tool description
Type: str
-
path¶ Path to model main file
Type: str
-
includes¶ List of files belonging to the tool (relative to ‘path’). # TODO: Change to src_files
Type: str
-
First file in the list is the main GAMS program.
-
inputfiles¶ List of required data files
Type: list
-
inputfiles_opt¶ List of optional data files (wildcards may be used)
Type: list, optional
-
outputfiles¶ List of output files (wildcards may be used)
Type: list, optional
-
cmdline_args¶ GAMS tool command line arguments (read from tool definition file)
Type: str, optional
-
update_gams_options(self, key, value)[source]¶ Update GAMS command line options. Only ‘cerr and ‘logoption’ keywords supported.
Parameters: - key – Option name
- value – Option value
-
static
load(toolbox, path, data)[source]¶ Create a GAMSTool according to a tool definition.
Parameters: - toolbox (ToolboxUI) – QMainWindow instance
- path (str) – Base path to tool files
- data (dict) – Dictionary of tool definitions
Returns: GAMSTool instance or None if there was a problem in the tool definition file.
-
-
class
tool_templates.JuliaTool(toolbox, name, tooltype, path, includes, description=None, inputfiles=None, inputfiles_opt=None, outputfiles=None, cmdline_args=None, execute_in_work=True)[source]¶ Bases:
tool_templates.ToolTemplateClass for Julia tool templates.
-
name¶ Julia Tool name
Type: str
-
description¶ Julia Tool description
Type: str
-
path¶ Path to model main file
Type: str
-
includes¶ List of files belonging to the tool (relative to ‘path’). # TODO: Change to src_files
Type: str
-
First file in the list is the main Julia program.
-
inputfiles¶ List of required data files
Type: list
-
inputfiles_opt¶ List of optional data files (wildcards may be used)
Type: list, optional
-
outputfiles¶ List of output files (wildcards may be used)
Type: list, optional
-
cmdline_args¶ Julia tool command line arguments (read from tool definition file)
Type: str, optional
-
update_julia_options(self, key, value)[source]¶ Update Julia command line options.
Parameters: - key – Option name
- value – Option value
-
static
load(toolbox, path, data)[source]¶ Create a JuliaTool according to a tool definition.
Parameters: - toolbox (ToolboxUI) – QMainWindow instance
- path (str) – Base path to tool files
- data (dict) – Dictionary of tool definitions
Returns: JuliaTool instance or None if there was a problem in the tool definition file.
-
-
class
tool_templates.PythonTool(toolbox, name, tooltype, path, includes, description=None, inputfiles=None, inputfiles_opt=None, outputfiles=None, cmdline_args=None, execute_in_work=True)[source]¶ Bases:
tool_templates.ToolTemplateClass for Python tool templates.
-
name¶ Python Tool name
Type: str
-
description¶ Python Tool description
Type: str
-
path¶ Path to model main file
Type: str
-
includes¶ List of files belonging to the tool (relative to ‘path’). # TODO: Change to src_files
Type: str
-
First file in the list is the main Python program.
-
inputfiles¶ List of required data files
Type: list
-
inputfiles_opt¶ List of optional data files (wildcards may be used)
Type: list, optional
-
outputfiles¶ List of output files (wildcards may be used)
Type: list, optional
-
cmdline_args¶ Python tool command line arguments (read from tool definition file)
Type: str, optional
-
update_python_options(self, key, value)[source]¶ Update Python command line options.
Parameters: - key – Option name
- value – Option value
-
static
load(toolbox, path, data)[source]¶ Create a PythonTool according to a tool definition.
Parameters: - toolbox (ToolboxUI) – QMainWindow instance
- path (str) – Base path to tool files
- data (dict) – Dictionary of tool definitions
Returns: PythonTool instance or None if there was a problem in the tool definition file.
-
-
class
tool_templates.ExecutableTool(toolbox, name, tooltype, path, includes, description=None, inputfiles=None, inputfiles_opt=None, outputfiles=None, cmdline_args=None, execute_in_work=True)[source]¶ Bases:
tool_templates.ToolTemplateClass for Executable tool templates.
-
name¶ Tool name
Type: str
-
description¶ Tool description
Type: str
-
path¶ Path to main script file
Type: str
-
includes¶ List of files belonging to the tool (relative to ‘path’). # TODO: Change to src_files
Type: str
-
First file in the list is the main script file.
-
inputfiles¶ List of required data files
Type: list
-
inputfiles_opt¶ List of optional data files (wildcards may be used)
Type: list, optional
-
outputfiles¶ List of output files (wildcards may be used)
Type: list, optional
-
cmdline_args¶ Tool command line arguments (read from tool definition file)
Type: str, optional
-
static
load(toolbox, path, data)[source]¶ Create an ExecutableTool according to a tool specification.
Parameters: - toolbox (ToolboxUI) – QMainWindow instance
- path (str) – Base path to tool files
- data (dict) – Tool specification
Returns: ExecutableTool instance or None if there was a problem in the tool specification.
-