FgdEntityProperty

class valvefgd.FgdEntityProperty(name, value_type, readonly=False, report=False, display_name=None, default_value=None, description=None, choices=[])[source]

An entity property, as represented in a Fgd file.

__init__(name, value_type, readonly=False, report=False, display_name=None, default_value=None, description=None, choices=[])[source]

Creates an instance of FgdEntityProperty.

Parameters:
  • name (str) – The property’s name.

  • value_type (str) – The property’s value type. Ex:’integer’, ‘float’, ‘choices’, etc…

  • readonly (bool, optional) – The property’s readonly status.

  • report (bool, optional) – The property’s report status.

  • display_name (str, optional) – The property’s display name.

  • default_value (str, optional) – The property’s unparsed default value.

  • description (str, optional) – The property’s description.

  • choices (list[FgdEntityPropertyChoice], optional) – The property’s choices. (applicable only to value_type “choices”)

__repr__()[source]

A partial, printable summary of a FgdEntityProperty.

Returns:

A Python formated string.

Return type:

str

property schema

A schematic view of this entity property’s attributes.

Returns:

A dictionary

Return type:

dict

property name

The property’s name.

Return type:

str

property value_type

The property’s type.

Return type:

str

property readonly

The property’s readonly status. (disables editing property in Hammer)

Return type:

bool

property report

The property’s report status. (displays property value in Hammer’s entity report)

Return type:

bool

property display_name

The property’s display_name.

Return type:

str

property default_value

The property’s unparsed default_value.

Return type:

str

property description

The property’s description.

Return type:

str

property choices

The property’s choices.

Return type:

list[FgdEntityPropertyChoice]

choice_by_value(choice_value)[source]

Finds a property choice by its value

Parameters:

choice_value (int) – The property choice value to look for.

Raises:

ChoiceNotFound – Whenever a property choice could not be found.

Returns:

A property choice with matching value.

Return type:

FgdEntityPropertyChoice

fgd_str()[source]

A string representation of the entity property formated as in the a .fgd file.

Returns:

Fgd formated string.

Return type:

str