Skip to content

BuildingElementStringTable

Script for BuildingElementStringTable

BuildingElementStringTable

Canonical path: BuildingElementStringTable.BuildingElementStringTable

Bases: BuildingElementStringTableBase

Definition of class StringTable

__init__

__init__(path: str, numeric: bool, lang: str)

Initialization of class StringTable

Parameters:

  • path (str) –

    path of according .py file. The file name will be set internally to _xyz.xml

  • numeric (bool) –

    the string table will be created only from numeric (123..) text ids or not numeric text ids (e_THE_VALUE)

  • lang (str) –

    language shortcut

add_entry

add_entry(val_number: str, val_str: str) -> bool

Creates an string table entry

Parameters:

  • val_number (str) –

    index number in the list

  • val_str (str) –

    string value

Returns:

  • bool

    True for success

  • bool

    False if number already exists

get_entry

get_entry(str_val_number: Union[str, int]) -> Tuple[str, bool]

Returns a string table entry

Parameters:

  • str_val_number (Union[str, int]) –

    value or number of the string

Returns:

  • Tuple[str, bool]

    (string entry, True/False for success)

get_key

get_key(entry: str) -> Optional[str]

Returns the key for a string table entry

Parameters:

  • entry (str) –

    entry to search corresponding key

Returns:

  • Optional[str]

    Key, None if not found

get_string

get_string(string_id: str, default_string: str) -> str

Get a string from the table

Parameters:

  • string_id (str) –

    String ID (if empty, take it from {...} part of the string

  • default_string (str) –

    Default string in case of no existing ID

Returns:

  • str

    String from the ID if exist, default string otherwise