Result Module

Inheritance diagram of Result

This module handles reading the result definition files. The result definition XML files instructs the Python Interface on what results should be shown by default in the SVG/HTML output formats. This module also contains the result visibility class used for defining visible/hidden results within result objects. Each list of element results should also contain a reference to a result visibility instance.

class TEracsResultDefinitions(AProgramNum)

This class handles loading/reading of the result definitions XML file.

GetVisibilityForElement(ATypecode)

Get all of the visible results for a particular calculation mode and element type.

Parameters

ATypecode (str) – The element typecode.

Returns

3 values, mandatory results, shown results, and hidden results.

class TEracsResultVisibility(AMandatory: set = {}, AShown: set = {}, AHidden: set = {}, *args, **kwargs)

This class is used to view and modify result visibility for a set of results. This class can be used with multi-inheritance to extend the basic functionality already provided in result objects. Sets are used rather than lists because we want to ensure result keys are not duplicated.

property Visible

A dictionary listing the visible, hidden, and mandatory results. The returned dictionary is new, and not stored internally, thus changing it will have no effect. To change the visibility of results, use the appropriate methods… Show(), and Hide().

Example

Visible = { “mandatory”: [“caption”, “resx”, “resy”], “optional”: [“pg”, “qg”] }

Type

dict.

Writable

False.

ApplyVisibility(AMandatory: Optional[set] = None, AShown: Optional[set] = None, AHidden: Optional[set] = None) None

Rather than doing Show() or ShowAll(), you can call this method and apply all the changes directly by replacing the underlying sets with those provided. This method doesn’t check for duplication, ensure that a result identifier doesn’t show up in two different sets.

Parameters
  • AMandatory (set) – Optional, can be provided to set all mandatory results.

  • AShown (set) – Optional, can be provided to set all shown results.

  • AHidden (set) – Optional, can be provided to set all hidden results.

Returns

None.

Show(AResult, *args)

Show a result. If the result was hidden, it’ll become shown, but if already shown, the method will have no effect.

Parameters
  • AResult (str) – The result to show.

  • args (str) – Any other results to also show. This method recursively calls itself.

Returns

None.

Raise

TEracsArgumentError - If the provided result is unknown/invalid.

ShowAll()

Show all of the results. This will call the Show() method, passing in each hidden result separately as a deconstructed list.

Returns

None.

Hide(AResult, *args)

Hide a result. If the result was shown, it’ll become hidden, but if already hidden, the method will have no effect.

Parameters
  • AResult (str) – The result to hide.

  • args (str) – Any other results to also hide. This method recursively calls itself.

Returns

None.

Raise

TEracsArgumentError - If the provided result is unknown/invalid.

HideAll()

Hide all of the results. This will call the Hide() method, passing in each shown result separately as a deconstructed list.

Returns

None.

GetOnlyVisibleResults()

Returns only the visible results.

Returns

A dict/list containing all results that are listed as visible.