# Main File

Any number of custom user panels may be written. For each user panel, a tree item must be created. These are referred to as leave node tree items.

The panels (menus and functions) are then connected to these leave node items. In addition, one or more tree items may be created for the purpose of organizing the leave node items. These items typically do not have any associated panels or functions.

The tree items and panel definitions are written in Python. Typically one Python file is written for each panel, plus a main Python file to organize them all. The structure of the main Python file is:
UsrHead = TreeItem( parent = root,
name = 'Custom Name',
tooltip = 'This is the tooltip/bubble info',
whatsthis= 'This is the whatsthis extended info',
helpURL = 'pointer to an html help file',
popup = ( ) )
Include( "Panel1.py" )
Include( "Panel2.py" )

The TreeItem() function creates a new tree item and places it under the tree item specified by the parent argument, root in this case. The returned value is stored in the variable UsrHead, which may be used as the parent of the subsequent tree items, as defined in Panel.py and Panel2.py files. The name that appears on the data tree is given by the name argument. This is typically the name of the application (External Aero, Static Mixer, ...) or organization (company).

The tooltip, whatsthis and helpURL arguments provide three levels of documentation. The tooltip displays a bubble with a short message, when the cursor remains on top of the item for a short period. The whatsthis information is typically longer information, one or more sentences, shown when you click on the Whatsthis icon and then click on the tree item. The whatsthis value is a rich text format, which means you can embed many of the HTML tags, such as <br> for line separator and <b> for bold. The helpURL is a pointer to an HTML file with extensive information. Any of these may be skipped.

The popup parameter specifies the behavior of the right-click on the tree item. In this case, there are no popups.

The Include() function is used to include other Python files. This is equivalent to including the content of Panel.py and Panel2.py in the main Python file. Note that these files must be in the same directory as Main.py.

Note that all variables defined by you must start with the letters Usr and all functions must start with the letters usr. This will guarantee that there will not be any name conflict with built-in variables and functions.

As an example, consider the following Python codes, stored in the file Main.py:
UsrMixing = TreeItem( parent = root,
name = 'Custom Mixing',
tooltip = 'Simplified Custom Mixing Panels',
whatsthis= 'These are a set of custom panels<br>'
'which facilitate specification of<br>'
'<b>mixing</b> problem',
helpURL = 'custom_mixing.html',
sort = FALSE,
popup = ( ) )
Include( "StaticMixer.py" )
Include( "TankMixer.py" )
Include( "RotorStator.py" )
Given the above files, start AcuConsole as
acuConsole -up Main.py
or place the following in the Acusim.cnf file:
user_panels= Main.py
and start AcuConsole as
acuConsole

Note that any number of Main.py files may be included. user_panels accepts a comma separated list of main files.

Finally, the above Python files may be compiled by issuing the command:
acuConsole -cp Main.py
This creates a single file Main.zip, which may be passed to AcuConsole as
acuConsole -up Main.zip