Task Manager XML Attributes

Attributes

The basic item in the XML file is the process item. The process item contains the task items, which can be divided into one or more category items. A task can also have property items (GUI widgets) which are different parts of the task. The properties can also be divided into one or more categories.

Attributes for All Items

eeposition
Docks or undocks the task dialogs. Valid values are undocked and panel.
enabled
The task can be executed in the Task Manager.
Default is true.
help
Text for the tool tip.
helpdocument
Documentation that opens when clicking .
image
For properties, this is only valid for the action button.
label
The name of the process.
tag
Unique item identifier.
visible
Defines if the item is visible. Default is true.

Process Item Attributes

processloadprecommand
The command that runs before the Task Manager is populated.
If the command returns any of 0, '0', False, 'false', or 'False', the Task Manager will not be populated.
processloadpostcommand
The command that runs after the Task Manager is populated.
saveonclose
Prompts you to save the Task Manager session XML file when the session is closed.
sessionsaveprecommand
The command that runs before the session is saved.
In the example, this function prints in the Python window the s=<path_of_new_session_file>, p=<original_xml_path>, and a Boolean value if the session file exists already.
sessionsavepostcommand
The command that runs after the Task Manager session is saved.
title
The name of the Task Manager browser tab.
Example code for the process block:
<root>
    <process label="Pre Process SETGET" 
             tag="preprocess" 
             title="TM Example 1"
             saveonclose="False"
             helpdocument="tmexample1HELP.pdf" 
             eeposition="undocked" 
             processloadprecommand="task_tmexample1_setget.preload(%S, %P)" 
             processloadpostcommand="task_tmexample1_setget.postload(%S, %P)"
             sessionsavepostcommand="task_tmexample1_setget.postsave(%S, %P)" 
             sessionsaveprecommand="task_tmexample1_setget.presave(%S, %P)">

Task Attributes

applybuttonstate
command
Takes the values of the task properties and performs an action.
The Python command that runs upon clicking Apply.
Every task needs a command attribute that runs when you apply the task.
precommand
Defines a command that is executed when the task is selected in the Task Manager browser.
The command that runs upon starting a task.
postcommand
Defines a function that is executed after the task is applied and Task Manager proceeds to the next task.
The command that runs upon ending a task.
xml
The name of task XML file.

Attributes for Task Properties

displaytype
Defines the GUI widget.
Supported types include:
  • string
  • integer
  • unit
  • real
  • boolcheck/boolint
  • combobox
  • fileopen
  • filesave
  • choosedir
  • actionbutton
  • info – read only text
  • hm_entitymultiselector
followupdatecommand
The command that runs after setcommand if the setcommand returns 1/’1’. It runs even without setcommand.
This command does not run upon loading the Task Manager file, which the setcommand may do.
getcommand
This command is run upon entering a task and sets its return value to the corresponding property. This is typically used in conjunction with setcommand
getvaluelistcommand
Gets valuelist by the Python command.
  • For lists, you can return list, tuple or string according to the valuelist description.
setcommand
The command that runs when setting a value in the GUI.
  • This is typically used in conjunction with getcommand.
  • Its main purpose is to pass the value to the business logic (Python code). Upon loading the process XML file, this command runs for each property that has a value defined in the XML file.
    Note: Not running for actionbutton and entity selectors, since the setcommand has a slightly different meaning here.
  • For displaytype="actionbutton", the setcommand is the command that runs when clicking the button.
  • For displaytype="hm_multiselector" (and other selectors) the setcommand does not run upon loading the Task Manager file. The purpose of the setcommand is to pass the collection object to the custom Python code, which in case of hm_multiselector is not the same as the value. The value is the default entity type and this value is saved in the XML file.
validatecommand
Command that validates the input. For example, it can reference a function that checks the length of the string inserted in the GUI and trims the extra characters.
value
The current value of the property.
The value that is displayed.
valuelist
The list for the combobox, entity selector, and file types for opening a file.
String format.
  • Lists: “item1, item2, …”
  • File types, string as per the open file definition
  • Example: "HyperMesh files (*.hm);All Files (*)"
Example code for task attributes and task properties:
<task label="Config" 
              tag="config" 
              command="task_tmexample1_setget.applyConfig()" 
              applybuttonstate="Enabled">
            <category tag="cat_process" label="Process">
              <property label="Working directory" 
                        tag="workingdir" 
                        displaytype="choosedir" 
                        getcommand="task_tmexample1_setget.getWorkDirectory()" 
                        setcommand="task_tmexample1_setget.setWorkDirectory(%V)" />
              <property label="Description" 
                        tag="description" 
                        displaytype="string" 
                        help="Max number of characters: 25" 
                        validatecommand="task_tmexample1_setget.validateDescription(%V)" 
                        setcommand="task_tmexample1_setget.setValue(description, %V)" 
                        getcommand="task_tmexample1_setget.getValue(description)" />
            </category>
            <category tag="config_hm" label="HM file">
                <property label="Select file" 
                          tag="btn_selectfiles" 
                          help="custom image" 
                          displaytype="actionbutton" 
                          image="toolbarFileOpenStrip-16.png" 
                          setcommand="task_tmexample1_setget.selectHMFiles()"/>
                <property label="HM file" 
                          tag="config_hmfile" 
                          enabled="True" 
                          displaytype="fileopen" 
                          getvaluelistcommand="task_tmexample1_setget.getHMFileTypes()" 
                          setcommand="task_tmexample1_setget.setValue(hmfile, %V)" 
                          getcommand="task_tmexample1_setget.getValue(hmfile)" 
                          help="Select an hm file"/>      
            </category>
            <category tag="cat_config_trans" label="Translate">
                <property label="Direction" 
                      tag="config_transdir" 
                      displaytype="combobox" 
                      value="x" 
                      getcommand="task_tmexample1_setget.getValue(transdir)" 
                      getvaluelistcommand="task_tmexample1_setget.getValueList(transdir)" 
                      setcommand="task_tmexample1_setget.setValue(transdir, %V)"/>
                <property label="Distance (integer)" 
                      tag="config_transdist" 
                      displaytype="integer" 
                      getcommand="task_tmexample1_setget.getValue(transdist)"  
                      setcommand="task_tmexample1_setget.setValue(transdist, %V)"/>
            </category>
            <category tag="config_cat_mesh" label="Mesh">
                <property label="Mesh size" 
                          tag="config_meshsize" 
                          displaytype="real" 
                          value="0.6" 
                          validatecommand="task_tmexample1_setget.validateMeshSize(%V)" 
                          setcommand="task_tmexample1_setget.setValue(meshsize, %V)" 
                          getcommand="task_tmexample1_setget.getValue(meshsize)" />
            </category>
            <category tag="config_export" label="Export">
                <property label="File path" 
                          tag="config_optistructfile" 
                          displaytype="filesave" 
                          getvaluelistcommand="task_tmexample1_setget.getOptistructFileTypes()" 
                          setcommand="task_tmexample1_setget.setValue(optistructfile, %V)" 
                          getcommand="task_tmexample1_setget.getValue(optistructfile)" />
            </category>
        </task>

Script Substitutions

%T
Item tag
%V
Value
%S
Session file (saved XML file)
%P
Task Manager file (the original XML file)

Special Behavior for Display Types

actionbutton
setcommandattribute: The command activated by the button.
image: The image of the button.
hm_entitymultiselector
setcommand is required for this since it returns a collection object.
  • The %V used as argument gets the collection object as input to the setcommand.
value is the primary entity type.
valuelist/getvaluelistcommand is the list of entity types that can be selected.